summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-09-27 12:22:13 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-09-27 12:22:13 +0000
commit19153a1e0e99364de1173ae9144a45e2518d88bb (patch)
tree1ade05d0a31ac88f7bea0d99598e3292c7e88ce7 /Build/source/texk/lcdf-typetools
parentadfd582cb6fc0c9b6ebf5055bd48af124dd4ee9e (diff)
lcdf-typetools 2.105
git-svn-id: svn://tug.org/texlive/trunk@38471 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/lcdf-typetools')
-rw-r--r--Build/source/texk/lcdf-typetools/ChangeLog5
-rwxr-xr-xBuild/source/texk/lcdf-typetools/configure84
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-01-win6421
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/README140
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/metrics.hh177
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1cs.hh343
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afm.cc586
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmparse.cc365
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/amfm.cc850
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otf.cc1491
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfcmap.cc474
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgpos.cc328
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfname.cc194
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfpost.cc212
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1font.cc916
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1interp.cc1377
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfcs.cc221
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/ChangeLog (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/ChangeLog)7
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/TL-Changes (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/TL-Changes)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-02-mingw64 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-02-mingw64)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-20-TL-binary (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-20-TL-binary)48
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-21-TL-paths (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-21-TL-paths)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-30-W32TeX (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-30-W32TeX)24
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/7t.enc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/7t.enc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/COPYING (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/COPYING)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/INSTALL (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/INSTALL)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.am)4
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.in)12
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/NEWS (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/NEWS)11
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ONEWS (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ONEWS)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/README.md118
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/autoconf.h.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/autoconf.h.in)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/configure.ac (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/configure.ac)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphlist.txt (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphlist.txt)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphtounicode.tex (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphtounicode.tex)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/config.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/config.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afm.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afm.hh)4
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmparse.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmparse.hh)26
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmw.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmw.hh)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/amfm.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/amfm.hh)30
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/cff.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/cff.hh)172
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/encoding.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/encoding.hh)8
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/findmet.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/findmet.hh)8
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/metrics.hh177
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otf.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otf.hh)174
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfcmap.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh)23
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfdata.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfdata.hh)45
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgpos.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgpos.hh)72
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgsub.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgsub.hh)34
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfname.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfname.hh)56
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfos2.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfos2.hh)39
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfpost.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfpost.hh)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/pairop.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/pairop.hh)52
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/psres.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh)4
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1bounds.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1bounds.hh)32
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1cs.hh345
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1csgen.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1csgen.hh)20
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1font.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1font.hh)40
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1interp.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1interp.hh)108
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1item.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1item.hh)74
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1mm.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1mm.hh)14
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1rw.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1rw.hh)18
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1unparser.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1unparser.hh)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfcs.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfcs.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfhead.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfhead.hh)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfkern.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfkern.hh)18
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/bezier.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/bezier.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/clp.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/clp.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/error.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/error.hh)20
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/filename.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/filename.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/globmatch.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/globmatch.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashcode.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashcode.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/inttypes.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/inttypes.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/landmark.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/landmark.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/md5.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/md5.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/permstr.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/permstr.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/point.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/point.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/slurper.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/slurper.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/straccum.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/straccum.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/string.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/string.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/strtonum.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/strtonum.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/transform.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/transform.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/lcdf-typetools.spec (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/lcdf-typetools.spec)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afm.cc586
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmparse.cc365
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmw.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmw.cc)110
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/amfm.cc850
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/cff.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/cff.cc)1184
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/encoding.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/encoding.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/findmet.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/findmet.cc)130
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/metrics.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/metrics.cc)4
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otf.cc1491
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfcmap.cc457
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdata.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdata.cc)4
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdescrip.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdescrip.cc)18
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgpos.cc328
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgsub.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgsub.cc)916
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfname.cc194
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfos2.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfos2.cc)10
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfpost.cc200
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/pairop.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/pairop.cc)10
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/psres.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/psres.cc)72
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1bounds.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1bounds.cc)34
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1cs.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1cs.cc)298
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1csgen.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1csgen.cc)402
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1font.cc916
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1fontskel.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1fontskel.cc)88
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1interp.cc1377
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1item.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1item.cc)560
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1mm.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1mm.cc)240
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1rw.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1rw.cc)300
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1unparser.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1unparser.cc)48
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfcs.cc232
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfhead.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfhead.cc)42
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfkern.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfkern.cc)86
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/bezier.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/bezier.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/clp.c (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/clp.c)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/error.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/error.cc)48
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/filename.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/filename.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/fixlibc.c (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/fixlibc.c)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/globmatch.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/globmatch.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/landmark.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/landmark.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/md5.c (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/md5.c)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/permstr.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/permstr.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/point.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/point.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/slurper.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/slurper.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/straccum.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/straccum.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/string.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/string.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/strtonum.c (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/strtonum.c)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/transform.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/transform.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/vectorv.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/vectorv.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/m4/lcdf-typetools.m4 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/m4/lcdf-typetools.m4)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/main.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/main.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/mmafm.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/mmafm.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/main.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/main.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/mmpfb.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/mmpfb.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.cc)45
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.c (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.c)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.h (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.h)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.cc)10
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.cc)237
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.hh)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.cc)225
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.1)12
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.hh (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.hh)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist-g2u.txt (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist-g2u.txt)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist.txt (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist.txt)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.am (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.am)0
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.in (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.in)6
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.1 (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.1)2
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.cc (renamed from Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.cc)0
-rw-r--r--Build/source/texk/lcdf-typetools/version.ac4
216 files changed, 10964 insertions, 10926 deletions
diff --git a/Build/source/texk/lcdf-typetools/ChangeLog b/Build/source/texk/lcdf-typetools/ChangeLog
index e8ac7b5ffaa..c0f7ce81857 100644
--- a/Build/source/texk/lcdf-typetools/ChangeLog
+++ b/Build/source/texk/lcdf-typetools/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-26 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import lcdf-typetools-2.105.
+ * version.ac: Adapted.
+
2015-02-16 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am: Use the fragment ../../am/dist_hook.am.
diff --git a/Build/source/texk/lcdf-typetools/configure b/Build/source/texk/lcdf-typetools/configure
index a03f03eb5eb..98b9b29fcff 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.69 for LCDF typetools (TeX Live) 2.104.
+# Generated by GNU Autoconf 2.69 for LCDF typetools (TeX Live) 2.105.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -590,12 +590,12 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='LCDF typetools (TeX Live)'
PACKAGE_TARNAME='lcdf-typetools--tex-live-'
-PACKAGE_VERSION='2.104'
-PACKAGE_STRING='LCDF typetools (TeX Live) 2.104'
+PACKAGE_VERSION='2.105'
+PACKAGE_STRING='LCDF typetools (TeX Live) 2.105'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
-ac_unique_file="lcdf-typetools-2.104/NEWS"
+ac_unique_file="lcdf-typetools-2.105/NEWS"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@@ -1368,7 +1368,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 (TeX Live) 2.104 to adapt to many kinds of systems.
+\`configure' configures LCDF typetools (TeX Live) 2.105 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1439,7 +1439,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of LCDF typetools (TeX Live) 2.104:";;
+ short | recursive ) echo "Configuration of LCDF typetools (TeX Live) 2.105:";;
esac
cat <<\_ACEOF
@@ -1583,7 +1583,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-LCDF typetools (TeX Live) configure 2.104
+LCDF typetools (TeX Live) configure 2.105
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2789,7 +2789,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 (TeX Live) $as_me 2.104, which was
+It was created by LCDF typetools (TeX Live) $as_me 2.105, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -8474,7 +8474,7 @@ fi
# Define the identity of the package.
PACKAGE='lcdf-typetools--tex-live-'
- VERSION='2.104'
+ VERSION='2.105'
cat >>confdefs.h <<_ACEOF
@@ -14078,7 +14078,7 @@ fi
-LCDF_TYPETOOLS_VERSION=2.104
+LCDF_TYPETOOLS_VERSION=2.105
ac_config_headers="$ac_config_headers autoconf.h"
@@ -19928,7 +19928,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-LCDF typetools (TeX Live) config.lt 2.104
+LCDF typetools (TeX Live) config.lt 2.105
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -21425,24 +21425,24 @@ _ACEOF
-LCDF_TYPETOOLS_TREE=lcdf-typetools-2.104
+LCDF_TYPETOOLS_TREE=lcdf-typetools-2.105
-ac_config_files="$ac_config_files Makefile lcdf-typetools-2.104/Makefile"
+ac_config_files="$ac_config_files Makefile lcdf-typetools-2.105/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/liblcdf/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/libefont/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/cfftot1/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/mmafm/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/mmpfb/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/otfinfo/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/otftotfm/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/t1dotlessj/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/t1lint/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/t1rawafm/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/t1reencode/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/t1testpage/Makefile"
-ac_config_files="$ac_config_files lcdf-typetools-2.104/ttftotype42/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/liblcdf/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/libefont/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/cfftot1/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/mmafm/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/mmpfb/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/otfinfo/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/otftotfm/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/t1dotlessj/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/t1lint/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/t1rawafm/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/t1reencode/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/t1testpage/Makefile"
+ac_config_files="$ac_config_files lcdf-typetools-2.105/ttftotype42/Makefile"
cat >confcache <<\_ACEOF
@@ -21996,7 +21996,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 LCDF typetools (TeX Live) $as_me 2.104, which was
+This file was extended by LCDF typetools (TeX Live) $as_me 2.105, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22062,7 +22062,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="\\
-LCDF typetools (TeX Live) config.status 2.104
+LCDF typetools (TeX Live) config.status 2.105
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -22581,20 +22581,20 @@ do
"autoconf.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconf.h" ;;
"CXXLD.sh") CONFIG_COMMANDS="$CONFIG_COMMANDS CXXLD.sh" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "lcdf-typetools-2.104/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/Makefile" ;;
- "lcdf-typetools-2.104/liblcdf/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/liblcdf/Makefile" ;;
- "lcdf-typetools-2.104/libefont/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/libefont/Makefile" ;;
- "lcdf-typetools-2.104/cfftot1/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/cfftot1/Makefile" ;;
- "lcdf-typetools-2.104/mmafm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/mmafm/Makefile" ;;
- "lcdf-typetools-2.104/mmpfb/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/mmpfb/Makefile" ;;
- "lcdf-typetools-2.104/otfinfo/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/otfinfo/Makefile" ;;
- "lcdf-typetools-2.104/otftotfm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/otftotfm/Makefile" ;;
- "lcdf-typetools-2.104/t1dotlessj/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/t1dotlessj/Makefile" ;;
- "lcdf-typetools-2.104/t1lint/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/t1lint/Makefile" ;;
- "lcdf-typetools-2.104/t1rawafm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/t1rawafm/Makefile" ;;
- "lcdf-typetools-2.104/t1reencode/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/t1reencode/Makefile" ;;
- "lcdf-typetools-2.104/t1testpage/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/t1testpage/Makefile" ;;
- "lcdf-typetools-2.104/ttftotype42/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.104/ttftotype42/Makefile" ;;
+ "lcdf-typetools-2.105/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/Makefile" ;;
+ "lcdf-typetools-2.105/liblcdf/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/liblcdf/Makefile" ;;
+ "lcdf-typetools-2.105/libefont/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/libefont/Makefile" ;;
+ "lcdf-typetools-2.105/cfftot1/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/cfftot1/Makefile" ;;
+ "lcdf-typetools-2.105/mmafm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/mmafm/Makefile" ;;
+ "lcdf-typetools-2.105/mmpfb/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/mmpfb/Makefile" ;;
+ "lcdf-typetools-2.105/otfinfo/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/otfinfo/Makefile" ;;
+ "lcdf-typetools-2.105/otftotfm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/otftotfm/Makefile" ;;
+ "lcdf-typetools-2.105/t1dotlessj/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/t1dotlessj/Makefile" ;;
+ "lcdf-typetools-2.105/t1lint/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/t1lint/Makefile" ;;
+ "lcdf-typetools-2.105/t1rawafm/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/t1rawafm/Makefile" ;;
+ "lcdf-typetools-2.105/t1reencode/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/t1reencode/Makefile" ;;
+ "lcdf-typetools-2.105/t1testpage/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/t1testpage/Makefile" ;;
+ "lcdf-typetools-2.105/ttftotype42/Makefile") CONFIG_FILES="$CONFIG_FILES lcdf-typetools-2.105/ttftotype42/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-01-win64 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-01-win64
deleted file mode 100644
index 7f94fdc77bc..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-01-win64
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/liblcdf/error.cc lcdf-typetools-2.104/liblcdf/error.cc
---- lcdf-typetools-2.104.orig/liblcdf/error.cc 2013-09-17 15:40:15.000000000 +0200
-+++ lcdf-typetools-2.104/liblcdf/error.cc 2014-11-05 12:19:23.000000000 +0100
-@@ -320,7 +320,7 @@
- #define ErrH ErrorHandler
-
- static char *
--do_number(unsigned long num, char *after_last, int base, int flags)
-+do_number(uintptr_t num, char *after_last, int base, int flags)
- {
- const char *digits =
- ((flags & ErrH::cf_uppercase) ? "0123456789ABCDEF" : "0123456789abcdef");
-@@ -668,7 +668,7 @@
- }
- void *v = va_arg(val, void *);
- s2 = numbuf + NUMBUF_SIZE;
-- s1 = do_number((unsigned long)v, (char *)s2, 16, flags);
-+ s1 = do_number((uintptr_t)v, (char *)s2, 16, flags);
- s1 = do_number_flags((char *)s1, (char *)s2, 16, flags | cf_alternate_form,
- precision, field_width);
- break;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/README b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/README
deleted file mode 100644
index d9c7aaa409c..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/README
+++ /dev/null
@@ -1,140 +0,0 @@
-LCDF-TYPETOOLS
-==============
-
- LCDF Typetools comprises several programs for manipulating
-PostScript Type 1, Type 1 multiple master, and OpenType fonts.
-
- Cfftot1 translates a Compact Font Format (CFF) font, or a PostScript-
-flavored OpenType font, into PostScript Type 1 format. It correctly
-handles subroutines and hints. See the manual page `cfftot1/cfftot1.1` for
-more information.
-
- Mmafm creates an AFM file (font metrics) corresponding to an instance of
-a multiple-master font. It reads the AMFM and AFM files distributed with
-the font. See MMAFM AND MMPFB, below, and the manual page `mmafm/mmafm.1`
-for more information.
-
- Mmpfb creates a normal, single-master font program which looks like an
-instance of a multiple-master font. It reads the multiple master font
-program in PFA or PFB format. See MMAFM AND MMPFB, below, and the manual
-page `mmpfb/mmpfb.1` for more information.
-
- Otfinfo reports information about OpenType fonts, such as the features
-they support and the contents of their 'size' optical size features. See
-the manual page `otfinfo/otfinfo.1` for more information.
-
- Otftotfm creates TeX font metrics and encodings that correspond to
-a OpenType font. It will interpret glyph positionings, substitutions,
-and ligatures as far as it is able. You can say which OpenType
-features should be activated. See the manual page
-`otftotfm/otftotfm.1` for more information.
-
- T1dotlessj reads a Type 1 font, then creates a new Type 1 font whose
-only character is a dotless "j" matching the input font's design. See the
-manual page `t1dotlessj/t1dotlessj.1` for more information.
-
- T1lint checks Type 1 fonts for correctness. It tests most of the
-requirements listed in Adobe Systems' Black Book ("Adobe Type 1 Font
-Format"), and some others. See the manual page `t1lint/t1lint.1` for more
-information.
-
- T1reencode reencodes a Type 1 font, replacing its internal encoding with
-one you specify. See the manual page `t1reencode/t1reencode.1` for more
-information.
-
- Ttftotype42 creates a Type 42 wrapper for a TrueType or
-TrueType-flavored OpenType font. See the manual page
-`ttftotype42/ttftotype42.1` for more information.
-
- Finally, t1testpage creates a PostScript test page for a given font
-file. See the manual page `t1testpage/t1testpage.1` for more
-information.
-
- Please write me with problems, patches, and suggestions at the address
-below.
-
-
-REQUIREMENTS
-------------
- UNIX; gmake; C & C++ compilers. To build, just run ./configure, then
-gmake. See `INSTALL` in this directory for more detailed information about
-`./configure`.
-
- Some programs can link with additional libraries. Otftotfm can use the
-Kpathsea TeX-related path searching library; if your kpathsea library is in
-a nonstandard place, supply `./configure` with the `--with-kpathsea=PREFIX`
-option to find it.
-
- You can also disable individual programs by supplying `./configure` with
-`--disable-PROGNAME` options. See `./configure --help` for more
-information.
-
-
-MMAFM AND MMPFB
----------------
-
-Examples
-........
- % mmafm MyriadMM.amfm --weight=300 --width=585 > MyriadMM_300_585_.afm
- % mmpfb MyriadMM.pfb --weight=300 --width=585 > MyriadMM_300_585_.pfb
-
- Run `mmafm --help` and `mmpfb --help` for a full option summary.
-
-Running mmafm
-.............
- Mmafm expects the name of an AMFM file on the command line. It also
-needs to find an AFM file for each master (these should have been
-distributed with the AMFM file). You can give the AFM files' names on the
-command line, along with the AMFM file, or you let mmafm find the AFM files
-automatically. For the automatic method, you must follow one of these 2
-conventions:
-
- 1) The AFM files are in the same directory as the AMFM file. They are
-named `FONTNAME.afm` -- `MyriadMM-LightCn.afm`, for example.
-
- 2) There is a `PSres.upr` file that lists the AFMs by font name, and the
-`PSRESOURCEPATH` environment variable contains the directory with that
-`PSres.upr` file. (`ps2pk` comes with a sample `PSres.upr` file.)
-
-Intermediate masters
-....................
- Mmpfb can handle intermediate-master fonts transparently. If you use
-`PSres.upr` files, as described above, mmafm will also work transparently
-on intermediate-master fonts: it'll call mmpfb to get the information it
-needs. If you don't use `PSres.upr` files, you need to use mmpfb ahead of
-time to set up some auxiliary files. Say you want to use an intermediate
-master font `FONT`, and FONT's AMFM file is in the `DIR` directory. Here's
-what you need to do:
-
- % mmpfb FONT.pfb --amcp-info > DIR/FONT.amcp
-
- When you run mmafm on `DIR/FONT.amfm`, it will automatically look for
-`DIR/FONT.amcp`. An example using Adobe Jenson:
-
- % cd ~/Fonts/AJensonMM
- % mmpfb AJensonMM.pfb --amcp-info > AJensonMM.amcp
-
- Most multiple master fonts don't have intermediate masters, so you won't
-usually need to make `.amcp` files. Mmafm will tell you if it is necessary
-for a particular font.
-
-
-COPYRIGHT/LICENSE
------------------
- All source code is Copyright (c) 1997-2013 Eddie Kohler.
-
- This code is distributed under the GNU General Public License, Version 2
-(and only Version 2). The GNU General Public License is available via the
-Web at <http://www.gnu.org/licenses/gpl.html>, or in the COPYING file in
-this directory.
-
-
-AUTHOR
-------
- Eddie Kohler <ekohler@gmail.com>
- http://www.lcdf.org/
-
- The current version of the lcdf-typetools package is available on the
-Web at http://www.lcdf.org/type/
-
- LCDF stands for Little Cambridgeport Design Factory.
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/metrics.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/metrics.hh
deleted file mode 100644
index 21a5f1796fb..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/metrics.hh
+++ /dev/null
@@ -1,177 +0,0 @@
-// -*- related-file-name: "../../libefont/metrics.cc" -*-
-#ifndef EFONT_METRICS_HH
-#define EFONT_METRICS_HH
-#include <lcdf/permstr.hh>
-#include <lcdf/vector.hh>
-#include <lcdf/hashmap.hh>
-#include <efont/encoding.hh>
-#include <efont/pairop.hh>
-namespace Efont {
-class MetricsXt;
-
-class Metrics { public:
-
- Metrics();
- Metrics(PermString font_name, PermString full_name, const Metrics &);
- ~Metrics();
-
- void use() { _uses++; }
- void unuse() { if (--_uses == 0) delete this; }
-
- // GLOBALS
-
- PermString font_name() const { return _font_name; }
- PermString family() const { return _family; }
- PermString full_name() const { return _full_name; }
- PermString weight() const { return _weight; }
- PermString version() const { return _version; }
-
- void set_font_name(PermString);
- void set_family(PermString s) { _family = s; }
- void set_full_name(PermString s) { _full_name = s; }
- void set_weight(PermString s) { _weight = s; }
- void set_version(PermString s) { _version = s; }
-
- // GLYPHS
-
- int nglyphs() const { return _names.size(); }
- PermString name(GlyphIndex gi) const { return _names[gi]; }
- GlyphIndex find(PermString n) const { return _name_map[n]; }
-
- int code(GlyphIndex gi) const { return _encoding.code(gi); }
- GlyphIndex find_code(int c) const { return _encoding.find_code(c); }
- void set_code(GlyphIndex gi, int c) { _encoding.set_code(gi, c); }
-
- GlyphIndex add_glyph(PermString);
- void reserve_glyphs(int);
-
- // DIMENSIONS
-
- double scale() const { return _scale; }
- void set_scale(double d) { _scale = d; }
-
- int nfd() const { return _fdv.size(); }
- int nkv() const { return _kernv.size(); }
-
- double fd(int i) const { return _fdv[i]; }
- double wd(int i) const { return _wdv[i]; }
- double lf(int i) const { return _lfv[i]; }
- double rt(int i) const { return _rtv[i]; }
- double tp(int i) const { return _tpv[i]; }
- double bt(int i) const { return _btv[i]; }
- double kv(int i) const { return _kernv[i]; }
-
- double &fd(int i) { return _fdv[i]; }
- double &wd(int i) { return _wdv[i]; }
- double &lf(int i) { return _lfv[i]; }
- double &rt(int i) { return _rtv[i]; }
- double &tp(int i) { return _tpv[i]; }
- double &bt(int i) { return _btv[i]; }
- double &kv(int i) { return _kernv[i]; }
-
- inline int add_kv(double d);
-
- void interpolate_dimens(const Metrics &, double, bool increment);
-
- // PAIR PROGRAM
-
- PairProgram *pair_program() { return &_pairp; }
- const PairProgram *pair_program() const { return &_pairp; }
- inline bool add_kern(GlyphIndex, GlyphIndex, int);
- inline bool add_lig(GlyphIndex, GlyphIndex, GlyphIndex, int = opLigSimple);
-
- // EXTENSIONS
-
- MetricsXt *find_xt(PermString name) const { return _xt[_xt_map[name]]; }
- void add_xt(MetricsXt *);
-
- private:
-
- PermString _font_name;
-
- PermString _family;
- PermString _full_name;
- PermString _weight;
- PermString _version;
-
- HashMap<PermString, GlyphIndex> _name_map;
- Vector<PermString> _names;
- Encoding8 _encoding;
-
- double _scale;
-
- Vector<double> _fdv;
- Vector<double> _wdv;
- Vector<double> _lfv;
- Vector<double> _rtv;
- Vector<double> _tpv;
- Vector<double> _btv;
-
- PairProgram _pairp;
- Vector<double> _kernv;
-
- HashMap<PermString, int> _xt_map;
- Vector<MetricsXt *> _xt;
-
- unsigned _uses;
-
-};
-
-
-class MetricsXt {
-
- public:
-
- MetricsXt() { }
- virtual ~MetricsXt() { }
-
- virtual PermString kind() const = 0;
-
- virtual void reserve_glyphs(int) { }
-
-};
-
-
-enum FontDimensionDefs {
-
- fdCapHeight = 0,
- fdXHeight,
- fdAscender,
- fdDescender,
-
- fdItalicAngle,
- fdUnderlinePosition,
- fdUnderlineThickness,
-
- fdFontBBllx,
- fdFontBBlly,
- fdFontBBurx,
- fdFontBBury,
-
- fdStdHW,
- fdStdVW,
-
- fdLast
-
-};
-
-
-inline bool Metrics::add_kern(GlyphIndex g1, GlyphIndex g2, int ki)
-{
- return _pairp.add_kern(g1, g2, ki);
-}
-
-inline bool Metrics::add_lig(GlyphIndex g1, GlyphIndex g2, GlyphIndex gr, int kind)
-{
- return _pairp.add_lig(g1, g2, gr, kind);
-}
-
-inline int Metrics::add_kv(double d)
-{
- int k = _kernv.size();
- _kernv.push_back(d);
- return k;
-}
-
-}
-#endif
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1cs.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1cs.hh
deleted file mode 100644
index 04e17bd6c1d..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1cs.hh
+++ /dev/null
@@ -1,343 +0,0 @@
-// -*- related-file-name: "../../libefont/t1cs.cc" -*-
-#ifndef EFONT_T1CS_HH
-#define EFONT_T1CS_HH
-#include <lcdf/permstr.hh>
-#include <lcdf/string.hh>
-#include <lcdf/vector.hh>
-#include <lcdf/inttypes.h>
-namespace Efont {
-
-// Allow unknown doubles to have some `fuzz' -- so if an unknown double
-// is a bit off from the canonical UNKDOUBLE value, we'll still recognize
-// it as unknown. (Useful for interpolation.)
-#define UNKDOUBLE -9.79797e97
-#define MIN_KNOWN_DOUBLE -9.69696e97
-#define KNOWN(d) ((d) >= MIN_KNOWN_DOUBLE)
-
-class CharstringProgram;
-class CharstringInterp;
-struct CharstringContext;
-class MultipleMasterSpace;
-class Type1Encoding;
-
-class Charstring { public:
-
- Charstring() { }
- virtual ~Charstring();
-
- virtual bool process(CharstringInterp &) const = 0;
-
- enum Commands {
- cError = 0,
- cHstem = 1,
- cVstem = 3,
- cVmoveto = 4,
- cRlineto = 5,
- cHlineto = 6,
- cVlineto = 7,
- cRrcurveto = 8,
- cClosepath = 9,
- cCallsubr = 10,
- cReturn = 11,
- cEscape = 12,
- cHsbw = 13,
- cEndchar = 14,
- cBlend = 16,
- cHstemhm = 18,
- cHintmask = 19,
- cCntrmask = 20,
- cRmoveto = 21,
- cHmoveto = 22,
- cVstemhm = 23,
- cRcurveline = 24,
- cRlinecurve = 25,
- cVvcurveto = 26,
- cHhcurveto = 27,
- cShortint = 28,
- cCallgsubr = 29,
- cVhcurveto = 30,
- cHvcurveto = 31,
-
- cEscapeDelta = 32,
- cDotsection = 32 + 0,
- cVstem3 = 32 + 1,
- cHstem3 = 32 + 2,
- cAnd = 32 + 3,
- cOr = 32 + 4,
- cNot = 32 + 5,
- cSeac = 32 + 6,
- cSbw = 32 + 7,
- cStore = 32 + 8,
- cAbs = 32 + 9,
- cAdd = 32 + 10,
- cSub = 32 + 11,
- cDiv = 32 + 12,
- cLoad = 32 + 13,
- cNeg = 32 + 14,
- cEq = 32 + 15,
- cCallothersubr = 32 + 16,
- cPop = 32 + 17,
- cDrop = 32 + 18,
- cPut = 32 + 20,
- cGet = 32 + 21,
- cIfelse = 32 + 22,
- cRandom = 32 + 23,
- cMul = 32 + 24,
- cSqrt = 32 + 26,
- cDup = 32 + 27,
- cExch = 32 + 28,
- cIndex = 32 + 29,
- cRoll = 32 + 30,
- cSetcurrentpoint = 32 + 33,
- cHflex = 32 + 34,
- cFlex = 32 + 35,
- cHflex1 = 32 + 36,
- cFlex1 = 32 + 37,
-
- cLastCommand = cFlex1
- };
-
- enum OthersubrCommands {
- othcFlexend = 0,
- othcFlexbegin = 1,
- othcFlexmiddle = 2,
- othcReplacehints = 3,
- othcMM1 = 14,
- othcMM2 = 15,
- othcMM3 = 16,
- othcMM4 = 17,
- othcMM6 = 18,
- othcITC_load = 19,
- othcITC_add = 20,
- othcITC_sub = 21,
- othcITC_mul = 22,
- othcITC_div = 23,
- othcITC_put = 24,
- othcITC_get = 25,
- othcITC_unknown = 26,
- othcITC_ifelse = 27,
- othcITC_random = 28
- };
-
- static String command_name(int);
- static const char * const command_names[];
-
- static const char * const standard_encoding[256];
-
-};
-
-
-class Type1Charstring : public Charstring { public:
-
- Type1Charstring() { }
- inline Type1Charstring(const String &); // unencrypted
- Type1Charstring(int lenIV, const String &); // encrypted
- // default copy constructor
- // default destructor
- // default assignment operator
-
- inline const uint8_t *data() const;
- int length() const { return _s.length(); }
- operator String::unspecified_bool_type() const { return _s; }
-
- inline const String &data_string() const;
- inline String substring(int pos, int len) const;
- int first_caret_after(int pos) const;
-
- inline void assign(const String &);
- void prepend(const Type1Charstring &);
- void assign_substring(int pos, int len, const String &);
-
- bool process(CharstringInterp &) const;
-
- private:
-
- mutable String _s;
- mutable int _key;
-
- void decrypt() const;
-
-};
-
-
-class Type2Charstring : public Charstring { public:
-
- Type2Charstring() { }
- inline Type2Charstring(const String &);
- // default copy constructor
- // default destructor
- // default assignment operator
-
- inline const uint8_t *data() const;
- int length() const { return _s.length(); }
-
- bool process(CharstringInterp &) const;
-
- private:
-
- String _s;
-
-};
-
-
-struct CharstringContext {
-
- CharstringContext(const CharstringProgram *program_, const Charstring *cs_) : program(program_), cs(cs_) { }
-
- operator String::unspecified_bool_type() const {
- return cs != 0 ? &String::length : 0;
- }
-
- const CharstringProgram *program;
- const Charstring *cs;
-
-};
-
-
-class CharstringProgram { public:
-
- explicit CharstringProgram(unsigned units_per_em);
- virtual ~CharstringProgram() { }
-
- virtual PermString font_name() const { return PermString(); }
- virtual void font_matrix(double[6]) const;
- unsigned units_per_em() const { return _units_per_em; }
-
- inline const CharstringProgram *program(int) const;
- virtual const CharstringProgram *child_program(int) const;
- bool parent_program() const { return _parent_program; }
- void set_parent_program(bool pp) { _parent_program = pp; }
-
- virtual int nsubrs() const { return 0; }
- virtual Charstring *subr(int) const { return 0; }
- virtual int subr_bias() const { return 0; }
-
- virtual int ngsubrs() const { return 0; }
- virtual Charstring *gsubr(int) const { return 0; }
- virtual int gsubr_bias() const { return 0; }
-
- inline int nxsubrs(bool g) const;
- inline Charstring *xsubr(bool g, int) const;
- inline int xsubr_bias(bool g) const;
-
- virtual int nglyphs() const { return 0; }
- virtual PermString glyph_name(int) const { return PermString(); }
- virtual void glyph_names(Vector<PermString> &) const;
- virtual Charstring *glyph(int) const { return 0; }
- virtual Charstring *glyph(PermString) const { return 0; }
-
- inline CharstringContext glyph_context(int) const;
- inline CharstringContext glyph_context(PermString) const;
-
- virtual bool is_mm() const { return mmspace() != 0; }
- virtual MultipleMasterSpace *mmspace() const { return 0; }
- enum VectorType { VEC_WEIGHT = 0, VEC_NORM_DESIGN = 1, VEC_DESIGN = 2 };
- virtual Vector<double> *mm_vector(VectorType, bool writable) const;
-
- virtual Type1Encoding *type1_encoding() const { return 0; }
-
- virtual double global_width_x(bool is_nominal) const;
-
- private:
-
- bool _parent_program;
- uint16_t _units_per_em;
-
-};
-
-
-enum Type1Defs {
- t1Warmup_ee = 4,
- t1R_ee = 55665,
- t1R_cs = 4330,
- t1C1 = 52845,
- t1C2 = 22719
-};
-
-
-inline Type1Charstring::Type1Charstring(const String &s)
- : Charstring(), _s(s), _key(-1)
-{
-}
-
-inline void Type1Charstring::assign(const String &s)
-{
- _s = s;
- _key = -1;
-}
-
-inline const uint8_t *Type1Charstring::data() const
-{
- if (_key >= 0)
- decrypt();
- return reinterpret_cast<const uint8_t *>(_s.data());
-}
-
-inline const String &Type1Charstring::data_string() const
-{
- if (_key >= 0)
- decrypt();
- return _s;
-}
-
-inline String Type1Charstring::substring(int pos, int len) const
-{
- if (_key >= 0)
- decrypt();
- return _s.substring(pos, len);
-}
-
-inline bool operator==(const Type1Charstring &a, const Type1Charstring &b)
-{
- return a.data_string() == b.data_string();
-}
-
-
-inline Type2Charstring::Type2Charstring(const String &s)
- : _s(s)
-{
-}
-
-inline const uint8_t *Type2Charstring::data() const
-{
- return reinterpret_cast<const uint8_t *>(_s.data());
-}
-
-
-inline int CharstringProgram::nxsubrs(bool g) const
-{
- return (g ? ngsubrs() : nsubrs());
-}
-
-inline Charstring *CharstringProgram::xsubr(bool g, int i) const
-{
- return (g ? gsubr(i) : subr(i));
-}
-
-inline int CharstringProgram::xsubr_bias(bool g) const
-{
- return (g ? gsubr_bias() : subr_bias());
-}
-
-inline const CharstringProgram *CharstringProgram::program(int gi) const
-{
- return (_parent_program ? child_program(gi) : this);
-}
-
-inline CharstringContext CharstringProgram::glyph_context(int gi) const
-{
- if (!_parent_program)
- return CharstringContext(this, glyph(gi));
- else if (const CharstringProgram *p = child_program(gi))
- return CharstringContext(p, p->glyph(gi));
- else
- return CharstringContext(0, 0);
-}
-
-inline CharstringContext CharstringProgram::glyph_context(PermString gn) const
-{
- return CharstringContext(this, glyph(gn));
-}
-
-}
-#endif
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afm.cc
deleted file mode 100644
index 9705f91c97f..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afm.cc
+++ /dev/null
@@ -1,586 +0,0 @@
-// -*- related-file-name: "../include/efont/afm.hh" -*-
-
-/* afm.{cc,hh} -- Adobe Font Metrics files
- *
- * Copyright (c) 1998-2012 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/afm.hh>
-#include <efont/afmparse.hh>
-#include <efont/t1cs.hh> /* for UNKDOUBLE */
-#include <lcdf/error.hh>
-#include <ctype.h>
-#include <assert.h>
-namespace Efont {
-
-AfmReader::AfmReader(AfmParser &parser, Metrics *afm, AfmMetricsXt *afm_xt,
- ErrorHandler *errh)
- : _afm(afm), _afm_xt(afm_xt), _l(parser),
- _composite_warned(false), _metrics_sets_warned(false), _y_width_warned(0)
-{
- _errh = errh ? errh : ErrorHandler::silent_handler();
-}
-
-Metrics *
-AfmReader::read(Slurper &slurp, ErrorHandler *errh)
-{
- AfmParser p(slurp);
- if (!p.ok())
- return 0;
-
- Metrics *afm = new Metrics;
- AfmMetricsXt *afm_xt = new AfmMetricsXt;
- afm->add_xt(afm_xt);
- AfmReader reader(p, afm, afm_xt, errh);
-
- if (!reader.read()) {
- delete afm;
- return 0;
- } else
- return afm;
-}
-
-Metrics *
-AfmReader::read(const Filename &fn, ErrorHandler *errh)
-{
- Slurper slurpy(fn);
- return read(slurpy, errh);
-}
-
-
-void
-AfmReader::lwarning(const char *format, ...) const
-{
- va_list val;
- va_start(val, format);
- _errh->vxmessage(_l.landmark(), ErrorHandler::e_warning, format, val);
- va_end(val);
-}
-
-void
-AfmReader::lerror(const char *format, ...) const
-{
- va_list val;
- va_start(val, format);
- _errh->vxmessage(_l.landmark(), ErrorHandler::e_error, format, val);
- va_end(val);
-}
-
-GlyphIndex
-AfmReader::find_err(PermString name, const char *) const
-{
- GlyphIndex gi = _afm->find(name);
- if (gi < 0)
- lerror("character `%s' doesn't exist", name.c_str());
- return gi;
-}
-
-void
-AfmReader::composite_warning() const
-{
- if (!_composite_warned)
- lwarning("composite fonts not supported");
- _composite_warned = 1;
-}
-
-void
-AfmReader::metrics_sets_warning() const
-{
- if (!_metrics_sets_warned)
- lwarning("only metrics set 0 is supported");
- _metrics_sets_warned = 1;
-}
-
-void
-AfmReader::y_width_warning() const
-{
- if (_y_width_warned < 40) {
- lwarning("character has a nonzero Y width");
- _y_width_warned++;
- if (_y_width_warned == 40)
- lwarning("I won't warn you again.");
- }
-}
-
-void
-AfmReader::no_match_warning(const char *context) const
-{
- // keyword() will fail (and a warning won't get printed) only if the string
- // is all whitespace, which the spec allows
- PermString keyword = _l.keyword();
- if (!keyword) return;
- if (_l.key_matched()) {
- lwarning(context ? "bad `%s' command in %s:"
- : "bad `%s' command:", keyword.c_str(), context);
- lwarning("field %d %s", _l.fail_field(), _l.message().c_str());
- } else
- lwarning(context ? "unknown command `%s' in %s"
- : "unknown command `%s'", keyword.c_str(), context);
- _l.clear_message();
-}
-
-
-bool
-AfmReader::read()
-{
- AfmParser &l = _l;
- assert(_afm && _afm_xt);
-
- // First, read all opening comments into an array so we can print them out
- // later.
- PermString comment;
- while (l.next_line()) {
- if (l.isall("Comment %+s", &comment))
- _afm_xt->opening_comments.push_back(comment);
- else if (l.isall("StartFontMetrics %g", (double *)0))
- ;
- else {
- l.save_line();
- break;
- }
- }
-
- _afm->set_scale(1000);
- unsigned invalid_lines = 0;
- PermString s;
- bool isbasefont;
- int metrics_sets;
- int direction;
-
- while (l.next_line())
- switch (l.first()) {
-
- case 'A':
- if (l.isall("Ascender %g", &fd( fdAscender )))
- break;
- goto invalid;
-
- case 'C':
- if (l.isall("Characters %d", (int *)0))
- break;
- if (l.isall("CapHeight %g", &fd( fdCapHeight )))
- break;
- if (l.isall("CharacterSet %+s", (PermString *) 0))
- break;
- if (l.isall("CharWidth %g %g", (double *)0, (double *)0))
- break;
- if (l.isall("Comment %+s", (PermString *) 0))
- break;
- goto invalid;
-
- case 'D':
- if (l.isall("Descender %g", &fd( fdDescender )))
- break;
- goto invalid;
-
- case 'E':
- if (l.isall("EncodingScheme %+s", &_afm_xt->encoding_scheme))
- break;
- if (l.isall("EndDirection"))
- break;
- if (l.isall("EndFontMetrics"))
- goto done;
- if (l.isall("EscChar %d", (int *)0)) {
- composite_warning();
- break;
- }
- goto invalid;
-
- case 'F':
- if (l.isall("FontName %+s", &s)) {
- _afm->set_font_name(s);
- break;
- }
- if (l.isall("FullName %+s", &s)) {
- _afm->set_full_name(s);
- break;
- }
- if (l.isall("FamilyName %+s", &s)) {
- _afm->set_family(s);
- break;
- }
- if (l.isall("FontBBox %g %g %g %g",
- &fd( fdFontBBllx ), &fd( fdFontBBlly ),
- &fd( fdFontBBurx ), &fd( fdFontBBury )))
- break;
- goto invalid;
-
- case 'I':
- if (l.isall("ItalicAngle %g", &fd( fdItalicAngle )))
- break;
- if (l.isall("IsBaseFont %b", &isbasefont)) {
- if (isbasefont == 0)
- composite_warning();
- break;
- }
- if (l.isall("IsFixedV %b", (bool *)0)) {
- metrics_sets_warning();
- break;
- }
- if (l.isall("IsFixedPitch %b", (bool *)0))
- break;
- goto invalid;
-
- case 'M':
- if (l.isall("MappingScheme %d", (int *)0)) {
- composite_warning();
- break;
- }
- if (l.isall("MetricsSets %d", &metrics_sets)) {
- if (metrics_sets != 0)
- metrics_sets_warning();
- break;
- }
- goto invalid;
-
- case 'N':
- if (l.isall("Notice %+s", &_afm_xt->notice))
- break;
- goto invalid;
-
- case 'S':
- if (l.isall("StartDirection %d", &direction)) {
- if (direction != 0)
- metrics_sets_warning();
- break;
- }
- if (l.isall("StartCharMetrics %d", (int *)0)) {
- read_char_metrics();
- break;
- }
- if (l.isall("StartKernData")) {
- read_kerns();
- break;
- }
- if (l.isall("StartComposites %d", (int *)0)) {
- read_composites();
- break;
- }
- if (l.isall("StdHW %g", &fd( fdStdHW )))
- break;
- if (l.isall("StdVW %g", &fd( fdStdVW )))
- break;
- if (l.isall("StartFontMetrics %g", (double *)0))
- break;
- goto invalid;
-
- case 'U':
- if (l.isall("UnderlinePosition %g", &fd( fdUnderlinePosition )))
- break;
- if (l.isall("UnderlineThickness %g", &fd( fdUnderlineThickness )))
- break;
- goto invalid;
-
- case 'V':
- if (l.isall("Version %+s", &s)) {
- _afm->set_version(s);
- break;
- }
- if (l.isall("VVector %g %g", (double *)0, (double *)0)) {
- metrics_sets_warning();
- break;
- }
- goto invalid;
-
- case 'W':
- if (l.isall("Weight %+s", &s)) {
- _afm->set_weight(s);
- break;
- }
- goto invalid;
-
- case 'X':
- if (l.isall("XHeight %g", &fd( fdXHeight )))
- break;
- goto invalid;
-
- default:
- invalid:
- invalid_lines++;
- no_match_warning();
-
- }
-
- done:
- if (invalid_lines >= l.lineno() - 10)
- return false;
- else
- return true;
-}
-
-
-static Vector<PermString> ligature_left;
-static Vector<PermString> ligature_right;
-static Vector<PermString> ligature_result;
-
-void
-AfmReader::read_char_metric_data() const
-{
- int c = -1;
- double wx = UNKDOUBLE;
- double bllx = UNKDOUBLE, blly = 0, burx = 0, bury = 0;
- PermString n;
- PermString ligright, ligresult;
-
- AfmParser &l = _l;
-
- l.is("C %d ; WX %g ; N %/s ; B %g %g %g %g ;",
- &c, &wx, &n, &bllx, &blly, &burx, &bury);
-
- while (l.left()) {
-
- switch (l.first()) {
-
- case 'B':
- if (l.is("B %g %g %g %g", &bllx, &blly, &burx, &bury))
- break;
- goto invalid;
-
- case 'C':
- if (l.is("C %d", &c))
- break;
- if (l.is("CH <%x>", &c))
- break;
- goto invalid;
-
- case 'E':
- if (l.isall("EndCharMetrics"))
- return;
- goto invalid;
-
- case 'L':
- if (l.is("L %/s %/s", &ligright, &ligresult)) {
- if (!n)
- lerror("ligature given, but character has no name");
- else {
- ligature_left.push_back(n);
- ligature_right.push_back(ligright);
- ligature_result.push_back(ligresult);
- }
- break;
- }
- goto invalid;
-
- case 'N':
- if (l.is("N %/s", &n))
- break;
- goto invalid;
-
- case 'W':
- if (l.is("WX %g", &wx) ||
- l.is("W0X %g", &wx))
- break;
- if (l.is("W %g %g", &wx, (double *)0) ||
- l.is("W0 %g %g", &wx, (double *)0) ||
- l.is("W0Y %g", (double *)0)) {
- y_width_warning();
- break;
- }
- if (l.is("W1X %g", (double *)0) ||
- l.is("W1Y %g", (double *)0) ||
- l.is("W1 %g %g", (double *)0, (double *)0)) {
- metrics_sets_warning();
- break;
- }
- goto invalid;
-
- default:
- invalid:
- // always warn about unknown directives here!
- no_match_warning("character metrics");
- l.skip_until(';');
- break;
-
- }
-
- l.is(";"); // get rid of any possible semicolon
- }
-
- // create the character
- if (!n)
- lwarning("character without a name ignored");
- else {
- if (_afm->find(n) != -1)
- lwarning("character %s defined twice", n.c_str());
-
- GlyphIndex gi = _afm->add_glyph(n);
-
- _afm->wd(gi) = wx;
- _afm->lf(gi) = bllx;
- _afm->rt(gi) = burx;
- _afm->tp(gi) = bury;
- _afm->bt(gi) = blly;
-
- if (c != -1)
- _afm->set_code(gi, c);
- }
-}
-
-
-void
-AfmReader::read_char_metrics() const
-{
- assert(!ligature_left.size());
-
- while (_l.next_line())
- // Grok the whole line. Are we on a character metric data line?
- switch (_l.first()) {
-
- case 'C':
- if (isspace(_l[1]) || (_l[1] == 'H' && isspace(_l[2]))) {
- read_char_metric_data();
- break;
- }
- if (_l.is("Comment"))
- break;
- goto invalid;
-
- case 'E':
- if (_l.isall("EndCharMetrics"))
- goto end_char_metrics;
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
-
- }
-
- end_char_metrics:
-
- for (int i = 0; i < ligature_left.size(); i++) {
- GlyphIndex leftgi = find_err(ligature_left[i], "ligature");
- GlyphIndex rightgi = find_err(ligature_right[i], "ligature");
- GlyphIndex resultgi = find_err(ligature_result[i], "ligature");
- if (leftgi >= 0 && rightgi >= 0 && resultgi >= 0)
- if (_afm->add_lig(leftgi, rightgi, resultgi))
- lwarning("duplicate ligature; first ignored");
- }
- ligature_left.clear();
- ligature_right.clear();
- ligature_result.clear();
-}
-
-
-void
-AfmReader::read_kerns() const
-{
- double kx;
- PermString left, right;
- GlyphIndex leftgi, rightgi;
-
- AfmParser &l = _l;
- // AFM files have reversed pair programs when read.
- _afm->pair_program()->set_reversed(true);
-
- while (l.next_line())
- switch (l.first()) {
-
- case 'C':
- if (l.is("Comment"))
- break;
- goto invalid;
-
- case 'E':
- if (l.isall("EndKernPairs"))
- break;
- if (l.isall("EndKernData"))
- return;
- if (l.isall("EndTrackKern"))
- break;
- goto invalid;
-
- case 'K':
- if (l.isall("KPX %/s %/s %g", &left, &right, &kx)) {
- goto validkern;
- }
- if (l.isall("KP %/s %/s %g %g", &left, &right, &kx, (double *)0)) {
- y_width_warning();
- goto validkern;
- }
- if (l.isall("KPY %/s %/s %g", &left, &right, (double *)0)) {
- y_width_warning();
- break;
- }
- if (l.isall("KPH <%x> <%x> %g %g", (int *)0, (int *)0,
- (double *)0, (double *)0)) {
- lwarning("KPH not supported");
- break;
- }
- goto invalid;
-
- validkern:
- leftgi = find_err(left, "kern");
- rightgi = find_err(right, "kern");
- if (leftgi >= 0 && rightgi >= 0)
- // A kern with 0 amount is NOT useless!
- // (Because of multiple masters.)
- if (_afm->add_kern(leftgi, rightgi, _afm->add_kv(kx)))
- lwarning("duplicate kern; first pair ignored");
- break;
-
- case 'S':
- if (l.isall("StartKernPairs %d", (int *)0) ||
- l.isall("StartKernPairs0 %d", (int *)0))
- break;
- if (l.isall("StartKernPairs1 %d", (int *)0)) {
- metrics_sets_warning();
- break;
- }
- if (l.isall("StartTrackKern %d", (int *)0))
- break;
- goto invalid;
-
- case 'T':
- if (l.isall("TrackKern %g %g %g %g %g", (double *)0, (double *)0,
- (double *)0, (double *)0, (double *)0))
- break; // FIXME: implement TrackKern
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
- break;
-
- }
-}
-
-
-void
-AfmReader::read_composites() const
-{
- while (_l.next_line())
- switch (_l.first()) {
-
- case 'C':
- if (_l.is("Comment"))
- break;
- if (_l.is("CC"))
- break;
- goto invalid;
-
- case 'E':
- if (_l.isall("EndComposites"))
- return;
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
- break;
-
- }
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmparse.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmparse.cc
deleted file mode 100644
index 313b63ec362..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmparse.cc
+++ /dev/null
@@ -1,365 +0,0 @@
-// -*- related-file-name: "../include/efont/afmparse.hh" -*-
-
-/* afmparse.{cc,hh} -- Adobe Font Metrics parsing
- *
- * Copyright (c) 1998-2012 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/afmparse.hh>
-#include <efont/t1cs.hh>
-#include <efont/metrics.hh>
-#include <lcdf/strtonum.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <stdlib.h>
-#if HAVE_BROKEN_STRTOD
-# define strtod good_strtod
-#endif
-namespace Efont {
-
-static bool name_enders[256];
-static char xvalue[256];
-
-
-AfmParser::AfmParser(Slurper &slurp)
- : _slurper(slurp),
- _line(0), _pos(0), _length(0)
-{
- static_initialize();
-}
-
-
-void
-AfmParser::trim_end()
-{
- int l = _length - 1;
- while (l >= 0 && isspace(_line[l])) {
- _line[l] = 0;
- l--;
- }
- _length = l + 1;
-}
-
-
-void
-AfmParser::static_initialize()
-{
- if (name_enders[(uint8_t)'('])
- return;
- name_enders[(uint8_t)' '] = name_enders[(uint8_t)'\t']
- = name_enders[(uint8_t)'\r'] = name_enders[(uint8_t)'\f']
- = name_enders[(uint8_t)'\v'] = name_enders[(uint8_t)'\n']
- = name_enders[(uint8_t)'\0'] = name_enders[(uint8_t)'[']
- = name_enders[(uint8_t)']'] = name_enders[(uint8_t)'/']
- = name_enders[(uint8_t)'('] = name_enders[(uint8_t)')']
- = name_enders[(uint8_t)';'] = true;
-
- xvalue[(uint8_t)'0'] = 0;
- xvalue[(uint8_t)'1'] = 1;
- xvalue[(uint8_t)'2'] = 2;
- xvalue[(uint8_t)'3'] = 3;
- xvalue[(uint8_t)'4'] = 4;
- xvalue[(uint8_t)'5'] = 5;
- xvalue[(uint8_t)'6'] = 6;
- xvalue[(uint8_t)'7'] = 7;
- xvalue[(uint8_t)'8'] = 8;
- xvalue[(uint8_t)'9'] = 9;
- xvalue[(uint8_t)'a'] = 10;
- xvalue[(uint8_t)'b'] = 11;
- xvalue[(uint8_t)'c'] = 12;
- xvalue[(uint8_t)'d'] = 13;
- xvalue[(uint8_t)'e'] = 14;
- xvalue[(uint8_t)'f'] = 15;
- xvalue[(uint8_t)'A'] = 10;
- xvalue[(uint8_t)'B'] = 11;
- xvalue[(uint8_t)'C'] = 12;
- xvalue[(uint8_t)'D'] = 13;
- xvalue[(uint8_t)'E'] = 14;
- xvalue[(uint8_t)'F'] = 15;
-}
-
-
-// isall == is total == is all of the string
-
-// %s whitespace-terminated PermString - non-zero-length
-// %/s name-terminated PermString - non-zero-length
-// %+s rest of line PermString
-// %= rest of line/until next `=' PermString; beginning & ending spaces
-// elided
-// %d integer
-// %g number
-// %x hex integer
-// %b boolean
-// %c character
-// %< hex string; argument is String *stored
-// %. any non-alphanumeric
-// ???????????? EOS vs. don't-skip-to-EOS ???????????
-
-
-#define FAIL(s) do { _message = s; return 0; } while (0)
-
-unsigned char *
-AfmParser::vis(const char *formatsigned, va_list valist)
-{
- const unsigned char *format = (const unsigned char *)formatsigned;
- unsigned char *str = _pos;
-
- // Oftentimes, we'll get a keyword first. So handle that simple case
- // with a tight loop for (possibly) better performance and slightly different
- // semantics. (A keyword that comes first in the format must be followed
- // by a nonalphanumeric in the input to match.)
- if (isalpha(*format)) {
- bool ok = true;
- for (; *format && *format != ' ' && ok; format++, str++) {
- assert(isalnum(*format));
- if (*format != *str) ok = false;
- }
- if (!ok || isalnum(*str)) {
- if (_message) return 0;
- _fail_field = -1;
- FAIL("keyword mismatch");
- }
- }
-
- int fplus, fslash;
- _fail_field = 0;
- _message = PermString();
-
- while (1) {
-
- switch (*format) {
-
- /* - - - - - - - - percent specifications - - - - - - - */
- case '%':
- fplus = fslash = 0;
- _fail_field++;
-
- percentspec:
- switch (*++format) {
-
- // FLAGS
- case '+':
- fplus++;
- goto percentspec;
- case '/':
- fslash++;
- goto percentspec;
-
- case '%':
- goto matchchar;
-
- case 'b':
- case 's': {
- int len;
-
- if (fplus)
- len = strlen((char *)str);
- else if (fslash) {
- for (len = 0; !name_enders[ str[len] ]; len++)
- ;
- if (len == 0)
- FAIL("should be a string");
- } else {
- for (len = 0; !isspace(str[len]) && str[len]; len++)
- ;
- if (len == 0)
- FAIL("should be a string");
- }
-
- PermString s = PermString((char *)str, len);
- str += len;
-
- // Now we have the string. What to do with it? Depends on format.
- if (*format == 'b') {
-
- bool *bstore = va_arg(valist, bool *);
- if (s == "true") {
- if (bstore) *bstore = 1;
- } else if (s == "false") {
- if (bstore) *bstore = 0;
- } else
- FAIL("should be `true' or `false'");
-
- } else {
- PermString *sstore = va_arg(valist, PermString *);
- if (sstore) *sstore = s;
- }
- break;
- }
-
- case '(': {
- if (*str++ != '(') FAIL("should be a parenthesized string");
- unsigned char *last = str;
- int paren_level = 0;
- while (*last && paren_level >= 0) {
- if (*last == '(') paren_level++;
- if (*last == ')') paren_level--;
- last++;
- }
- if (paren_level >= 0) FAIL("had unbalanced parentheses");
-
- PermString *sstore = va_arg(valist, PermString *);
- if (sstore) *sstore = PermString((char *)str, last - str - 1);
- str = last;
- break;
- }
-
- case 'd':
- case 'i': {
- union { unsigned char *uc; char *c; } new_str;
- int v = strtol((char *)str, &new_str.c, 10);
- if (new_str.uc == str) FAIL("should be an integer");
-
- str = new_str.uc;
- int *istore = va_arg(valist, int *);
- if (istore) *istore = v;
- break;
- }
-
- case 'x': {
- union { unsigned char *uc; char *c; } new_str;
- int v = strtol((char *)str, &new_str.c, 16);
- if (new_str.uc == str) FAIL("should be a hex integer");
-
- str = new_str.uc;
- int *istore = va_arg(valist, int *);
- if (istore) *istore = v;
- break;
- }
-
- case 'e':
- case 'f':
- case 'g': {
- union { unsigned char *uc; char *c; } new_str;
- double v = strtonumber((char *)str, &new_str.c);
- if (v < MIN_KNOWN_DOUBLE) v = MIN_KNOWN_DOUBLE;
- if (new_str.uc == str) FAIL("should be a real number");
-
- str = new_str.uc;
- double *dstore = va_arg(valist, double *);
- if (dstore) *dstore = v;
- break;
- }
-
- case '<': {
- unsigned char *endbrack =
- (unsigned char *)strchr((char *)str, '>');
- int n = (endbrack ? endbrack - (str + 1) : 0);
- if (!endbrack || n % 2 != 0)
- FAIL("should be hex values in <angle brackets>");
- String s = String::make_uninitialized(n/2);
- unsigned char *data = s.mutable_udata();
-
- str++;
- while (*str != '>') {
- if (isxdigit(str[0]) && isxdigit(str[1])) {
- *data++ = xvalue[str[0]] * 16 + xvalue[str[1]];
- str += 2;
- } else
- FAIL("had non-hex digits in the angle brackets");
- }
- str++;
-
- if (String *datastore = va_arg(valist, String *))
- *datastore = s;
- break;
- }
-
- default:
- assert(0 /* internal error: bad % */);
- FAIL("");
-
- }
- break;
- /* - - - - - - - - end percent specifications - - - - - - - */
-
- case ' ':
- if (!isspace(*str))
- FAIL("should be followed by whitespace");
- /* FALLTHRU */
-
- case '-':
- while (isspace(*str)) str++;
- break;
-
- case 0:
- // always eat space at end of format
- while (isspace(*str)) str++;
- return str;
-
- default:
- matchchar:
- if (*str++ != *format)
- FAIL(permprintf("- expected `%c'", *format));
- break;
-
- }
-
- format++;
- }
-}
-
-
-bool
-AfmParser::isall(const char *format, ...)
-{
- va_list valist;
- va_start(valist, format);
- unsigned char *new_pos = vis(format, valist);
- va_end(valist);
- if (new_pos && *new_pos == 0) {
- _pos = new_pos;
- return 1;
- } else
- return 0;
-}
-
-
-bool
-AfmParser::is(const char *format, ...)
-{
- va_list valist;
- va_start(valist, format);
- unsigned char *new_pos = vis(format, valist);
- va_end(valist);
- if (new_pos) {
- _pos = new_pos;
- return 1;
- } else
- return 0;
-}
-
-
-PermString
-AfmParser::keyword() const
-{
- const char *f = (const char *)_pos;
- while (isspace((unsigned char) *f))
- f++;
- const char *l = f;
- while (isalnum((unsigned char) *l) || *l == '_')
- l++;
- return PermString(f, l - f);
-}
-
-
-void
-AfmParser::skip_until(unsigned char c)
-{
- while (*_pos && *_pos != c)
- _pos++;
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/amfm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/amfm.cc
deleted file mode 100644
index b38532d55fb..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/amfm.cc
+++ /dev/null
@@ -1,850 +0,0 @@
-// -*- related-file-name: "../include/efont/amfm.hh" -*-
-
-/* amfm.{cc,hh} -- Adobe Multiple-Master Font Metrics
- *
- * Copyright (c) 1998-2012 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/amfm.hh>
-#include <efont/afm.hh>
-#include <efont/afmparse.hh>
-#include <lcdf/error.hh>
-#include <efont/findmet.hh>
-#include <efont/t1cs.hh>
-#include <lcdf/straccum.hh>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <string.h>
-namespace Efont {
-
-AmfmMetrics::AmfmMetrics(MetricsFinder *finder)
- : _finder(finder),
- _fdv(fdLast, UNKDOUBLE),
- _nmasters(-1), _naxes(-1), _masters(0), _mmspace(0),
- _primary_fonts(0), _sanity_afm(0), _uses(0)
-{
-}
-
-AmfmMetrics::~AmfmMetrics()
-{
- assert(_uses == 0);
- for (int m = 0; m < _nmasters; m++)
- if (_masters[m].afm)
- _masters[m].afm->unuse();
- delete[] _masters;
- delete _mmspace;
- while (_primary_fonts) {
- AmfmPrimaryFont *pf = _primary_fonts;
- _primary_fonts = _primary_fonts->next;
- delete pf;
- }
-}
-
-
-bool
-AmfmMetrics::sanity(ErrorHandler *errh) const
-{
- if (!_mmspace) {
- errh->error("AMFM sanity: no multiple master interpolation information");
- return false;
- }
-
- bool ok = true;
- for (int m = 0; m < _nmasters; m++)
- if (!_masters[m].font_name
- || _masters[m].weight_vector.size() != _nmasters) {
- errh->error("AMFM sanity: no information for master %d", m);
- ok = false;
- }
-
- if (!_mmspace->check(errh))
- ok = false;
-
- return ok;
-}
-
-
-int
-AmfmMetrics::primary_label_value(int ax, PermString label) const
-{
- assert(ax >= 0 && ax < _naxes);
- for (AmfmPrimaryFont *pf = _primary_fonts; pf; pf = pf->next) {
- if (pf->labels[ax] == label)
- return pf->design_vector[ax];
- }
- return -1;
-}
-
-
-inline static bool
-strcompat(PermString a, PermString b)
-{
- return !a || !b || a == b;
-}
-
-Metrics *
-AmfmMetrics::master(int m, ErrorHandler *errh)
-{
- AmfmMaster &master = _masters[m];
-
- if (!master.loaded) {
- master.loaded = true;
- DirectoryMetricsFinder directory_finder(_directory);
- _finder->add_finder(&directory_finder);
- Metrics *afm = _finder->find_metrics(master.font_name);
-
- if (!afm) {
- if (errh)
- errh->error("%s: can't find AFM file for master `%s'",
- _font_name.c_str(), master.font_name.c_str());
-
- } else if (!strcompat(afm->font_name(), master.font_name)
- || !strcompat(afm->family(), master.family)
- || !strcompat(afm->full_name(), master.full_name)
- || !strcompat(afm->version(), master.version)) {
- if (errh)
- errh->error("%s: AFM for master `%s' doesn't match AMFM",
- _font_name.c_str(), master.font_name.c_str());
-
- } else if (!_sanity_afm) {
- master.afm = afm;
- _sanity_afm = afm;
- afm->use();
-
- } else {
- PairProgram *sanity_pairp = _sanity_afm->pair_program();
- PairProgram *pairp = afm->pair_program();
- char buf[1024];
- buf[0] = 0;
-
- if (afm->nglyphs() != _sanity_afm->nglyphs())
- sprintf(buf, "glyph count (%d vs. %d)", afm->nglyphs(), _sanity_afm->nglyphs());
- if (afm->nfd() != _sanity_afm->nfd())
- sprintf(buf, "fd count (%d vs. %d)", afm->nfd(), _sanity_afm->nfd());
- if (afm->nkv() != _sanity_afm->nkv())
- sprintf(buf, "kv count (%d vs. %d)", afm->nkv(), _sanity_afm->nkv());
- if (pairp->op_count() != sanity_pairp->op_count())
- sprintf(buf, "pair op count (%d vs. %d)", pairp->op_count(), sanity_pairp->op_count());
-
- if (!buf[0]) {
- master.afm = afm;
- afm->use();
- } else if (errh)
- errh->error("%s: AFM for master `%s' failed sanity checks (%s)", _font_name.c_str(), master.font_name.c_str(), buf);
- }
- }
-
- return master.afm;
-}
-
-
-AmfmPrimaryFont *
-AmfmMetrics::find_primary_font(const Vector<double> &design_vector) const
-{
- assert(design_vector.size() == _naxes);
- for (AmfmPrimaryFont *pf = _primary_fonts; pf; pf = pf->next) {
-
- for (int a = 0; a < _naxes; a++)
- if ((int)design_vector[a] != pf->design_vector[a])
- goto loser;
- return pf;
-
- loser: ;
- }
- return 0;
-}
-
-
-Metrics *
-AmfmMetrics::interpolate(const Vector<double> &design_vector,
- const Vector<double> &weight_vector,
- ErrorHandler *errh)
-{
- assert(design_vector.size() == _naxes);
- assert(weight_vector.size() == _nmasters);
-
- // FIXME: check masters for correspondence.
-
- /* 0.
- * Make sure all necessary AFMs have been loaded. */
- int m;
- for (m = 0; m < _nmasters; m++)
- if (weight_vector[m])
- if (!master(m, errh))
- return 0;
-
- /* 1.
- * Use the design vector to generate new FontName and FullName. */
-
- AmfmPrimaryFont *pf = find_primary_font(design_vector);
- // The primary font is useless to us if it doesn't have axis labels.
- if (pf && !pf->labels.size())
- pf = 0;
-
- StringAccum font_name_sa, full_name_sa;
- font_name_sa << _font_name;
- full_name_sa << _full_name;
- for (int a = 0; a < _naxes; a++) {
- double dv = design_vector[a];
- font_name_sa << '_' << dv;
- full_name_sa << (a == 0 ? '_' : ' ') << dv;
-
- PermString label;
- if (pf)
- label = pf->labels[a];
- if (!label)
- label = _mmspace->axis_abbreviation(a);
- if (label)
- full_name_sa << ' ' << label;
- }
- // Multiple master fonts require an underscore AFTER the font name too
- font_name_sa << '_';
-
- /* 2.
- * Set up the new AFM with the special constructor. */
-
- // Find the first master with a non-zero component.
- for (m = 0; m < _nmasters && weight_vector[m] == 0; m++)
- ;
- Metrics *afm = new Metrics(font_name_sa.c_str(), full_name_sa.c_str(), *_masters[m].afm);
- if (MetricsXt *xt = _masters[m].afm->find_xt("AFM")) {
- AfmMetricsXt *new_xt = new AfmMetricsXt((AfmMetricsXt &)*xt);
- afm->add_xt(new_xt);
- }
-
- /* 2.
- * Interpolate the old AFM data into the new. */
-
- afm->interpolate_dimens(*_masters[m].afm, weight_vector[m], false);
-
- for (m++; m < _nmasters; m++)
- if (weight_vector[m])
- afm->interpolate_dimens(*_masters[m].afm, weight_vector[m], true);
-
- return afm;
-}
-
-
-/*****
- * AmfmReader
- **/
-
-AmfmReader::AmfmReader(AfmParser &afmp, AmfmMetrics *amfm, ErrorHandler *errh)
- : _amfm(amfm), _finder(amfm->_finder), _l(afmp),
- _mmspace(amfm->_mmspace)
-{
- _errh = errh ? errh : ErrorHandler::silent_handler();
-}
-
-AmfmMetrics *
-AmfmReader::read(Slurper &slurper, MetricsFinder *finder, ErrorHandler *errh)
-{
- AfmParser parser(slurper);
- if (!parser.ok()) return 0;
- AmfmMetrics *amfm = new AmfmMetrics(finder);
- AmfmReader reader(parser, amfm, errh);
- if (!reader.read()) {
- delete amfm;
- return 0;
- } else
- return amfm;
-}
-
-AmfmMetrics *
-AmfmReader::read(const Filename &fn, MetricsFinder *finder, ErrorHandler *errh)
-{
- Slurper slurper(fn);
- return read(slurper, finder, errh);
-}
-
-void
-AmfmReader::add_amcp_file(Slurper &slurper, AmfmMetrics *amfm, ErrorHandler *errh)
-{
- AfmParser parser(slurper);
- if (!parser.ok()) return;
- AmfmReader reader(parser, amfm, errh);
- reader.read_amcp_file();
-}
-
-
-void
-AmfmReader::lwarning(const char *format, ...) const
-{
- va_list val;
- va_start(val, format);
- _errh->vxmessage(_l.landmark(), ErrorHandler::e_warning, format, val);
- va_end(val);
-}
-
-void
-AmfmReader::lerror(const char *format, ...) const
-{
- va_list val;
- va_start(val, format);
- _errh->vxmessage(_l.landmark(), ErrorHandler::e_error, format, val);
- va_end(val);
-}
-
-void
-AmfmReader::no_match_warning(const char *context) const
-{
- // keyword() will fail (and a warning won't get printed) only if the string
- // is all whitespace, which the spec allows
- PermString keyword = _l.keyword();
- if (!keyword) return;
- if (_l.key_matched()) {
- lwarning(context ? "bad `%s' command in %s:"
- : "bad `%s' command:", keyword.c_str(), context);
- lwarning("field %d %s", _l.fail_field(), _l.message().c_str());
- } else
- lwarning(context ? "unknown command `%s' in %s"
- : "unknown command `%s'", keyword.c_str(), context);
- _l.clear_message();
-}
-
-
-void
-AmfmReader::check_mmspace()
-{
- if (!_mmspace && _amfm->_naxes >= 0 && _amfm->_nmasters >= 0
- && _amfm->_font_name) {
- _mmspace = _amfm->_mmspace =
- new MultipleMasterSpace(_amfm->_font_name, _amfm->_naxes, _amfm->_nmasters);
- }
-}
-
-
-bool
-AmfmReader::read()
-{
- assert(_amfm != 0);
- _mmspace = _amfm->_mmspace;
-
- AfmParser &l = _l;
- _amfm->_directory = l.filename().directory();
-
- // First, read all opening comments into an array so we can print them out
- // later.
- PermString comment;
- while (l.next_line()) {
- if (l.isall("Comment %+s", &comment))
- _amfm->_opening_comments.push_back(comment);
- else if (l.isall("StartMasterFontMetrics %g", (double *)0))
- ;
- else {
- l.save_line();
- break;
- }
- }
-
- int master = 0, axis = 0;
-
- while (l.next_line())
- switch (l[0]) {
-
- case 'A':
- if (l.isall("Ascender %g", &fd( fdAscender )))
- break;
- if (l.isall("Axes %d", &_amfm->_naxes)) {
- check_mmspace();
- break;
- }
- goto invalid;
-
- case 'B':
- if (l.is("BlendDesignPositions")) {
- read_positions();
- break;
- }
- if (l.is("BlendDesignMap")) {
- read_normalize();
- break;
- }
- if (l.is("BlendAxisTypes")) {
- read_axis_types();
- break;
- }
- goto invalid;
-
- case 'C':
- if (l.isall("CapHeight %g", &fd( fdCapHeight )))
- break;
- if (l.is("Comment"))
- break;
- goto invalid;
-
- case 'D':
- if (l.isall("Descender %g", &fd( fdDescender )))
- break;
- goto invalid;
-
- case 'E':
- if (l.isall("EncodingScheme %+s", &_amfm->_encoding_scheme))
- break;
- if (l.isall("EndMasterFontMetrics"))
- goto done;
- goto invalid;
-
- case 'F':
- if (l.isall("FontName %+s", &_amfm->_font_name)) {
- check_mmspace();
- break;
- }
- if (l.isall("FullName %+s", &_amfm->_full_name))
- break;
- if (l.isall("FamilyName %+s", &_amfm->_family))
- break;
- if (l.isall("FontBBox %g %g %g %g",
- &fd( fdFontBBllx ), &fd( fdFontBBlly ),
- &fd( fdFontBBurx ), &fd( fdFontBBury )))
- break;
- goto invalid;
-
- case 'I':
- if (l.isall("IsFixedPitch %b", (bool *)0))
- break;
- if (l.isall("ItalicAngle %g", &fd( fdItalicAngle )))
- break;
- goto invalid;
-
- case 'M':
- if (l.isall("Masters %d", &_amfm->_nmasters)) {
- check_mmspace();
- break;
- }
- goto invalid;
-
- case 'N':
- if (l.isall("Notice %+s", &_amfm->_notice))
- break;
- goto invalid;
-
- case 'S':
- if (l.isall("StartAxis")) {
- read_axis(axis++);
- break;
- }
- if (l.isall("StartMaster")) {
- read_master(master++);
- break;
- }
- if (l.isall("StartPrimaryFonts %d", (int *)0)) {
- read_primary_fonts();
- break;
- }
- if (l.isall("StartConversionPrograms %d %d", (int *)0, (int *)0)) {
- read_conversion_programs();
- break;
- }
- if (l.isall("StartMasterFontMetrics %g", (double *)0))
- break;
- goto invalid;
-
- case 'U':
- if (l.isall("UnderlinePosition %g", &fd( fdUnderlinePosition )))
- break;
- else if (l.isall("UnderlineThickness %g", &fd( fdUnderlineThickness )))
- break;
- goto invalid;
-
- case 'V':
- if (l.isall("Version %+s", &_amfm->_version))
- break;
- goto invalid;
-
- case 'W':
- if (l.isall("Weight %+s", &_amfm->_weight))
- break;
- if (l.is("WeightVector")) {
- Vector<double> wv;
- if (!read_simple_array(wv) || !_mmspace)
- lerror("bad WeightVector");
- else
- _mmspace->set_weight_vector(wv);
- break;
- }
- goto invalid;
-
- case 'X':
- if (l.isall("XHeight %g", &fd( fdXHeight )))
- break;
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
-
- }
-
- done:
- if (!_mmspace) {
- _errh->error("`%s' is not an AMFM file", String(_l.landmark().file()).c_str());
- return false;
- }
-
- LandmarkErrorHandler pin_errh(_errh, _l.landmark());
- if (!_amfm->sanity(&pin_errh)) {
- _errh->lerror(_l.landmark().whole_file(),
- "bad AMFM file (missing or inconsistent information)");
- return false;
- }
-
- if (!_mmspace->check_intermediate() && _l.filename().directory()) {
- String name = l.filename().base() + ".amcp";
- Slurper slurp(_l.filename().from_directory(name));
- add_amcp_file(slurp, _amfm, _errh);
- }
-
- return true;
-}
-
-
-void
-AmfmReader::read_amcp_file()
-{
- int lines_read = 0;
-
- while (_l.next_line()) {
- lines_read++;
- switch (_l[0]) {
-
- case 'C':
- if (_l.is("Comment"))
- break;
- goto invalid;
-
- case 'S':
- if (_l.isall("StartConversionPrograms %d %d", (int *)0, (int *)0)) {
- read_conversion_programs();
- break;
- }
- goto invalid;
-
- default:
- invalid:
- no_match_warning("AMCP file");
-
- }
- }
-
- if (_mmspace && !_mmspace->ndv() && !_mmspace->cdv() && lines_read)
- lwarning("no conversion programs in .amcp file");
-}
-
-
-bool
-AmfmReader::read_simple_array(Vector<double> &vec) const
-{
- if (!_l.is("[")) return false;
-
- vec.clear();
- double d;
- while (_l.is("%g", &d))
- vec.push_back(d);
-
- return _l.is("]");
-}
-
-
-void
-AmfmReader::read_positions() const
-{
- if (nmasters() < 2 || naxes() < 1) return;
- Vector<NumVector> positions;
- if (!_l.is("[") || !_mmspace) goto error;
-
- for (int i = 0; i < nmasters(); i++) {
- positions.push_back(NumVector());
- if (!read_simple_array(positions.back()))
- goto error;
- }
-
- if (!_l.is("]")) goto error;
- _mmspace->set_master_positions(positions);
- return;
-
- error:
- lerror("bad BlendDesignPositions");
-}
-
-
-void
-AmfmReader::read_normalize() const
-{
- if (naxes() < 1) return;
- Vector<NumVector> normalize_in, normalize_out;
- if (!_l.is("[") || !_mmspace) goto error;
-
- for (int a = 0; a < naxes(); a++) {
- if (!_l.is("[")) goto error;
- normalize_in.push_back(NumVector());
- normalize_out.push_back(NumVector());
- double v1, v2;
- while (_l.is("[-%g %g-]", &v1, &v2)) {
- normalize_in[a].push_back(v1);
- normalize_out[a].push_back(v2);
- }
- if (!_l.is("]")) goto error;
- }
-
- if (!_l.is("]")) goto error;
- _mmspace->set_normalize(normalize_in, normalize_out);
- return;
-
- error:
- lerror("bad BlendDesignPositions");
-}
-
-
-void
-AmfmReader::read_axis_types() const
-{
- PermString s;
- int ax = 0;
- Vector<PermString> types;
- if (naxes() < 1) return;
- if (!_l.is("[") || !_mmspace) goto error;
- _mmspace->check();
-
- while (_l.is("/%/s", &s))
- _mmspace->set_axis_type(ax++, s);
-
- if (!_l.is("]")) goto error;
- return;
-
- error:
- lerror("bad BlendAxisTypes");
-}
-
-
-void
-AmfmReader::read_axis(int ax) const
-{
- bool ok = _mmspace && ax < naxes();
- if (!ok)
- lerror("bad axis number %d", ax);
- else
- _mmspace->check();
-
- PermString s;
- while (_l.next_line())
- switch (_l[0]) {
-
- case 'A':
- if (_l.is("AxisType %+s", &s)) {
- if (ok)
- _mmspace->set_axis_type(ax, s);
- break;
- }
- if (_l.is("AxisLabel %+s", &s)) {
- if (ok)
- _mmspace->set_axis_label(ax, s);
- break;
- }
- goto invalid;
-
- case 'C':
- if (_l.is("Comment"))
- break;
- goto invalid;
-
- case 'E':
- if (_l.isall("EndAxis"))
- goto endaxis;
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
-
- }
-
- endaxis: ;
-}
-
-
-void
-AmfmReader::read_master(int m) const
-{
- AmfmMaster *amfmm;
- AmfmMaster dummy;
- if (m >= nmasters()) {
- lerror("too many masters");
- amfmm = &dummy;
- } else {
- if (!_amfm->_masters)
- _amfm->_masters = new AmfmMaster[ nmasters() ];
- amfmm = &_amfm->_masters[m];
- }
-
- while (_l.next_line())
- // Grok the whole line. Are we on a character metric data line?
- switch (_l[0]) {
-
- case 'C':
- if (_l.is("Comment"))
- break;
- goto invalid;
-
- case 'E':
- if (_l.isall("EndMaster"))
- goto endmaster;
- goto invalid;
-
- case 'F':
- if (_l.isall("FontName %+s", &amfmm->font_name))
- break;
- if (_l.isall("FullName %+s", &amfmm->full_name))
- break;
- if (_l.isall("FamilyName %+s", &amfmm->family))
- break;
- goto invalid;
-
- case 'V':
- if (_l.isall("Version %+s", &amfmm->version))
- break;
- goto invalid;
-
- case 'W':
- if (_l.is("WeightVector")) {
- if (!(read_simple_array(amfmm->weight_vector) &&
- amfmm->weight_vector.size() == nmasters())) {
- lerror("bad WeightVector");
- amfmm->weight_vector.clear();
- }
- break;
- }
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
-
- }
-
- endmaster: ;
-}
-
-
-void
-AmfmReader::read_one_primary_font() const
-{
- AmfmPrimaryFont *pf = new AmfmPrimaryFont;
- pf->design_vector.resize(naxes());
- pf->labels.resize(naxes());
-
- while (_l.left()) {
-
- if (_l.is("PC")) {
- for (int a = 0; a < naxes(); a++)
- if (!_l.is("%d", &pf->design_vector[a]))
- goto error;
- } else if (_l.is("PL")) {
- for (int a = 0; a < naxes(); a++)
- if (!_l.is("(-%/s-)", &pf->labels[a]))
- goto error;
- } else if (_l.is("PN %(", &pf->name))
- ;
- else
- no_match_warning("primary font");
-
- _l.is(";"); // get rid of any possible semicolon
- }
-
- pf->next = _amfm->_primary_fonts;
- _amfm->_primary_fonts = pf;
- return;
-
- error:
- delete pf;
-}
-
-
-void
-AmfmReader::read_primary_fonts() const
-{
- while (_l.next_line())
- switch (_l[0]) {
-
- case 'C':
- if (_l.is("Comment"))
- break;
- goto invalid;
-
- case 'E':
- if (_l.isall("EndPrimaryFonts"))
- goto end_primary_fonts;
- goto invalid;
-
- case 'P':
- if (_l[1] == 'C' && isspace(_l[2])) {
- read_one_primary_font();
- break;
- }
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
-
- }
-
- end_primary_fonts: ;
-}
-
-
-void
-AmfmReader::read_conversion_programs() const
-{
- String ndv, cdv, s;
-
- while (_l.next_line())
- switch (_l[0]) {
-
- case 'C':
- if (_l.isall("CDV %<", &s)) {
- cdv += s;
- break;
- }
- goto invalid;
-
- case 'E':
- if (_l.isall("EndConversionPrograms"))
- goto end_conversion_programs;
- goto invalid;
-
- case 'N':
- if (_l.isall("NDV %<", &s)) {
- ndv += s;
- break;
- }
- goto invalid;
-
- default:
- invalid:
- no_match_warning();
- break;
-
- }
-
- end_conversion_programs:
- if (_mmspace) {
- _mmspace->set_ndv(Type1Charstring(ndv));
- _mmspace->set_cdv(Type1Charstring(cdv));
- }
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otf.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otf.cc
deleted file mode 100644
index 6213e1fe3e0..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otf.cc
+++ /dev/null
@@ -1,1491 +0,0 @@
-// -*- related-file-name: "../include/efont/otf.hh" -*-
-
-/* otf.{cc,hh} -- OpenType font basics
- *
- * Copyright (c) 2002-2012 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/otf.hh>
-#include <lcdf/error.hh>
-#include <lcdf/straccum.hh>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <algorithm>
-#include <efont/otfdata.hh> // for ntohl()
-#include <efont/otfname.hh>
-#include <efont/ttfhead.hh>
-
-namespace Efont { namespace OpenType {
-
-Vector<PermString> debug_glyph_names;
-
-Font::Font(const String& s, ErrorHandler* errh)
- : _str(s), _units_per_em(0) {
- _str.align(4);
- _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
-}
-
-int
-Font::parse_header(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // Fixed sfnt version
- // USHORT numTables
- // USHORT searchRange
- // USHORT entrySelector
- // USHORT rangeShift
- int len = length();
- const uint8_t *data = this->data();
- if (HEADER_SIZE > len)
- return errh->error("OTF file corrupted (too small)"), -EFAULT;
- if ((data[0] != 'O' || data[1] != 'T' || data[2] != 'T' || data[3] != 'O')
- && (data[0] != '\000' || data[1] != '\001'))
- return errh->error("not an OpenType font (bad magic number)"), -ERANGE;
- int ntables = Data::u16_aligned(data + 4);
- if (ntables == 0)
- return errh->error("OTF contains no tables"), -EINVAL;
- if (HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * ntables > len)
- return errh->error("OTF table directory out of range"), -EFAULT;
-
- // TABLE DIRECTORY ENTRY FORMAT:
- // ULONG tag
- // ULONG checksum
- // ULONG offset
- // ULONG length
- uint32_t last_tag = 0U;
- for (int i = 0; i < ntables; i++) {
- int loc = HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
- uint32_t tag = Data::u32_aligned(data + loc);
- uint32_t offset = Data::u32_aligned(data + loc + 8);
- uint32_t length = Data::u32_aligned(data + loc + 12);
- if (tag <= last_tag)
- return errh->error("tags out of order"), -EINVAL;
- if (offset + length > (uint32_t) len)
- return errh->error("OTF data for %<%s%> out of range", Tag(tag).text().c_str()), -EFAULT;
- if (Tag::head_tag() == tag) {
- Head head(_str.substring(offset, length));
- _units_per_em = head.units_per_em();
- }
- last_tag = tag;
- }
-
- return 0;
-}
-
-bool
-Font::check_checksums(ErrorHandler *errh) const
-{
- if (error() < 0)
- return false;
- int nt = ntables();
- bool ok = true;
- for (int i = 0; i < nt; i++) {
- const uint8_t *entry = data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
- String tbl = _str.substring(Data::u32_aligned(entry + 8),
- Data::u32_aligned(entry + 12));
- uint32_t sum = checksum(tbl);
- if (Data::u32_aligned(entry) == 0x68656164 // 'head'
- && tbl.length() >= 12)
- sum -= Data::u32_aligned(tbl.udata() + 8);
- if (sum != Data::u32_aligned(entry + 4)) {
- if (errh)
- errh->error("table %<%s%> checksum error: %x vs. %x", Tag(Data::u32_aligned(entry)).text().c_str(), sum, Data::u32_aligned(entry + 4));
- ok = false;
- }
- }
- return ok;
-}
-
-int
-Font::ntables() const
-{
- if (error() < 0)
- return 0;
- else
- return Data::u16_aligned(data() + 4);
-}
-
-String
-Font::table(Tag tag) const
-{
- if (error() < 0)
- return String();
- const uint8_t *entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
- if (entry)
- return _str.substring(Data::u32_aligned(entry + 8), Data::u32_aligned(entry + 12));
- else
- return String();
-}
-
-bool
-Font::has_table(Tag tag) const
-{
- const uint8_t *entry = 0;
- if (error() >= 0)
- entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
- return entry != 0;
-}
-
-uint32_t
-Font::table_checksum(Tag tag) const
-{
- if (error() < 0)
- return 0;
- const uint8_t *entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
- if (entry)
- return Data::u32_aligned(entry + 4);
- else
- return 0;
-}
-
-Tag
-Font::table_tag(int i) const
-{
- if (error() < 0 || i < 0 || i >= ntables())
- return Tag();
- else
- return Tag(Data::u32_aligned(data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i));
-}
-
-uint32_t
-Font::checksum(const uint8_t *begin, const uint8_t *end)
-{
- uint32_t sum = 0;
- if (reinterpret_cast<uintptr_t>(begin) % 4)
- for (; begin + 3 < end; begin += 4)
- sum += Data::u32(begin);
- else
- for (; begin + 3 < end; begin += 4)
- sum += Data::u32_aligned(begin);
- uint32_t leftover = 0;
- for (int i = 0; i < 4; i++)
- leftover = (leftover << 8) + (begin < end ? *begin++ : 0);
- return sum + leftover;
-}
-
-uint32_t
-Font::checksum(const String &s)
-{
- return checksum(reinterpret_cast<const uint8_t *>(s.begin()), reinterpret_cast<const uint8_t *>(s.end()));
-}
-
-namespace {
-class TagCompar { public:
- TagCompar(const Vector<Tag> &tags) : _tags(tags) { }
- bool operator()(int a, int b) { return _tags[a] < _tags[b]; }
- const Vector<Tag> &_tags;
-};
-}
-
-Font
-Font::make(bool truetype, const Vector<Tag>& tags, const Vector<String>& data)
-{
- StringAccum sa;
-
- // create offset table
- {
- union {
- uint8_t c[HEADER_SIZE];
- uint16_t s[HEADER_SIZE / 2];
- uint32_t l[HEADER_SIZE / 4];
- } hdr;
- hdr.l[0] = (truetype ? htonl(0x00010000) : htonl(0x4F54544F));
- hdr.s[2] = htons(tags.size());
- int entrySelector;
- for (entrySelector = 0; (2 << entrySelector) <= tags.size(); entrySelector++)
- /* nada */;
- hdr.s[3] = htons((1 << entrySelector) * 16);
- hdr.s[4] = htons(entrySelector);
- hdr.s[5] = htons((tags.size() - (1 << entrySelector)) * 16);
- sa.append(&hdr.c[0], HEADER_SIZE);
- }
-
- // sort tags
- Vector<int> permut;
- for (int i = 0; i < tags.size(); i++)
- permut.push_back(i);
- std::sort(permut.begin(), permut.end(), TagCompar(tags));
-
- // table listing
- uint32_t offset = HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * tags.size();
- for (int *tp = permut.begin(); tp < permut.end(); tp++) {
- union {
- uint8_t c[TABLE_DIR_ENTRY_SIZE];
- uint32_t l[TABLE_DIR_ENTRY_SIZE / 4];
- } tdir;
- tdir.l[0] = htonl(tags[*tp].value());
-
- // discount current checksum adjustment in head table
- uint32_t sum = checksum(data[*tp]);
- if (tags[*tp] == Tag("head") && data[*tp].length() >= 12)
- sum -= Data::u32(data[*tp].udata() + 8);
- tdir.l[1] = htonl(sum);
-
- tdir.l[2] = htonl(offset);
- tdir.l[3] = htonl(data[*tp].length());
- sa.append(&tdir.c[0], TABLE_DIR_ENTRY_SIZE);
- offset += (data[*tp].length() + 3) & ~3;
- }
-
- // actual tables
- for (int *tp = permut.begin(); tp < permut.end(); tp++) {
- sa << data[*tp];
- while (sa.length() % 4)
- sa << '\0';
- }
-
- // fix 'head' table
- for (int i = 0; i < tags.size(); i++) {
- unsigned char *thdr = sa.udata() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
- if (Data::u32(thdr) == 0x68656164 && Data::u32(thdr + 12) >= 12) {
- uint32_t offset = Data::u32(thdr + 8);
- char *head = sa.data() + offset;
- memset(head + 8, '\0', 4);
- uint32_t allsum = checksum(reinterpret_cast<uint8_t *>(sa.data()), reinterpret_cast<uint8_t *>(sa.data() + sa.length()));
- uint32_t *adj = reinterpret_cast<uint32_t *>(head + 8);
- *adj = htonl(0xB1B0AFBA - allsum);
- }
- }
-
- return Font(sa.take_string());
-}
-
-
-/**************************
- * Tag *
- * *
- **************************/
-
-Tag::Tag(const char *s)
- : _tag(0)
-{
- if (!s)
- s = "";
- for (int i = 0; i < 4; i++)
- if (*s == 0)
- _tag = (_tag << 8) | 0x20;
- else if (*s < 32 || *s > 126) { // don't care if s is signed
- _tag = 0;
- return;
- } else
- _tag = (_tag << 8) | *s++;
- if (*s)
- _tag = 0;
-}
-
-Tag::Tag(const String &s)
- : _tag(0)
-{
- if (s.length() <= 4) {
- const char *ss = s.data();
- for (int i = 0; i < s.length(); i++, ss++)
- if (*ss < 32 || *ss > 126) {
- _tag = 0;
- return;
- } else
- _tag = (_tag << 8) | *ss;
- for (int i = s.length(); i < 4; i++)
- _tag = (_tag << 8) | 0x20;
- }
-}
-
-bool
-Tag::valid() const
-{
- uint32_t tag = _tag;
- for (int i = 0; i < 4; i++, tag >>= 8)
- if ((tag & 255) < 32 || (tag & 255) > 126)
- return false;
- return true;
-}
-
-String
-Tag::text() const
-{
- StringAccum sa;
- uint32_t tag = _tag;
- for (int i = 0; i < 4; i++, tag = (tag << 8) | 0x20)
- if (tag != 0x20202020) {
- uint8_t c = (tag >> 24) & 255;
- if (c < 32 || c > 126)
- sa.snprintf(6, "\\%03o", c);
- else
- sa << c;
- }
- return sa.take_string();
-}
-
-String
-Tag::langsys_text(Tag script, Tag langsys)
-{
- if (!langsys.null())
- return script.text() + "." + langsys.text();
- else
- return script.text();
-}
-
-const uint8_t *
-Tag::table_entry(const uint8_t *table, int n, int entry_size) const
-{
- assert(((uintptr_t)table & 1) == 0);
- int l = 0, r = n;
- while (l < r) {
- int m = l + (r - l) / 2;
- const uint8_t *entry = table + m * entry_size;
- uint32_t m_tag = Data::u32_aligned16(entry);
- if (_tag < m_tag)
- r = m;
- else if (_tag == m_tag)
- return entry;
- else
- l = m + 1;
- }
- return 0;
-}
-
-
-
-/**************************
- * ScriptList *
- * *
- **************************/
-
-int
-ScriptList::assign(const String &str, ErrorHandler *errh)
-{
- _str = str;
- _str.align(4);
- int result = check_header(errh ? errh : ErrorHandler::silent_handler());
- if (result < 0)
- _str = String();
- return result;
-}
-
-int
-ScriptList::check_header(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // USHORT scriptCount
- // 6bytes scriptRecord[]
- int scriptCount;
- if (_str.length() < SCRIPTLIST_HEADERSIZE
- || (scriptCount = Data::u16_aligned(_str.udata()),
- _str.length() < SCRIPTLIST_HEADERSIZE + scriptCount*SCRIPT_RECSIZE))
- return errh->error("OTF ScriptList too short");
-
- // XXX check that scripts are sorted
-
- return 0;
-}
-
-int
-ScriptList::script_offset(Tag script) const
-{
- if (_str.length() == 0)
- return -1;
- const uint8_t *data = _str.udata();
- if (const uint8_t *entry = script.table_entry(data + SCRIPTLIST_HEADERSIZE, Data::u16_aligned(data), SCRIPT_RECSIZE))
- return Data::u16_aligned(entry + 4);
- else
- return 0;
-}
-
-int
-ScriptList::check_script(Tag tag, int script_off, ErrorHandler *errh) const
-{
- const uint8_t *data = _str.udata();
- int langSysCount;
- if (_str.length() < script_off + SCRIPT_HEADERSIZE
- || (langSysCount = Data::u16_aligned(data + script_off + 2),
- (_str.length() < script_off + SCRIPT_HEADERSIZE + langSysCount*LANGSYS_RECSIZE)))
- return (errh ? errh->error("OTF Script table for %<%s%> out of range", tag.text().c_str()) : -1);
- // XXX check that langsys are sorted
- return 0;
-}
-
-int
-ScriptList::langsys_offset(Tag script, Tag langsys, ErrorHandler *errh) const
-{
- int script_off = script_offset(script);
- if (script_off == 0) {
- script = Tag("DFLT");
- script_off = script_offset(script);
- }
- if (script_off <= 0)
- return script_off;
-
- // check script bounds
- if (check_script(script, script_off, errh) < 0)
- return -1;
-
- // search script table
- const uint8_t *data = _str.udata();
- int langSysCount = Data::u16_aligned(data + script_off + 2);
- if (const uint8_t *entry = langsys.table_entry(data + script_off + SCRIPT_HEADERSIZE, langSysCount, LANGSYS_RECSIZE))
- return script_off + Data::u16_aligned(entry + 4);
-
- // return default
- int defaultLangSys = Data::u16_aligned(data + script_off);
- if (defaultLangSys != 0)
- return script_off + defaultLangSys;
- else
- return 0;
-}
-
-int
-ScriptList::language_systems(Vector<Tag> &script, Vector<Tag> &langsys, ErrorHandler *errh) const
-{
- script.clear();
- langsys.clear();
-
- const uint8_t *data = _str.udata();
- int nscripts = Data::u16_aligned(data);
- for (int i = 0; i < nscripts; i++) {
- Tag script_tag(Data::u32_aligned16(data + SCRIPTLIST_HEADERSIZE + i*SCRIPT_RECSIZE));
- int script_off = Data::u16_aligned(data + SCRIPTLIST_HEADERSIZE + i*SCRIPT_RECSIZE + 4);
- if (check_script(script_tag, script_off, errh) < 0)
- return -1;
- const uint8_t *script_table = data + script_off;
- if (Data::u16_aligned(script_table) != 0) // default LangSys
- script.push_back(script_tag), langsys.push_back(Tag());
- int nlangsys = Data::u16_aligned(script_table + 2);
- for (int j = 0; j < nlangsys; j++) {
- Tag langsys_tag(Data::u32_aligned16(script_table + SCRIPT_HEADERSIZE + j*LANGSYS_RECSIZE));
- script.push_back(script_tag), langsys.push_back(langsys_tag);
- }
- }
-
- return 0;
-}
-
-int
-ScriptList::features(Tag script, Tag langsys, int &required_fid, Vector<int> &fids, ErrorHandler *errh, bool clear_fids) const
-{
- required_fid = -1;
- if (clear_fids)
- fids.clear();
-
- int offset = langsys_offset(script, langsys);
- if (offset <= 0)
- return offset;
-
- // check langsys bounds
- const uint8_t *data = _str.udata();
- int featureCount;
- if (_str.length() < offset + LANGSYS_HEADERSIZE
- || (featureCount = Data::u16_aligned(data + offset + 4),
- (_str.length() < offset + LANGSYS_HEADERSIZE + featureCount*FEATURE_RECSIZE)))
- return (errh ? errh->error("OTF LangSys table for %<%s/%s%> out of range", script.text().c_str(), langsys.text().c_str()) : -1);
-
- // search langsys table
- int f = Data::u16_aligned(data + offset + 2);
- if (f != 0xFFFF)
- required_fid = f;
- data += offset + 6;
- for (int i = 0; i < featureCount; i++, data += FEATURE_RECSIZE)
- fids.push_back(Data::u16_aligned(data));
-
- return 0;
-}
-
-
-
-/**************************
- * FeatureList *
- * *
- **************************/
-
-int
-FeatureList::assign(const String &str, ErrorHandler *errh)
-{
- _str = str;
- _str.align(2);
- int result = check_header(errh ? errh : ErrorHandler::silent_handler());
- if (result < 0)
- _str = String();
- return result;
-}
-
-int
-FeatureList::check_header(ErrorHandler *errh)
-{
- int featureCount;
- if (_str.length() < FEATURELIST_HEADERSIZE
- || (featureCount = Data::u16_aligned(_str.udata()),
- _str.length() < FEATURELIST_HEADERSIZE + featureCount*FEATURE_RECSIZE))
- return errh->error("OTF FeatureList too short");
- return 0;
-}
-
-Tag
-FeatureList::tag(int fid) const
-{
- if (_str.length() == 0)
- return Tag();
- const uint8_t *data = _str.udata();
- int nfeatures = Data::u16_aligned(data);
- if (fid >= 0 && fid < nfeatures)
- return Tag(Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE));
- else
- return Tag();
-}
-
-String
-FeatureList::params(int fid, int length, ErrorHandler *errh, bool old_style_offset) const
-{
- if (_str.length() == 0 || length < 0)
- return String();
- if (errh == 0)
- errh = ErrorHandler::silent_handler();
-
- const uint8_t *data = _str.udata();
- int len = _str.length();
- int nfeatures = Data::u16_aligned(data);
- if (fid < 0 || fid >= nfeatures)
- return errh->error("OTF feature ID %<%d%> out of range", fid), String();
- int foff = Data::u16_aligned(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE + 4);
- if (len < foff + FEATURE_HEADERSIZE)
- return errh->error("OTF LookupList for feature ID %<%d%> too short", fid), String();
- int poff = Data::u16_aligned(data + foff);
- if (poff == 0)
- return String();
- if (!old_style_offset)
- poff += foff;
- if (len < poff + length)
- return errh->error("OTF feature parameters for feature ID %<%d%> out of range", fid), String();
- else
- return _str.substring(poff, length);
-}
-
-String
-FeatureList::size_params(int fid, const Name &name, ErrorHandler *errh) const
-{
- // implement 'size' checks from Read Roberts
- for (int i = 0; i < 2; i++) {
- String s = params(fid, 10, errh, i != 0);
- const uint8_t *data = s.udata();
- // errh->message("trying %d %d %d %d %d\n", Data::u16_aligned(data), Data::u16_aligned(data + 2), Data::u16_aligned(data + 4), Data::u16_aligned(data + 6), Data::u16_aligned(data + 8));
- if (Data::u16_aligned(data) == 0) // design size == 0
- continue;
- if (Data::u16_aligned(data + 2) == 0 // subfamily ID == 0
- && Data::u16_aligned(data + 6) == 0 // range start == 0
- && Data::u16_aligned(data + 8) == 0 // range end == 0
- && Data::u16_aligned(data + 4) == 0) // menu name ID == 0
- return s;
- if (Data::u16_aligned(data + 6) >= Data::u16_aligned(data + 8) // range start >= range end
- || Data::u16_aligned(data + 4) < 256 // menu name ID < 256
- || Data::u16_aligned(data + 4) > 32767 // menu name ID > 32767
- || !name.english_name(Data::u16_aligned(data + 4))) // menu name ID is a name ID defined by the font
- continue;
- if (Data::u16_aligned(data) + 1 >= Data::u16_aligned(data + 6) // design size >= range start (with 1 dp grace)
- && Data::u16_aligned(data) <= Data::u16_aligned(data + 8) + 1) // design size <= range end (with 1 dp grace)
- return s;
- else if (i == 1 // old-style feature
- && Data::u16_aligned(data + 8) <= 1440 // range end <= 144 point
- && Data::u16_aligned(data) <= 1440) { // design size <= 144 point
- // some old fonts define a bogus feature with design size
- // not in range (John Owens, Read Roberts)
- if (errh)
- errh->warning("invalid 'size' feature: design size not in range");
- return s;
- }
- }
- if (errh)
- errh->error("no valid 'size' feature data in the 'size' feature");
- return String();
-}
-
-int
-FeatureList::find(Tag tag, const Vector<int> &fids) const
-{
- if (fids.size() == 0 || _str.length() == 0)
- return -1;
-
- const uint8_t *data = _str.udata();
- int nfeatures = Data::u16_aligned(data);
- for (const int *fidp = fids.begin(); fidp != fids.end(); fidp++)
- if (*fidp >= 0 && *fidp < nfeatures) {
- uint32_t ftag = Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + (*fidp)*FEATURE_RECSIZE);
- if (ftag == tag.value())
- return *fidp;
- }
-
- return -1;
-}
-
-void
-FeatureList::filter(Vector<int> &fids, const Vector<Tag> &sorted_ftags) const
-{
- if (_str.length() == 0)
- fids.clear();
- else {
- std::sort(fids.begin(), fids.end()); // sort fids
-
- int i = 0, j = 0;
- while (i < fids.size() && fids[i] < 0)
- fids[i++] = 0x7FFFFFFF;
-
- // XXX check that feature list is in alphabetical order
-
- const uint8_t *data = _str.udata();
- int nfeatures = Data::u16_aligned(data);
- while (i < fids.size() && j < sorted_ftags.size() && fids[i] < nfeatures) {
- uint32_t ftag = Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + fids[i]*FEATURE_RECSIZE);
- if (ftag < sorted_ftags[j].value()) { // not an interesting feature
- // replace featureID with a large number, remove later
- fids[i] = 0x7FFFFFFF;
- i++;
- } else if (ftag == sorted_ftags[j].value()) // interesting feature
- i++;
- else // an interesting feature is not available
- j++;
- }
-
- fids.resize(i); // remove remaining uninteresting features
- std::sort(fids.begin(), fids.end()); // resort, to move bad ones last
- while (fids.size() && fids.back() == 0x7FFFFFFF)
- fids.pop_back();
- }
-}
-
-int
-FeatureList::lookups(int fid, Vector<int> &results, ErrorHandler *errh, bool clear_results) const
-{
- if (clear_results)
- results.clear();
- if (_str.length() == 0)
- return -1;
- if (errh == 0)
- errh = ErrorHandler::silent_handler();
-
- const uint8_t *data = _str.udata();
- int len = _str.length();
- int nfeatures = Data::u16_aligned(data);
- if (fid < 0 || fid >= nfeatures)
- return errh->error("OTF feature ID %<%d%> out of range", fid);
- int foff = Data::u16_aligned(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE + 4);
- int lookupCount;
- if (len < foff + FEATURE_HEADERSIZE
- || (lookupCount = Data::u16_aligned(data + foff + 2),
- len < foff + FEATURE_HEADERSIZE + lookupCount*LOOKUPLIST_RECSIZE))
- return errh->error("OTF LookupList for feature ID %<%d%> too short", fid);
- const uint8_t *ldata = data + foff + FEATURE_HEADERSIZE;
- for (int j = 0; j < lookupCount; j++, ldata += LOOKUPLIST_RECSIZE)
- results.push_back(Data::u16_aligned(ldata));
-
- return 0;
-}
-
-int
-FeatureList::lookups(const Vector<int> &fids, Vector<int> &results, ErrorHandler *errh) const
-{
- results.clear();
- if (_str.length() == 0)
- return -1;
-
- for (int i = 0; i < fids.size(); i++)
- if (lookups(fids[i], results, errh, false) < 0)
- return -1;
-
- // sort results and remove duplicates
- std::sort(results.begin(), results.end());
- int *unique_result = std::unique(results.begin(), results.end());
- results.resize(unique_result - results.begin());
- return 0;
-}
-
-int
-FeatureList::lookups(const Vector<int> &required_fids, const Vector<int> &fids, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
-{
- Vector<int> fidsx(fids);
- filter(fidsx, sorted_ftags);
- for (int i = 0; i < required_fids.size(); i++)
- fidsx.push_back(required_fids[i]);
- return lookups(fidsx, results, errh);
-}
-
-int
-FeatureList::lookups(int required_fid, const Vector<int> &fids, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
-{
- Vector<int> fidsx(fids);
- filter(fidsx, sorted_ftags);
- if (required_fid >= 0)
- fidsx.push_back(required_fid);
- return lookups(fidsx, results, errh);
-}
-
-int
-FeatureList::lookups(const ScriptList &script_list, Tag script, Tag langsys, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
-{
- int required_fid;
- Vector<int> fids;
- int result = script_list.features(script, langsys, required_fid, fids, errh);
- if (result >= 0) {
- filter(fids, sorted_ftags);
- if (required_fid >= 0)
- fids.push_back(required_fid);
- result = lookups(fids, results, errh);
- }
- return result;
-}
-
-
-/**************************
- * Coverage *
- * *
- **************************/
-
-Coverage::Coverage() throw ()
-{
-}
-
-Coverage::Coverage(Glyph first, Glyph last) throw ()
-{
- if (first <= last) {
- _str = String("\000\002\000\001\000\000\000\000\000\000", 10);
- uint8_t *data = _str.mutable_udata();
- data[4] = first >> 8;
- data[5] = first & 255;
- data[6] = last >> 8;
- data[7] = last & 255;
- _str.align(2);
- }
-}
-
-Coverage::Coverage(const Vector<bool> &gmap) throw ()
-{
- int end = gmap.size();
- while (end > 0 && !gmap[end - 1])
- --end;
- if (end > 0) {
- _str = String::make_uninitialized(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)
-{
- _str.align(2);
- if (do_check) {
- if (check(errh ? errh : ErrorHandler::silent_handler()) < 0)
- _str = String();
- } else { // check()'s shorten-string side effect
- const uint8_t *data = _str.udata();
- int count = Data::u16_aligned(data + 2);
- if (data[1] == T_LIST)
- _str = _str.substring(0, HEADERSIZE + count*LIST_RECSIZE);
- else
- _str = _str.substring(0, HEADERSIZE + count*RANGES_RECSIZE);
- }
-}
-
-int
-Coverage::check(ErrorHandler *errh)
- // side effect: shorten string to cover coverage
-{
- // HEADER FORMAT:
- // USHORT coverageFormat
- // USHORT glyphCount
- const uint8_t *data = _str.udata();
- if (_str.length() < HEADERSIZE)
- return errh->error("OTF coverage table too small");
- int coverageFormat = Data::u16_aligned(data);
- int count = Data::u16_aligned(data + 2);
-
- int len;
- switch (coverageFormat) {
- case T_LIST:
- len = HEADERSIZE + count*LIST_RECSIZE;
- if (_str.length() < len)
- return errh->error("OTF coverage table too short (format 1)");
- // XXX don't check sorting
- break;
- case T_RANGES:
- len = HEADERSIZE + count*RANGES_RECSIZE;
- if (_str.length() < len)
- return errh->error("OTF coverage table too short (format 2)");
- // XXX don't check sorting
- // XXX don't check startCoverageIndexes
- break;
- default:
- return errh->error("OTF coverage table has unknown format %d", coverageFormat);
- }
-
- _str = _str.substring(0, len);
- return 0;
-}
-
-int
-Coverage::size() const throw ()
-{
- if (_str.length() == 0)
- return -1;
- const uint8_t *data = _str.udata();
- if (data[1] == T_LIST)
- return (_str.length() - HEADERSIZE) / LIST_RECSIZE;
- else if (data[1] == T_RANGES) {
- data += _str.length() - RANGES_RECSIZE;
- return Data::u16_aligned(data + 4) + Data::u16_aligned(data + 2) - Data::u16_aligned(data) + 1;
- } else if (data[1] == T_X_BYTEMAP)
- return Data::u32_aligned(data + 4);
- else
- return -1;
-}
-
-int
-Coverage::coverage_index(Glyph g) const throw ()
-{
- if (_str.length() == 0)
- return -1;
-
- const uint8_t *data = _str.udata();
- int count = Data::u16_aligned(data + 2);
- if (data[1] == T_LIST) {
- int l = 0, r = count;
- data += HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- int mval = Data::u16_aligned(data + m * LIST_RECSIZE);
- if (g < mval)
- r = m;
- else if (g == mval)
- return m;
- else
- l = m + 1;
- }
- return -1;
- } else if (data[1] == T_RANGES) {
- int l = 0, r = count;
- data += HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- const uint8_t *rec = data + m * RANGES_RECSIZE;
- if (g < Data::u16_aligned(rec))
- r = m;
- else if (g <= Data::u16_aligned(rec + 2))
- return Data::u16_aligned(rec + 4) + g - Data::u16_aligned(rec);
- else
- 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;
-}
-
-Glyph
-Coverage::operator[](int cindex) const throw ()
-{
- if (_str.length() == 0 || cindex < 0)
- return 0;
-
- const uint8_t *data = _str.udata();
- int count = Data::u16_aligned(data + 2);
- if (data[1] == T_LIST)
- return (cindex < count ? Data::u16_aligned(data + cindex * LIST_RECSIZE) : 0);
- else if (data[1] == T_RANGES) {
- int l = 0, r = count;
- data += HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- const uint8_t *rec = data + m * RANGES_RECSIZE;
- int start_cindex = Data::u16_aligned(rec + 4);
- if (cindex < start_cindex)
- r = m;
- else if (cindex < start_cindex + Data::u16_aligned(rec + 2) - Data::u16_aligned(rec))
- return Data::u16_aligned(rec) + cindex - start_cindex;
- else
- l = m + 1;
- }
- return 0;
- } else
- return 0;
-}
-
-void
-Coverage::unparse(StringAccum &sa) const throw ()
-{
- const uint8_t *data = _str.udata();
- if (_str.length() == 0)
- sa << "@*#!";
- else if (data[1] == T_LIST) {
- int count = Data::u16_aligned(data + 2);
- for (int i = 0; i < count; i++) {
- if (i) sa << ',';
- sa << Data::u16_aligned(data + HEADERSIZE + i*LIST_RECSIZE);
- }
- } else {
- for (int pos = HEADERSIZE; pos < _str.length(); pos += RANGES_RECSIZE) {
- Glyph start = Data::u16_aligned(data + pos);
- Glyph end = Data::u16_aligned(data + pos + 2);
- if (pos > HEADERSIZE) sa << ',';
- sa << start;
- if (end != start) sa << '.' << '.' << end;
- }
- }
-}
-
-String
-Coverage::unparse() const throw ()
-{
- StringAccum sa;
- unparse(sa);
- return sa.take_string();
-}
-
-Coverage
-operator&(const Coverage &a, const Coverage &b)
-{
- StringAccum sa;
- sa << '\000' << '\001' << '\000' << '\000';
-
- 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);
- return Coverage(sa.take_string(), 0, false);
-}
-
-bool
-operator<=(const Coverage &a, const Coverage &b)
-{
- Coverage::iterator ai = a.begin(), bi = b.begin();
- while (ai && bi) {
- if (*ai != *bi && !bi.forward_to(*ai))
- return false;
- ai++, bi++;
- }
- return bi || !ai;
-}
-
-
-/************************
- * Coverage::iterator *
- * *
- ************************/
-
-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();
- int n = Data::u16_aligned(data + 2);
- switch (Data::u16_aligned(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 : Data::u16_aligned(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;
- }
-}
-
-int
-Coverage::iterator::coverage_index() const
-{
- const uint8_t *data = _str.udata();
- assert(_pos < _str.length());
- if (data[1] == T_LIST)
- return (_pos - HEADERSIZE) / LIST_RECSIZE;
- else if (data[1] == T_RANGES)
- return Data::u16_aligned(data + _pos + 4) + _value - Data::u16_aligned(data + _pos);
- else
- return _pos - 8;
-}
-
-void
-Coverage::iterator::operator++(int)
-{
- const uint8_t *data = _str.udata();
- int len = _str.length();
- if (_pos >= len
- || (data[1] == T_RANGES && ++_value <= Data::u16_aligned(data + _pos + 2)))
- return;
- switch (data[1]) {
- case T_LIST:
- _pos += LIST_RECSIZE;
- normal_pos_setting:
- _value = _pos >= len ? 0 : Data::u16_aligned(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
-Coverage::iterator::forward_to(Glyph find)
-{
- // XXX really should check that this works
-
- if (find <= _value)
- return find == _value;
- else if (_pos >= _str.length())
- return false;
-
- const uint8_t *data = _str.udata();
- if (data[1] == T_LIST) {
- // check for "common" case: next element
- _pos += LIST_RECSIZE;
- if (_pos >= _str.length())
- return false;
- else if (find <= Data::u16_aligned(data + _pos)) {
- _value = Data::u16_aligned(data + _pos);
- return find == _value;
- }
-
- // otherwise, binary search over remaining area
- int l = ((_pos - HEADERSIZE) / LIST_RECSIZE) + 1;
- int r = (_str.length() - HEADERSIZE) / LIST_RECSIZE;
- data += HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- Glyph g = Data::u16_aligned(data + m * LIST_RECSIZE);
- if (find < g)
- r = m;
- else if (find == g)
- l = r = m;
- else
- l = m + 1;
- }
- _pos = HEADERSIZE + l * LIST_RECSIZE;
- _value = (_pos >= _str.length() ? 0 : Data::u16_aligned(data - HEADERSIZE + _pos));
-
- } else if (data[1] == T_RANGES) {
- // check for "common" case: this or next element
- if (find <= Data::u16_aligned(data + _pos + 2)) {
- assert(find >= Data::u16_aligned(data + _pos));
- _value = find;
- return true;
- }
- _pos += RANGES_RECSIZE;
- if (_pos >= _str.length())
- return false;
- else if (find <= Data::u16_aligned(data + _pos + 2)) {
- _value = (find >= Data::u16_aligned(data + _pos) ? find : Data::u16_aligned(data + _pos));
- return find == _value;
- }
-
- // otherwise, binary search over remaining area
- int l = ((_pos - HEADERSIZE) / RANGES_RECSIZE) + 1;
- int r = (_str.length() - HEADERSIZE) / RANGES_RECSIZE;
- data += HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- if (find < Data::u16_aligned(data + m * RANGES_RECSIZE))
- r = m;
- else if (find <= Data::u16_aligned(data + m * RANGES_RECSIZE + 2)) {
- _pos = HEADERSIZE + m * RANGES_RECSIZE;
- _value = find;
- return true;
- } else
- l = m + 1;
- }
- _pos = HEADERSIZE + l * LIST_RECSIZE;
- _value = (_pos >= _str.length() ? 0 : Data::u16_aligned(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;
-}
-
-
-/**************************
- * GlyphSet *
- * *
- **************************/
-
-GlyphSet::GlyphSet()
-{
- memset(_v, 0, sizeof(_v));
-}
-
-GlyphSet::GlyphSet(const GlyphSet &o)
-{
- for (int i = 0; i < VLEN; i++)
- if (o._v[i]) {
- _v[i] = new uint32_t[VULEN];
- memcpy(_v[i], o._v[i], sizeof(uint32_t) * VULEN);
- } else
- _v[i] = 0;
-}
-
-GlyphSet::~GlyphSet()
-{
- for (int i = 0; i < VLEN; i++)
- delete[] _v[i];
-}
-
-int
-GlyphSet::change(Glyph g, bool value)
-{
- if ((unsigned)g > MAXGLYPH)
- return -1;
- uint32_t *&u = _v[g >> SHIFT];
- if (!u) {
- u = new uint32_t[VULEN];
- memset(u, 0, sizeof(uint32_t) * VULEN);
- }
- uint32_t mask = (1 << (g & 0x1F));
- if (value)
- u[(g & MASK) >> 5] |= mask;
- else
- u[(g & MASK) >> 5] &= ~mask;
- return 0;
-}
-
-GlyphSet &
-GlyphSet::operator=(const GlyphSet &o)
-{
- if (&o != this) {
- for (int i = 0; i < VLEN; i++)
- if (o._v[i]) {
- if (!_v[i])
- _v[i] = new uint32_t[VULEN];
- memcpy(_v[i], o._v[i], sizeof(uint32_t) * VULEN);
- } else if (_v[i])
- memset(_v[i], 0, sizeof(uint32_t) * VULEN);
- }
- return *this;
-}
-
-
-/**************************
- * ClassDef *
- * *
- **************************/
-
-ClassDef::ClassDef(const String &str, ErrorHandler *errh) throw ()
- : _str(str)
-{
- _str.align(2);
- if (check(errh ? errh : ErrorHandler::silent_handler()) < 0)
- _str = String();
-}
-
-int
-ClassDef::check(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // USHORT coverageFormat
- // USHORT glyphCount
- const uint8_t *data = _str.udata();
- if (_str.length() < 6) // NB: prevents empty format-2 tables
- return errh->error("OTF class def table too small");
- int classFormat = Data::u16_aligned(data);
-
- int len;
- if (classFormat == T_LIST) {
- int count = Data::u16_aligned(data + 4);
- len = LIST_HEADERSIZE + count*LIST_RECSIZE;
- // XXX don't check sorting
- } else if (classFormat == T_RANGES) {
- int count = Data::u16_aligned(data + 2);
- len = RANGES_HEADERSIZE + count*RANGES_RECSIZE;
- // XXX don't check sorting
- } else
- return errh->error("OTF class def table has unknown format %d", classFormat);
-
- if (len > _str.length())
- return errh->error("OTF class def table too short");
- else {
- _str = _str.substring(0, len);
- return 0;
- }
-}
-
-int
-ClassDef::lookup(Glyph g) const throw ()
-{
- if (_str.length() == 0)
- return -1;
-
- const uint8_t *data = _str.udata();
- int coverageFormat = Data::u16_aligned(data);
-
- if (coverageFormat == T_LIST) {
- Glyph start = Data::u16_aligned(data + 2);
- int count = Data::u16_aligned(data + 4);
- if (g < start || g >= start + count)
- return 0;
- else
- return Data::u16_aligned(data + LIST_HEADERSIZE + (g - start) * LIST_RECSIZE);
- } else if (coverageFormat == T_RANGES) {
- int l = 0, r = Data::u16_aligned(data + 2);
- data += RANGES_HEADERSIZE;
- while (l < r) {
- int m = l + (r - l) / 2;
- const uint8_t *rec = data + m * RANGES_RECSIZE;
- if (g < Data::u16_aligned(rec))
- r = m;
- else if (g <= Data::u16_aligned(rec + 2))
- return Data::u16_aligned(rec + 4);
- else
- l = m + 1;
- }
- return 0;
- } else
- return 0;
-}
-
-void
-ClassDef::unparse(StringAccum &sa) const throw ()
-{
- const uint8_t *data = _str.udata();
- if (_str.length() == 0)
- sa << "@*#!";
- else if (data[1] == T_LIST) {
- Glyph start = Data::u16_aligned(data + 2);
- int count = Data::u16_aligned(data + 4);
- for (int i = 0; i < count; i++) {
- if (i) sa << ',';
- sa << start + i << '=' << Data::u16_aligned(data + LIST_HEADERSIZE + i*LIST_RECSIZE);
- }
- } else {
- for (int pos = RANGES_HEADERSIZE; pos < _str.length(); pos += RANGES_RECSIZE) {
- Glyph start = Data::u16_aligned(data + pos);
- Glyph end = Data::u16_aligned(data + pos + 2);
- if (pos > RANGES_HEADERSIZE) sa << ',';
- sa << start;
- if (end != start) sa << '.' << '.' << end;
- sa << '=' << Data::u16_aligned(data + pos + 4);
- }
- }
-}
-
-String
-ClassDef::unparse() const throw ()
-{
- StringAccum sa;
- unparse(sa);
- return sa.take_string();
-}
-
-
-/******************************
- * ClassDef::class_iterator *
- * *
- ******************************/
-
-ClassDef::class_iterator::class_iterator(const String &str, int pos, int the_class, const Coverage::iterator &coviter)
- : _str(str), _pos(pos), _class(the_class), _coviter(coviter)
-{
- // XXX assume _str has been checked
-
- // cannot handle the_class == 0 when coviter doesn't exist
- if (_class == 0 && !_coviter)
- throw Error("cannot iterate over ClassDef class 0");
-
- // shrink _str to fit the coverage table, and create a fake coverage
- // iterator if necessary
- const uint8_t *data = _str.udata();
- if (_str.length()) {
- switch (Data::u16_aligned(data)) {
- case T_LIST: {
- Glyph start = Data::u16_aligned(data + 2);
- int nglyphs = Data::u16_aligned(data + 4);
- _str = _str.substring(0, LIST_HEADERSIZE + nglyphs*LIST_RECSIZE);
- if (!_coviter)
- _coviter = Coverage(start, start + nglyphs - 1).begin();
- if (_class)
- _coviter.forward_to(start);
- break;
- }
- case T_RANGES: {
- Glyph start = Data::u16_aligned(data + RANGES_HEADERSIZE);
- int nranges = Data::u16_aligned(data + 2);
- _str = _str.substring(0, RANGES_HEADERSIZE + nranges*RANGES_RECSIZE);
- if (!_coviter) {
- Glyph end = Data::u16_aligned(data + RANGES_HEADERSIZE + 2 + (nranges - 1)*RANGES_RECSIZE);
- _coviter = Coverage(start, end).begin();
- }
- if (_class)
- _coviter.forward_to(start);
- break;
- }
- default:
- _str = String();
- break;
- }
- }
-
- // move to the first relevant glyph
- if (_pos >= _str.length())
- _pos = _str.length();
- else {
- _pos = 0;
- (*this)++;
- }
-}
-
-void
-ClassDef::class_iterator::increment_class0()
-{
- const uint8_t *data = _str.udata();
- int len = _str.length();
- bool is_list = (data[1] == T_LIST);
-
- if (_pos != 0)
- _coviter++;
- else
- _pos = FIRST_POS;
-
- if (_pos == FIRST_POS && _coviter) {
- if (*_coviter < Data::u16_aligned(data + (is_list ? 2 : RANGES_HEADERSIZE)))
- return;
- _pos = (is_list ? LIST_HEADERSIZE : RANGES_HEADERSIZE);
- }
-
- while (_pos > 0 && _pos < len && _coviter) {
- Glyph g = *_coviter;
- if (is_list) {
- _pos = LIST_HEADERSIZE + LIST_RECSIZE*(g - Data::u16_aligned(data + 2));
- if (_pos >= len)
- break;
- else if (Data::u16_aligned(data + _pos) == 0) // _class == 0
- return;
- _coviter++;
- } else {
- if (g < Data::u16_aligned(data + _pos)) // in a zero range
- return;
- else if (g > Data::u16_aligned(data + _pos + 2))
- _pos += RANGES_RECSIZE;
- else if (Data::u16_aligned(data + _pos + 4) == 0) // _class == 0
- return;
- else
- _coviter.forward_to(Data::u16_aligned(data + _pos + 2) + 1);
- }
- }
-
- if (_coviter)
- _pos = LAST_POS;
- else
- _pos = len;
-}
-
-void
-ClassDef::class_iterator::operator++(int)
-{
- if (_class == 0) {
- increment_class0();
- return;
- }
-
- const uint8_t *data = _str.udata();
- int len = _str.length();
- bool is_list = (data[1] == T_LIST);
-
- if (_pos != 0)
- _coviter++;
- else
- _pos = (is_list ? LIST_HEADERSIZE : RANGES_HEADERSIZE);
-
- while (_pos < len && _coviter) {
- Glyph g = *_coviter;
- if (is_list) {
- _pos = LIST_HEADERSIZE + LIST_RECSIZE*(g - Data::u16_aligned(data + 2));
- if (_pos >= len || Data::u16_aligned(data + _pos) == _class)
- return;
- _coviter++;
- } else {
- while (_pos < len && (g > Data::u16_aligned(data + _pos + 2)
- || Data::u16_aligned(data + _pos + 4) != _class))
- _pos += RANGES_RECSIZE;
- // now, _pos >= len, or g <= rec.end && class == rec.class
- if (_pos >= len || g >= Data::u16_aligned(data + _pos))
- return;
- _coviter.forward_to(Data::u16_aligned(data + _pos));
- }
- }
-
- _pos = len;
-}
-
-
-}}
-
-
-// template instantiations
-#include <lcdf/vector.cc>
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfcmap.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfcmap.cc
deleted file mode 100644
index 93b90b3e60a..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfcmap.cc
+++ /dev/null
@@ -1,474 +0,0 @@
-// -*- related-file-name: "../include/efont/otfcmap.hh" -*-
-
-/* otfcmap.{cc,hh} -- OpenType cmap table
- *
- * Copyright (c) 2002-2012 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/otfcmap.hh>
-#include <lcdf/error.hh>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <efont/otfdata.hh> // for ntohl()
-
-#define USHORT_AT(d) (Data::u16_aligned(d))
-#define SHORT_AT(d) (Data::s16_aligned(d))
-#define ULONG_AT(d) (Data::u32_aligned(d))
-
-namespace Efont { namespace OpenType {
-
-Cmap::Cmap(const String &s, ErrorHandler *errh)
- : _str(s)
-{
- _str.align(4);
- _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
-}
-
-int
-Cmap::parse_header(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // USHORT version
- // USHORT numTables
- int len = _str.length();
- const uint8_t *data = _str.udata();
- if (HEADER_SIZE > len)
- return errh->error("OTF cmap too small"), -EFAULT;
- if (!(data[0] == '\000' && data[1] == '\000'))
- return errh->error("bad cmap version number"), -ERANGE;
- _ntables = USHORT_AT(data + 2);
- if (_ntables == 0)
- return errh->error("OTF cmap contains no tables"), -EINVAL;
- if (HEADER_SIZE + ENCODING_SIZE * _ntables > len)
- return errh->error("cmap directory out of range"), -EFAULT;
-
- // ENCODING ENTRY FORMAT:
- // USHORT platformID
- // USHORT encodingID
- // ULONG offset
- int last_platform = -1;
- int last_encoding = -1;
- int last_language = -1;
- _first_unicode_table = -1;
- for (int i = 0; i < _ntables; i++) {
- int loc = HEADER_SIZE + ENCODING_SIZE * i;
- int platform = USHORT_AT(data + loc);
- int encoding = USHORT_AT(data + loc + 2);
- uint32_t offset = ULONG_AT(data + loc + 4);
- if (offset + 8 > (uint32_t) len) {
- length_error:
- return errh->error("encoding data for entry %d out of range", i);
- }
- int format = USHORT_AT(data + offset);
- int language;
- if (format == F_BYTE || format == F_HIBYTE || format == F_SEGMENTED
- || format == F_TRIMMED) {
- if (USHORT_AT(data + offset + 2) < 6)
- goto length_error;
- language = USHORT_AT(data + offset + 4);
- } else if (format == F_HIBYTE32 || format == F_TRIMMED32
- || format == F_SEGMENTED32) {
- if (offset + 12 > (uint32_t) len || ULONG_AT(data + offset + 4) < 12)
- goto length_error;
- language = ULONG_AT(data + offset + 8);
- } else
- continue;
- if (!(platform > last_platform
- || (platform == last_platform
- && (encoding > last_encoding
- || (encoding == last_encoding
- && language > last_language)))))
- return errh->error("subtables out of order at entry %d", i);
- if ((platform == 0 || (platform == 3 && encoding == 1))
- && _first_unicode_table < 0)
- _first_unicode_table = i;
- last_platform = platform, last_encoding = encoding, last_language = language;
- }
-
- _table_error.assign(_ntables, -2);
- return 0;
-}
-
-int
-Cmap::first_table(int platform, int encoding) const
-{
- if (error() < 0)
- return -1;
- const uint8_t *data = _str.udata();
- data += HEADER_SIZE;
- for (int i = 0; i < _ntables; i++, data += ENCODING_SIZE) {
- int p = USHORT_AT(data), e = USHORT_AT(data + 2);
- if (platform == p && (encoding < 0 || encoding == e))
- return i;
- }
- return -1;
-}
-
-int
-Cmap::check_table(int t, ErrorHandler *errh) const
-{
- if (!errh)
- errh = ErrorHandler::silent_handler();
- if (t == USE_FIRST_UNICODE_TABLE && _first_unicode_table == -1) {
- errh->warning("font appears not to support Unicode");
- _first_unicode_table = 0;
- }
- if (t == USE_FIRST_UNICODE_TABLE)
- t = _first_unicode_table;
- if (_error < 0 || t < 0 || t >= _ntables)
- return errh->error("no such table");
- if (_table_error[t] != -2)
- return _table_error[t];
- _table_error[t] = -1;
-
- const uint8_t *data = table_data(t);
- uint32_t left = _str.uend() - data;
- int format = USHORT_AT(data);
- uint32_t length = 0; // value not used
-
- switch (format) {
-
- case F_BYTE:
- if (left < 4
- || (length = USHORT_AT(data + 2)) > left
- || length != 259)
- return errh->error("bad table %d length (format %d)", t, format);
- break;
-
- case F_HIBYTE:
- if (left < 4
- || (length = USHORT_AT(data + 2)) > left
- || length < 524)
- return errh->error("bad table %d length (format %d)", t, format);
- for (int hi_byte = 0; hi_byte < 256; hi_byte++)
- if (uint32_t subh_key = USHORT_AT(data + 6 + 2 * hi_byte)) {
- if ((subh_key & 7) || HIBYTE_SUBHEADERS + subh_key + 8 > length)
- return errh->error("bad table %d subheader %d offset (format 2)", t, hi_byte);
- const uint8_t *subh = data + HIBYTE_SUBHEADERS + subh_key;
- int firstCode = USHORT_AT(subh);
- int entryCount = USHORT_AT(subh + 2);
- int idRangeOffset = USHORT_AT(subh + 6);
- if (firstCode + entryCount > 256 || entryCount == 0)
- return errh->error("bad table %d subheader %d contents (format 2)", t, hi_byte);
- if ((HIBYTE_SUBHEADERS + subh_key + 6) // pos[idRangeOffset]
- + idRangeOffset + entryCount * 2 > length)
- return errh->error("bad table %d subheader %d length (format 2)", t, hi_byte);
- }
- break;
-
- case F_SEGMENTED: {
- if (left < 4
- || (length = USHORT_AT(data + 2)) > left
- || length < 16)
- return errh->error("bad table %d length (format %d)", t, format);
- int segCountX2 = USHORT_AT(data + 6);
- int searchRange = USHORT_AT(data + 8);
- int entrySelector = USHORT_AT(data + 10);
- int rangeShift = USHORT_AT(data + 12);
- if ((segCountX2 & 1)
- || segCountX2 == 0
- || (searchRange & (searchRange - 1)) /* not a power of 2? */
- || searchRange <= segCountX2/2
- || (searchRange>>1) > segCountX2/2
- || 1 << (entrySelector + 1) != searchRange
- || rangeShift != segCountX2 - searchRange)
- return errh->error("bad table %d segment counts (format 4)", t);
- uint32_t segCount = segCountX2 >> 1;
- if (length < 16 + 8 * segCount)
- return errh->error("bad table %d length (format %d)", t, format);
- const uint8_t *endCodes = data + 14;
- const uint8_t *startCodes = endCodes + 2 + segCountX2;
- const uint8_t *idDeltas = startCodes + segCountX2;
- const uint8_t *idRangeOffsets = idDeltas + segCountX2;
- int last_end = 0;
- for (int i = 0; i < segCountX2; i += 2) {
- int endCode = USHORT_AT(endCodes + i);
- int startCode = USHORT_AT(startCodes + i);
- /* int idDelta = SHORT_AT(idDeltas + i); // no need to check */
- int idRangeOffset = USHORT_AT(idRangeOffsets + i);
- if (endCode < startCode || startCode < last_end)
- return errh->error("bad table %d overlapping range %d (format %d)", t, i/2, format);
- if (idRangeOffset
- && idRangeOffsets + i + idRangeOffset + (endCode - startCode)*2 + 2 > data + length)
- return errh->error("bad table %d range %d length (format 4)", t, i/2);
- last_end = endCode + 1;
- }
- if (USHORT_AT(endCodes + segCountX2 - 2) != 0xFFFF)
- return errh->error("bad table %d incorrect final endCode (format 4)", t);
- break;
- }
-
- case F_TRIMMED: {
- if (left < 4
- || (length = USHORT_AT(data + 2)) > left
- || length < 10)
- return errh->error("bad table %d length (format %d)", t, format);
- uint32_t entryCount = USHORT_AT(data + 8);
- if (10 + entryCount * 2 > length)
- return errh->error("bad table %d length (format %d)", t, format);
- break;
- }
-
- case F_SEGMENTED32: {
- if (left < 8
- || (length = ULONG_AT(data + 4)) > left
- || length < 16)
- return errh->error("bad table %d length (format %d)", t, format);
- uint32_t nGroups = ULONG_AT(data + 16);
- if ((length - 16) / 12 < nGroups)
- return errh->error("bad table %d length (format %d)", t, format);
- uint32_t last_post_end = 0;
- data += 16;
- for (uint32_t i = 0; i < nGroups; i++, data += 12) {
- uint32_t startCharCode = ULONG_AT(data);
- uint32_t endCharCode = ULONG_AT(data + 4);
- if (startCharCode < last_post_end || endCharCode < startCharCode)
- return errh->error("bad table %d overlapping range %d (format %d)", t, i, format);
- last_post_end = endCharCode + 1;
- }
- break;
- }
-
- case F_HIBYTE32:
- case F_TRIMMED32:
- default:
- return errh->error("bad table %d unsupported format %d", t, format);
-
- }
-
- _table_error[t] = t;
- return t;
-}
-
-Glyph
-Cmap::map_table(int t, uint32_t uni, ErrorHandler *errh) const
-{
- if ((t = check_table(t, errh)) < 0)
- return 0;
-
- const uint8_t *data = table_data(t);
- switch (USHORT_AT(data)) {
-
- case F_BYTE:
- if (uni < 256)
- return data[6 + uni];
- else
- return 0;
-
- case F_HIBYTE: {
- if (uni >= 65536)
- return 0;
- int hi_byte = (uni >> 8) & 255;
- int subh = USHORT_AT(data + 6 + hi_byte * 2);
- if (subh == 0 && hi_byte) // XXX?
- return 0;
- data += 524 + subh;
- int firstCode = USHORT_AT(data);
- int entryCount = USHORT_AT(data + 2);
- int idDelta = SHORT_AT(data + 4);
- int idRangeOffset = USHORT_AT(data + 6);
- int lo_byte = uni & 255;
- if (lo_byte < firstCode || lo_byte >= firstCode + entryCount)
- return 0;
- int answer = USHORT_AT(data + 6 + idRangeOffset + (lo_byte - firstCode) * 2);
- if (answer == 0)
- return 0;
- return (answer + idDelta) & 65535;
- }
-
- case F_SEGMENTED: {
- if (uni >= 65536)
- return 0;
- int segCount = USHORT_AT(data + 6) >> 1;
- const uint8_t *endCounts = data + 14;
- const uint8_t *startCounts = endCounts + (segCount << 1) + 2;
- const uint8_t *idDeltas = startCounts + (segCount << 1);
- const uint8_t *idRangeOffsets = idDeltas + (segCount << 1);
- int l = 0, r = segCount;
- while (l < r) {
- int m = l + (r - l) / 2;
- uint32_t endCount = USHORT_AT(endCounts + (m << 1));
- uint32_t startCount = USHORT_AT(startCounts + (m << 1));
- if (uni < startCount)
- r = m;
- else if (uni <= endCount) {
- int idDelta = SHORT_AT(idDeltas + (m << 1));
- int idRangeOffset = USHORT_AT(idRangeOffsets + (m << 1));
- if (idRangeOffset == 0)
- return (idDelta + uni) & 65535;
- int g = USHORT_AT(idRangeOffsets + (m << 1) + idRangeOffset + ((uni - startCount) << 1));
- if (g == 0)
- return 0;
- return (idDelta + g) & 65535;
- } else
- l = m + 1;
- }
- return 0;
- }
-
- case F_TRIMMED: {
- uint32_t firstCode = USHORT_AT(data + 6);
- uint32_t entryCount = USHORT_AT(data + 8);
- if (uni < firstCode || uni >= firstCode + entryCount)
- return 0;
- return USHORT_AT(data + 10 + ((uni - firstCode) << 1));
- }
-
- case F_SEGMENTED32: {
- uint32_t nGroups = ULONG_AT(data + 12);
- uint32_t l = 0, r = nGroups;
- const uint8_t *groups = data + 16;
- while (l < r) {
- uint32_t m = l + (r - l) / 2;
- uint32_t startCharCode = ULONG_AT(groups + m * 12);
- uint32_t endCharCode = ULONG_AT(groups + m * 12 + 4);
- if (uni < startCharCode)
- r = m;
- else if (uni <= endCharCode)
- return ULONG_AT(groups + m * 12 + 8) + uni - startCharCode;
- else
- l = m + 1;
- }
- return 0;
- }
-
- default:
- return 0;
-
- }
-}
-
-void
-Cmap::dump_table(int t, Vector<uint32_t> &g2c, ErrorHandler *errh) const
-{
- if ((t = check_table(t, errh)) < 0)
- return;
-
- const uint8_t *data = table_data(t);
- switch (USHORT_AT(data)) {
-
- case F_BYTE:
- g2c.resize(256, 0);
- for (int c = 0; c < 256; c++)
- if (int g = data[6 + c])
- if (!g2c[g])
- g2c[g] = c;
- break;
-
- case F_HIBYTE:
- assert(USHORT_AT(data + 6) == 0);
- for (int hi_byte = 0; hi_byte < 256; hi_byte++) {
- int subh = USHORT_AT(data + 6 + hi_byte * 4);
- if (subh == 0 && hi_byte > 0)
- continue;
- const uint8_t *tdata = data + 524 + subh;
- int firstCode = USHORT_AT(tdata);
- int entryCount = USHORT_AT(tdata + 2);
- int idDelta = SHORT_AT(tdata + 4);
- int idRangeOffset = USHORT_AT(tdata + 6);
- const uint8_t *gdata = tdata + 6 + idRangeOffset;
- for (int i = 0; i < entryCount; i++)
- if (int g = USHORT_AT(gdata + (i << 1))) {
- g = (idDelta + g) & 65535;
- if (g >= g2c.size())
- g2c.resize(g + 1, 0);
- if (!g2c[g])
- g2c[g] = (hi_byte << 8) + firstCode + i;
- }
- }
- break;
-
- case F_SEGMENTED: {
- int segCountX2 = USHORT_AT(data + 6);
- const uint8_t *endCounts = data + 14;
- const uint8_t *startCounts = endCounts + segCountX2 + 2;
- const uint8_t *idDeltas = startCounts + segCountX2;
- const uint8_t *idRangeOffsets = idDeltas + segCountX2;
- for (int i = 0; i < segCountX2; i += 2) {
- int endCount = USHORT_AT(endCounts + i);
- int startCount = USHORT_AT(startCounts + i);
- int idDelta = SHORT_AT(idDeltas + i);
- int idRangeOffset = USHORT_AT(idRangeOffsets + i);
- if (idRangeOffset == 0) {
- for (int c = startCount; c <= endCount; c++) {
- Glyph g = (c + idDelta) & 65535;
- if (g >= g2c.size())
- g2c.resize(g + 1, 0);
- if (!g2c[g])
- g2c[g] = c;
- }
- } else {
- const uint8_t *gdata = idRangeOffsets + i + idRangeOffset;
- for (int c = startCount; c <= endCount; c++, gdata += 2)
- if (int g = USHORT_AT(gdata)) {
- g = (g + idDelta) & 65535;
- if (g >= g2c.size())
- g2c.resize(g + 1, 0);
- if (!g2c[g])
- g2c[g] = c;
- }
- }
- }
- break;
- }
-
- case F_TRIMMED: {
- int firstCode = USHORT_AT(data + 6);
- int entryCount = USHORT_AT(data + 8);
- for (int i = 0; i < entryCount; i++)
- if (int g = USHORT_AT(data + 10 + (i << 1))) {
- if (g >= g2c.size())
- g2c.resize(g + 1, 0);
- if (!g2c[g])
- g2c[g] = firstCode + i;
- }
- break;
- }
-
- case F_SEGMENTED32: {
- uint32_t nGroups = ULONG_AT(data + 12);
- const uint8_t *groups = data + 16;
- for (uint32_t i = 0; i < nGroups; i++, groups += 12) {
- uint32_t startCharCode = ULONG_AT(groups);
- uint32_t nCharCodes = ULONG_AT(groups + 4) - startCharCode;
- uint32_t startGlyphID = ULONG_AT(groups + 8);
- if (startGlyphID + nCharCodes >= (uint32_t) g2c.size())
- g2c.resize(startGlyphID + nCharCodes + 1, 0);
- for (uint32_t i = 0; i <= nCharCodes; i++)
- if (!g2c[startGlyphID + i])
- g2c[startGlyphID + i] = startCharCode + i;
- }
- break;
- }
-
- default:
- break;
-
- }
-}
-
-int
-Cmap::map_uni(const Vector<uint32_t> &vin, Vector<Glyph> &vout) const
-{
- int t;
- if ((t = check_table(USE_FIRST_UNICODE_TABLE)) < 0)
- return -1;
- vout.resize(vin.size(), 0);
- for (int i = 0; i < vin.size(); i++)
- vout[i] = map_table(t, vin[i]);
- return 0;
-}
-
-}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgpos.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgpos.cc
deleted file mode 100644
index eb477256c5c..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgpos.cc
+++ /dev/null
@@ -1,328 +0,0 @@
-// -*- related-file-name: "../include/efont/otfgpos.hh" -*-
-
-/* otfgpos.{cc,hh} -- OpenType GPOS table
- *
- * Copyright (c) 2003-2012 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/otfgpos.hh>
-#include <lcdf/error.hh>
-#include <lcdf/straccum.hh>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <algorithm>
-
-namespace Efont { namespace OpenType {
-
-
-/**************************
- * Gpos *
- * *
- **************************/
-
-Gpos::Gpos(const Data &d, ErrorHandler *errh) throw (Error)
-{
- // Fixed Version
- // Offset ScriptList
- // Offset FeatureList
- // Offset LookupList
- if (d.length() == 0)
- throw BlankTable("GPOS");
- if (d.u16(0) != 1)
- throw Format("GPOS");
- if (_script_list.assign(d.offset_subtable(4), errh) < 0)
- throw Format("GPOS script list");
- if (_feature_list.assign(d.offset_subtable(6), errh) < 0)
- throw Format("GPOS feature list");
- _lookup_list = d.offset_subtable(8);
-}
-
-int
-Gpos::nlookups() const
-{
- return _lookup_list.u16(0);
-}
-
-GposLookup
-Gpos::lookup(unsigned i) const
-{
- if (i >= _lookup_list.u16(0))
- throw Error("GPOS lookup out of range");
- else
- return GposLookup(_lookup_list.offset_subtable(2 + i*2));
-}
-
-
-/**************************
- * GposValue *
- * *
- **************************/
-
-const int GposValue::nibble_bitcount_x2[] = { 0, 2, 2, 4, 2, 4, 4, 6,
- 2, 4, 4, 6, 4, 6, 6, 8 };
-
-
-/**************************
- * GposLookup *
- * *
- **************************/
-
-GposLookup::GposLookup(const Data &d) throw (Error)
- : _d(d)
-{
- if (_d.length() < 6)
- throw Format("GPOS Lookup table");
- _type = _d.u16(0);
- if (_type == L_EXTENSION && _d.u16(4) != 0) {
- Data first_subtable = _d.offset_subtable(HEADERSIZE);
- if (first_subtable.length() < 8 || first_subtable.u16(0) != 1)
- throw Format("GPOS Extension Lookup table");
- _type = first_subtable.u16(2);
- }
-}
-
-Data
-GposLookup::subtable(int i) const
-{
- Data subd = _d.offset_subtable(HEADERSIZE + i*RECSIZE);
- if (_d.u16(0) != L_EXTENSION)
- return subd;
- else if (subd.length() >= 8 && subd.u16(0) == 1 && subd.u16(2) == _type)
- return subd.subtable(subd.u32(4));
- else
- return Data();
-}
-
-bool
-GposLookup::unparse_automatics(Vector<Positioning> &v, ErrorHandler *errh) const
-{
- int nlookup = _d.u16(4), success = 0;
- switch (_type) {
- case L_SINGLE:
- for (int i = 0; i < nlookup; i++)
- try {
- GposSingle s(subtable(i));
- s.unparse(v);
- success++;
- } catch (Error e) {
- if (errh)
- errh->warning("%s, continuing", e.description.c_str());
- }
- return success > 0;
- case L_PAIR:
- for (int i = 0; i < nlookup; i++)
- try {
- GposPair p(subtable(i));
- p.unparse(v);
- success++;
- } catch (Error e) {
- if (errh)
- errh->warning("%s, continuing", e.description.c_str());
- }
- return success > 0;
- default:
- return false;
- }
-}
-
-
-/**************************
- * GposSingle *
- * *
- **************************/
-
-GposSingle::GposSingle(const Data &d) throw (Error)
- : _d(d)
-{
- if (_d[0] != 0
- || (_d[1] != 1 && _d[1] != 2))
- throw Format("GPOS Single Positioning");
- Coverage coverage(_d.offset_subtable(2));
- if (!coverage.ok()
- || (_d[1] == 2 && coverage.size() > _d.u16(6)))
- throw Format("GPOS Single Positioning coverage");
-}
-
-Coverage
-GposSingle::coverage() const throw ()
-{
- return Coverage(_d.offset_subtable(2), 0, false);
-}
-
-void
-GposSingle::unparse(Vector<Positioning> &v) const
-{
- if (_d[1] == 1) {
- int format = _d.u16(4);
- Data value = _d.subtable(6);
- for (Coverage::iterator i = coverage().begin(); i; i++)
- v.push_back(Positioning(Position(*i, format, value)));
- } else {
- int format = _d.u16(4);
- int size = GposValue::size(format);
- for (Coverage::iterator i = coverage().begin(); i; i++)
- v.push_back(Positioning(Position(*i, format, _d.subtable(F2_HEADERSIZE + size*i.coverage_index()))));
- }
-}
-
-
-/**************************
- * GposPair *
- * *
- **************************/
-
-GposPair::GposPair(const Data &d) throw (Error)
- : _d(d)
-{
- if (_d[0] != 0
- || (_d[1] != 1 && _d[1] != 2))
- throw Format("GPOS Pair Positioning");
- Coverage coverage(_d.offset_subtable(2));
- if (!coverage.ok()
- || (_d[1] == 1 && coverage.size() > _d.u16(8)))
- throw Format("GPOS Pair Positioning coverage");
-}
-
-Coverage
-GposPair::coverage() const throw ()
-{
- return Coverage(_d.offset_subtable(2), 0, false);
-}
-
-void
-GposPair::unparse(Vector<Positioning> &v) const
-{
- if (_d[1] == 1) {
- int format1 = _d.u16(4);
- int format2 = _d.u16(6);
- int f2_pos = PAIRVALUE_HEADERSIZE + GposValue::size(format1);
- int pairvalue_size = f2_pos + GposValue::size(format2);
- for (Coverage::iterator i = coverage().begin(); i; i++) {
- Data pairset = _d.offset_subtable(F1_HEADERSIZE + i.coverage_index()*F1_RECSIZE);
- int npair = pairset.u16(0);
- for (int j = 0; j < npair; j++) {
- Data pair = pairset.subtable(PAIRSET_HEADERSIZE + j*pairvalue_size);
- v.push_back(Positioning(Position(*i, format1, pair.subtable(PAIRVALUE_HEADERSIZE)),
- Position(pair.u16(0), format2, pair.subtable(f2_pos))));
- }
- }
- } else { // _d[1] == 2
- int format1 = _d.u16(4);
- int format2 = _d.u16(6);
- int f2_pos = GposValue::size(format1);
- int recsize = f2_pos + GposValue::size(format2);
- ClassDef class1(_d.offset_subtable(8));
- ClassDef class2(_d.offset_subtable(10));
- Coverage coverage = this->coverage();
- int nclass1 = _d.u16(12);
- int nclass2 = _d.u16(14);
- int offset = F2_HEADERSIZE;
- for (int c1 = 0; c1 < nclass1; c1++)
- for (int c2 = 0; c2 < nclass2; c2++, offset += recsize) {
- Position p1(format1, _d.subtable(offset));
- Position p2(format2, _d.subtable(offset + f2_pos));
- if (p1 || p2) {
- for (ClassDef::class_iterator c1i = class1.begin(c1, coverage); c1i; c1i++)
- for (ClassDef::class_iterator c2i = class2.begin(c2); c2i; c2i++)
- v.push_back(Positioning(Position(*c1i, p1), Position(*c2i, p2)));
- }
- }
- }
-}
-
-
-/**************************
- * Positioning *
- * *
- **************************/
-
-static void
-unparse_glyphid(StringAccum &sa, Glyph gid, const Vector<PermString> *gns)
-{
- if (!gns)
- gns = &debug_glyph_names;
- if (gid && gns && gns->size() > gid && (*gns)[gid])
- sa << (*gns)[gid];
- else
- sa << "g" << gid;
-}
-
-void
-Position::unparse(StringAccum &sa, const Vector<PermString> *gns) const
-{
- unparse_glyphid(sa, g, gns);
- if (placed())
- sa << '@' << pdx << ',' << pdy;
- sa << '+' << adx;
- if (ady)
- sa << '/' << ady;
-}
-
-String
-Position::unparse(const Vector<PermString> *gns) const
-{
- StringAccum sa;
- unparse(sa, gns);
- return sa.take_string();
-}
-
-bool
-Positioning::context_in(const Coverage &c) const
-{
- return (c.covers(_left.g) || !_left.g) && (!_right.g || c.covers(_right.g));
-}
-
-bool
-Positioning::context_in(const GlyphSet &gs) const
-{
- return (gs.covers(_left.g) || !_left.g) && (!_right.g || gs.covers(_right.g));
-}
-
-void
-Positioning::unparse(StringAccum &sa, const Vector<PermString> *gns) const
-{
- if (!*this)
- sa << "NULL[]";
- else if (is_single()) {
- sa << "SINGLE[";
- _left.unparse(sa, gns);
- sa << ']';
- } else if (is_pairkern()) {
- sa << "KERN[";
- unparse_glyphid(sa, _left.g, gns);
- sa << ' ';
- unparse_glyphid(sa, _right.g, gns);
- sa << "+" << _left.adx << ']';
- } else if (is_pair()) {
- sa << "PAIR[";
- _left.unparse(sa, gns);
- sa << ' ';
- _right.unparse(sa, gns);
- sa << ']';
- } else
- sa << "UNKNOWN[]";
-}
-
-String
-Positioning::unparse(const Vector<PermString> *gns) const
-{
- StringAccum sa;
- unparse(sa, gns);
- return sa.take_string();
-}
-
-}}
-
-#include <lcdf/vector.cc>
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfname.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfname.cc
deleted file mode 100644
index ee2151b92ca..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfname.cc
+++ /dev/null
@@ -1,194 +0,0 @@
-// -*- related-file-name: "../include/efont/otfname.hh" -*-
-
-/* otfname.{cc,hh} -- OpenType name table
- *
- * Copyright (c) 2003-2012 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/otfname.hh>
-#include <lcdf/error.hh>
-#include <lcdf/straccum.hh>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <algorithm>
-
-#define USHORT_AT(d) (Data::u16_aligned(d))
-
-namespace Efont { namespace OpenType {
-
-static const uint16_t mac_roman_encoding[] = {
- // 0x80-0x8F
- 0x00C4, 0x00C5, 0x00C7, 0x00C9, // Adieresis Aring Ccedilla Eacute
- 0x00D1, 0x00D6, 0x00DC, 0x00E1, // Ntilde Odieresis Udieresis aacute
- 0x00E0, 0x00E2, 0x00E4, 0x00E3, // agrave acircumflex adieresis atilde
- 0x00E5, 0x00E7, 0x00E9, 0x00E8, // aring ccedilla eacute egrave
- // 0x90-0x9F
- 0x00EA, 0x00EB, 0x00ED, 0x00EC, // ecircumflex edieresis iacute igrave
- 0x00EE, 0x00EF, 0x00F1, 0x00F3, // icircumflex idieresis ntilde oacute
- 0x00F2, 0x00F4, 0x00F6, 0x00F5, // ograve ocircumflex odieresis otilde
- 0x00FA, 0x00F9, 0x00FB, 0x00FC, // uacute ugrave ucircumflex udieresis
- // 0xA0-0xAF
- 0x2020, 0x00B0, 0x00A2, 0x00A3, // dagger degree cent sterling
- 0x00A7, 0x2022, 0x00B6, 0x00DF, // section bullet paragraph germandbls
- 0x00AE, 0x00A9, 0x2122, 0x00B4, // registered copyright trademark acute
- 0x00A8, 0x2260, 0x00C6, 0x00D8, // dieresis notequal AE Oslash
- // 0xB0-0xBF
- 0x221E, 0x00B1, 0x2264, 0x2265, // infinity plusminus lessequal greaterequal
- 0x00A5, 0x00B5, 0x2202, 0x2211, // yen mu partialdiff summation
- 0x220F, 0x03C0, 0x222B, 0x00AA, // product pi integral ordfeminine
- 0x00BA, 0x03A9, 0x00E6, 0x00F8, // ordmasculine Omegagreek ae oslash
- // 0xC0-0xCF
- 0x00BF, 0x00A1, 0x00AC, 0x221A, // questiondown exclamdown logicalnot radical
- 0x0192, 0x2248, 0x2206, 0x00AB, // florin approxequal increment guillemotleft
- 0x00BB, 0x2026, 0x00A0, 0x00C0, // guillemotright ellipsis nbspace Agrave
- 0x00C3, 0x00D5, 0x0152, 0x0153, // Atilde Otilde OE oe
- // 0xD0-0xDF
- 0x2013, 0x2014, 0x201C, 0x201D, // endash emdash quotedblleft quotedblright
- 0x2018, 0x2019, 0x00F7, 0x25CA, // quoteleft quoteright divide lozenge
- 0x00FF, 0x0178, 0x2044, 0x20AC, // ydieresis Ydieresis fraction Euro
- 0x2039, 0x203A, 0xFB01, 0xFB02, // guilsinglleft guilsinglright fi fl
- // 0xE0-0xEF
- 0x2021, 0x00B7, 0x201A, 0x201E, // daggerdbl middot quotesinglbase quotedblbase
- 0x2030, 0x00C2, 0x00CA, 0x00C1, // perthousand Acircumflex Ecircumflex Aacute
- 0x00CB, 0x00C8, 0x00CD, 0x00CE, // Edieresis Egrave Iacute Icircumflex
- 0x00CF, 0x00CC, 0x00D3, 0x00D4, // Idieresis Igrave Oacute Ocircumflex
- // 0xF0-0xFF
- 0xF8FF, 0x00D2, 0x00DA, 0x00DB, // apple Ograve Uacute Ucircumflex
- 0x00D9, 0x0131, 0x02C6, 0x02DC, // Ugrave dotlessi circumflex tilde
- 0x00AF, 0x02D8, 0x02D9, 0x02DA, // macron breve dotaccent ring
- 0x00B8, 0x02DD, 0x02DB, 0x02C7 // cedilla hungarumlaut ogonek caron
-};
-
-
-Name::Name(const String &s, ErrorHandler *errh)
- : _str(s) {
- _str.align(2);
- _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
-}
-
-int
-Name::parse_header(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // USHORT version
- // USHORT numTables
- int len = _str.length();
- const uint8_t *data = _str.udata();
- if (len == 0)
- return errh->error("font has no %<name%> table"), -EFAULT;
- if (HEADER_SIZE > len)
- return errh->error("%<name%> table too small"), -EFAULT;
- if (!(data[0] == '\000' && data[1] == '\000'))
- return errh->error("bad %<name%> version number"), -ERANGE;
- int count = USHORT_AT(data + 2);
- if (HEADER_SIZE + count*NAMEREC_SIZE > len)
- return errh->error("%<name%> table too small"), -EFAULT;
- return 0;
-}
-
-String
-Name::name(const_iterator i) const
-{
- if (i < end()) {
- int stringOffset = USHORT_AT(_str.udata() + 4);
- int length = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 8);
- int offset = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 10);
- if (stringOffset + offset + length <= _str.length())
- return _str.substring(stringOffset + offset, length);
- }
- return String();
-}
-
-String
-Name::utf8_name(const_iterator i) const
-{
- // This code can handle Microsoft Unicode BMP and Mac Roman encodings,
- // but that's it
- if (!(i < end()))
- return String();
- int stringOffset = USHORT_AT(_str.udata() + 4);
- int length = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 8);
- int offset = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 10);
- if (stringOffset + offset + length > _str.length())
- return String();
- const unsigned char *begins = _str.udata() + stringOffset + offset;
- const unsigned char *ends = begins + length;
- if (platform(*i) == P_MICROSOFT && encoding(*i) == E_MS_UNICODE_BMP) {
- StringAccum sa;
- for (const unsigned char *s = begins; s + 1 < ends; s += 2)
- sa.append_utf8(Data::u16(s));
- return sa.take_string();
- } else if (platform(*i) == P_MACINTOSH && encoding(*i) == E_MAC_ROMAN) {
- StringAccum sa;
- for (const unsigned char *s = begins; s < ends; s++)
- if (*s >= 0x80) {
- sa.append(begins, s);
- sa.append_utf8(mac_roman_encoding[*s & 0x7F]);
- begins = s + 1;
- }
- if (!sa)
- return _str.substring(begins, ends);
- else {
- sa.append(begins, ends);
- return sa.take_string();
- }
- } else
- return _str.substring(begins, ends);
-}
-
-String
-Name::english_name(int nameid) const
-{
- const_iterator end = this->end();
- const_iterator it = std::find_if(begin(), end, PlatformPred(nameid, P_MICROSOFT, E_MS_UNICODE_BMP, L_MS_ENGLISH_AMERICAN));
- if (it == end)
- it = std::find_if(begin(), end, PlatformPred(nameid, P_MACINTOSH, E_MAC_ROMAN, 0));
- return utf8_name(it);
-}
-
-bool
-Name::version_chaincontext_reverse_backtrack() const
-{
- String vstr = name(std::find_if(begin(), end(), PlatformPred(N_VERSION, 1, 0, 0)));
- const char *v = vstr.begin(), *endv = vstr.end();
- if (v + 20 <= endv) {
- if (v[0] != 'O' || v[1] != 'T' || v[2] != 'F' || v[3] == ';')
- goto try_core;
- for (v += 4; v < endv && *v != ';'; v++)
- /* do nothing */;
- if (v + 3 >= endv || v[1] != 'P' || v[2] != 'S' || v[3] == ';')
- goto try_core;
- for (v += 4; v < endv && *v != ';'; v++)
- /* do nothing */;
- if (v + 11 >= endv || memcmp(v + 1, "Core 1.0.", 9) != 0
- || (v[10] != '2' && v[10] != '3')
- || (v[11] < '0' || v[11] > '9'))
- goto try_core;
- return true;
- }
- try_core:
- v = vstr.begin();
- if (v + 16 > endv
- || v[0] != 'C' || v[1] != 'o' || v[2] != 'r' || v[3] != 'e')
- return false;
- for (v += 4; v < endv && *v != ';'; v++)
- /* do nothing */;
- if (v + 12 > endv || memcmp(v, ";makeotf.lib", 12) != 0)
- return false;
- return true;
-}
-
-} // namespace Efont::OpenType
-} // namespace Efont
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfpost.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfpost.cc
deleted file mode 100644
index 9027dd0510a..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfpost.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-// -*- related-file-name: "../include/efont/otfpost.hh" -*-
-
-/* otfpost.{cc,hh} -- OpenType post table
- *
- * Copyright (c) 2006-2012 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/otfpost.hh>
-#include <lcdf/error.hh>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <efont/otfdata.hh> // for ntohl()
-
-#define USHORT_AT(d) (Data::u16_aligned(d))
-#define SHORT_AT(d) (Data::s16_aligned(d))
-#define ULONG_AT(d) (Data::u32_aligned(d))
-#define LONG_AT(d) (Data::s32_aligned(d))
-
-namespace Efont { namespace OpenType {
-
-static const char * const mac_names[] = {
- ".notdef", ".null", "nonmarkingreturn", "space", // 0-3
- "exclam", "quotedbl", "numbersign", "dollar", // 4-7
- "percent", "ampersand", "quotesingle", "parenleft", // 8-11
- "parenright", "asterisk", "plus", "comma", // 12-15
- "hyphen", "period", "slash", "zero", // 16-19
- "one", "two", "three", "four", // 20-23
- "five", "six", "seven", "eight", // 24-27
- "nine", "colon", "semicolon", "less", // 28-31
- "equal", "greater", "question", "at", // 32-35
- "A", "B", "C", "D", // 36-39
- "E", "F", "G", "H", // 40-43
- "I", "J", "K", "L", // 44-47
- "M", "N", "O", "P", // 48-51
- "Q", "R", "S", "T", // 52-55
- "U", "V", "W", "X", // 56-59
- "Y", "Z", "bracketleft", "backslash", // 60-63
- "bracketright", "asciicircum", "underscore", "grave", // 64-67
- "a", "b", "c", "d", // 68-71
- "e", "f", "g", "h", // 72-75
- "i", "j", "k", "l", // 76-79
- "m", "n", "o", "p", // 80-83
- "q", "r", "s", "t", // 84-87
- "u", "v", "w", "x", // 88-91
- "y", "z", "braceleft", "bar", // 92-95
- "braceright", "asciitilde", "Adieresis", "Aring", // 96-99
- "Ccedilla", "Eacute", "Ntilde", "Odieresis", // 100-103
- "Udieresis", "aacute", "agrave", "acircumflex", // 104-107
- "adieresis", "atilde", "aring", "ccedilla", // 108-111
- "eacute", "egrave", "ecircumflex", "edieresis", // 112-115
- "iacute", "igrave", "icircumflex", "idieresis", // 116-119
- "ntilde", "oacute", "ograve", "ocircumflex", // 120-123
- "odieresis", "otilde", "uacute", "ugrave", // 124-127
- "ucircumflex", "udieresis", "dagger", "degree", // 128-131
- "cent", "sterling", "section", "bullet", // 132-135
- "paragraph", "germandbls", "registered", "copyright", // 136-139
- "trademark", "acute", "dieresis", "notequal", // 140-143
- "AE", "Oslash", "infinity", "plusminus", // 144-147
- "lessequal", "greaterequal", "yen", "mu", // 148-151
- "partialdiff", "summation", "product", "pi", // 152-155
- "integral", "ordfeminine", "ordmasculine", "Omega", // 156-159
- "ae", "oslash", "questiondown", "exclamdown", // 160-163
- "logicalnot", "radical", "florin", "approxequal", // 164-167
- "Delta", "guillemotleft", "guillemotright", "ellipsis", // 168-171
- "nonbreakingspace", "Agrave", "Atilde", "Otilde", // 172-175
- "OE", "oe", "endash", "emdash", // 176-179
- "quotedblleft", "quotedblright", "quoteleft", "quoteright", // 180-183
- "divide", "lozenge", "ydieresis", "Ydieresis", // 184-187
- "fraction", "currency", "guilsinglleft", "guilsinglright", // 188-191
- "fi", "fl", "daggerdbl", "periodcentered", // 192-195
- "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", // 196-199
- "Ecircumflex", "Aacute", "Edieresis", "Egrave", // 200-203
- "Iacute", "Icircumflex", "Idieresis", "Igrave", // 204-207
- "Oacute", "Ocircumflex", "apple", "Ograve", // 208-211
- "Uacute", "Ucircumflex", "Ugrave", "dotlessi", // 212-215
- "circumflex", "tilde", "macron", "breve", // 216-219
- "dotaccent", "ring", "cedilla", "hungarumlaut", // 220-223
- "ogonek", "caron", "Lslash", "lslash", // 224-227
- "Scaron", "scaron", "Zcaron", "zcaron", // 228-231
- "brokenbar", "Eth", "eth", "Yacute", // 232-235
- "yacute", "Thorn", "thorn", "minus", // 236-239
- "multiply", "onesuperior", "twosuperior", "threesuperior", // 240-243
- "onehalf", "onequarter", "threequarters", "franc", // 244-247
- "Gbreve", "gbreve", "Idotaccent", "Scedilla", // 248-251
- "scedilla", "Cacute", "cacute", "Ccaron", // 252-255
- "ccaron", "dcroat" // 256-257
-};
-
-
-Post::Post(const String &s, ErrorHandler *errh)
- : _str(s), _version(0)
-{
- _str.align_long();
- _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
-}
-
-int
-Post::parse_header(ErrorHandler *errh)
-{
- // HEADER FORMAT:
- // 0 FIXED version
- // 4 FIXED italicAngle
- // 8 FWORD underlinePosition
- // 10 FWORD underlineThickness
- // 12 ULONG isFixedPitch
- // 16 ULONG minMemType42
- // 20 ULONG maxMemType42
- // 24 ULONG minMemType1
- // 28 ULONG maxMemType1
- int len = _str.length();
- const uint8_t *data = _str.udata();
- if (HEADER_SIZE > len)
- return errh->error("OTF post table too small"), -EFAULT;
- _version = USHORT_AT(data); // ignore minor version number
- // except that version 2.5 isn't compatible
- if (_version < 1 || _version > 3
- || (_version == 2 && USHORT_AT(data + 2) == 0x5000))
- return errh->error("bad post version number"), -ERANGE;
- if (_version == 2) {
- // VERSION 2.0 GLYPH NAMES FORMAT:
- // 32 USHORT numberOfGlyphs
- // 34 USHORT glyphNameIndex[mumberOfGlyphs]
- // CHAR names[...]
- if (HEADER_SIZE + 2 > len
- || ((_nglyphs = USHORT_AT(data + HEADER_SIZE)),
- HEADER_SIZE + 2 + 2 * _nglyphs > len))
- return errh->error("OTF post table too small for glyph map"), -EFAULT;
- const uint8_t *gni = data + HEADER_SIZE + 2;
- const uint8_t *names = gni + 2 * _nglyphs;
- int next_name = N_MAC_GLYPHS, g;
- bool gni_error_reported = false;
- for (int i = 0; i < _nglyphs; i++, gni += 2)
- // Some fonts have more than 32768 glyphs. Although the 'post'
- // spec says name indexes 32768-65535 are reserved, some large
- // fonts treat those indexes as valid.
- if ((g = USHORT_AT(gni)) >= 32768 && g >= _nglyphs) {
- if (!gni_error_reported)
- errh->error("bad glyph name index in post");
- gni_error_reported = true;
- } else
- while (g >= next_name) {
- if (names - data > len
- || (names + 1 + names[0]) - data > len)
- return errh->error("OTF post too small for glyph names"), -EFAULT;
- _extend_glyph_names.push_back(names - data);
- names += 1 + names[0];
- next_name++;
- }
- } else if (_version == 1)
- _nglyphs = N_MAC_GLYPHS;
- else
- _nglyphs = -1;
-
- return 0;
-}
-
-double
-Post::italic_angle() const
-{
- if (error() < 0)
- return -1;
- return (double) LONG_AT(_str.udata() + 4) / 65536.;
-}
-
-bool
-Post::is_fixed_pitch() const
-{
- if (error() < 0)
- return false;
- return ULONG_AT(_str.udata() + 12) != 0;
-}
-
-bool
-Post::glyph_names(Vector<PermString> &gnames) const
-{
- gnames.clear();
- if (error() < 0)
- return false;
- if (_version == 1) {
- for (int i = 0; i < N_MAC_GLYPHS; i++)
- gnames.push_back(mac_names[i]);
- return true;
- } else if (_version == 2) {
- const uint8_t *data = _str.udata();
- const uint8_t *gni = data + HEADER_SIZE + 2;
- for (int i = 0; i < _nglyphs; i++, gni += 2) {
- int g = USHORT_AT(gni);
- if (g < N_MAC_GLYPHS)
- gnames.push_back(mac_names[g]);
- else {
- const uint8_t *n = data + _extend_glyph_names[g - N_MAC_GLYPHS];
- gnames.push_back(PermString((const char *) n + 1, *n));
- }
- }
- return true;
- } else
- return false;
-}
-
-}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1font.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1font.cc
deleted file mode 100644
index 19aacc3c985..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1font.cc
+++ /dev/null
@@ -1,916 +0,0 @@
-// -*- related-file-name: "../include/efont/t1font.hh" -*-
-
-/* t1font.{cc,hh} -- Type 1 font
- *
- * Copyright (c) 1998-2014 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/t1font.hh>
-#include <efont/t1item.hh>
-#include <efont/t1rw.hh>
-#include <efont/t1mm.hh>
-#include <lcdf/error.hh>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-namespace Efont {
-
-static PermString::Initializer initializer;
-static PermString lenIV_str = "lenIV";
-static PermString FontInfo_str = "FontInfo";
-
-Type1Font::Type1Font(PermString name)
- : CharstringProgram(1000),
- _cached_defs(false), _built(true), _font_name(name), _glyph_map(-1),
- _encoding(0), _cached_mmspace(0), _mmspace(0), _synthetic_item(0)
-{
- _dict = new HashMap<PermString, Type1Definition *>[dLast];
- for (int i = 0; i < dLast; i++) {
- _index[i] = -1;
- _dict_deltas[i] = 0;
- _dict[i].set_default_value((Type1Definition *)0);
- }
-}
-
-Type1Font::Type1Font(Type1Reader &reader)
- : CharstringProgram(1000),
- _cached_defs(false), _built(false), _glyph_map(-1), _encoding(0),
- _cached_mmspace(0), _mmspace(0), _synthetic_item(0)
-{
- _dict = new HashMap<PermString, Type1Definition *>[dLast];
- for (int i = 0; i < dLast; i++) {
- _index[i] = -1;
- _dict_deltas[i] = 0;
- _dict[i].set_default_value((Type1Definition *)0);
- }
- read(reader);
-}
-
-Type1Font::~Type1Font()
-{
- delete[] _dict;
- for (int i = 0; i < _items.size(); i++)
- delete _items[i];
- delete _mmspace;
- for (int i = 0; i < _subrs.size(); i++)
- delete _subrs[i];
- if (!_synthetic_item)
- for (int i = 0; i < _glyphs.size(); i++)
- delete _glyphs[i];
-}
-
-void
-Type1Font::set_item(int i, Type1Item *it)
-{
- delete _items[i];
- _items[i] = it;
-}
-
-static const char * const dict_starters[] = {
- "0 dict begin", "/FontInfo 0 dict dup begin", "dup /Private 0 dict dup begin", "/Blend 0 dict dup begin", 0, 0
-};
-
-void
-Type1Font::add_definition(int dict, Type1Definition *t1d)
-{
- if (_index[dict] < 0) {
- if (_built && dict_starters[dict])
- add_item(new Type1CopyItem(dict_starters[dict]));
- _index[dict] = _items.size();
- }
- add_item(t1d);
- set_dict(dict, t1d->name(), t1d);
-}
-
-void
-Type1Font::add_type1_encoding(Type1Encoding *e)
-{
- if (_encoding) {
- for (Type1Item** t1i = _items.begin(); t1i < _items.end(); t1i++)
- if (*t1i == _encoding) {
- delete _encoding;
- *t1i = _encoding = e;
- return;
- }
- }
- _encoding = e;
- add_item(e);
-}
-
-void
-Type1Font::add_glyph(Type1Subr *s)
-{
- int &g = _glyph_map.find_force(s->name(), _glyphs.size());
- if (g == _glyphs.size())
- _glyphs.push_back(s);
- else {
- delete _glyphs[g];
- _glyphs[g] = s;
- }
-}
-
-int
-Type1Font::read(Type1Reader &reader)
-{
- Dict cur_dict = dFont;
- int eexec_state = 0;
- bool have_subrs = false;
- bool have_charstrings = false;
- int lenIV = 4;
- Type1SubrGroupItem *cur_group = 0;
- int cur_group_count = 0;
-
- StringAccum accum;
- while (reader.next_line(accum)) {
-
- // check for NULL STRING
- int x_length = accum.length();
- if (!x_length)
- continue;
- const char *x = accum.c_str(); // ensure we don't run off the string
-
- // check for CHARSTRINGS
- if (reader.was_charstring()) {
- Type1Subr *fcs = Type1Subr::make(x, x_length, reader.charstring_start(), reader.charstring_length(), lenIV);
-
- if (fcs->is_subr()) {
- if (fcs->subrno() >= _subrs.size())
- _subrs.resize(fcs->subrno() + 30, (Type1Subr *)0);
- if (_subrs[fcs->subrno()]) // hybrid font program
- delete _subrs[fcs->subrno()];
- _subrs[fcs->subrno()] = fcs;
- if (!have_subrs && _items.size()) {
- if (Type1CopyItem *item = _items.back()->cast_copy()) {
- cur_group = new Type1SubrGroupItem
- (this, true, item->value());
- cur_group_count = 0;
- _items.back() = cur_group;
- delete item;
- }
- have_subrs = true;
- }
-
- } else {
- add_glyph(fcs);
- if (!have_charstrings && _items.size()) {
- if (Type1CopyItem *item = _items.back()->cast_copy()) {
- cur_group = new Type1SubrGroupItem
- (this, false, item->value());
- cur_group_count = 0;
- _items.back() = cur_group;
- delete item;
- }
- have_charstrings = true;
- }
- }
-
- accum.clear();
- continue;
- }
-
- // check for COMMENTS
- if (x[0] == '%') {
- add_item(new Type1CopyItem(accum.take_string()));
- continue;
- }
-
- // check for CHARSTRING START
- // 5/29/1999: beware of charstring start-like things that don't have
- // `readstring' in them!
- if (!_charstring_definer
- && strstr(x, "string currentfile") != 0
- && strstr(x, "readstring") != 0) {
- const char *sb = x;
- while (*sb && *sb != '/')
- sb++;
- const char *se = sb + 1;
- while (*sb && *se && *se != ' ' && *se != '{')
- se++;
- if (*sb && *se) {
- _charstring_definer = permprintf(" %*s ", se - sb - 1, sb + 1);
- reader.set_charstring_definer(_charstring_definer);
- add_item(new Type1CopyItem(accum.take_string()));
- continue;
- }
- }
-
- // check for ENCODING
- if (!_encoding && strncmp(x, "/Encoding ", 10) == 0) {
- read_encoding(reader, x + 10);
- accum.clear();
- continue;
- }
-
- // check for a DEFINITION
- if (x[0] == '/') {
- definition_succeed:
- Type1Definition *t1d = Type1Definition::make(accum, &reader);
- if (!t1d)
- goto definition_fail;
- if (t1d->name() == lenIV_str)
- t1d->value_int(lenIV);
- add_definition(cur_dict, t1d);
- accum.clear();
- continue;
- } else if (x[0] == ' ') {
- const char *y;
- for (y = x; y[0] == ' '; y++)
- ;
- if (y[0] == '/')
- goto definition_succeed;
- }
-
- definition_fail:
-
- // check for ZEROS special case
- if (eexec_state == 2) {
- // In eexec_state 2 (right after turning off eexec), the opening
- // part of the string will have some 0 bytes followed by '0's.
- // Change the 0 bytes into textual '0's.
- int zeros = 0;
- while (x[zeros] == 0 && x_length > 0)
- zeros++, x_length--;
- add_item(new Type1CopyItem(String::make_fill('0', zeros * 2 + x_length)));
- eexec_state = 3;
- accum.clear();
- continue;
- }
-
- // check for MODIFIED FONT
- if (eexec_state == 1 && strstr(x, "FontDirectory") != 0
- && read_synthetic_font(reader, x, accum)) {
- accum.clear();
- continue;
- }
-
- // check for END-OF-CHARSTRING-GROUP TEXT
- if (cur_group) {
- if (cur_group_count == 0
- || ((strstr(x, "end") != 0 || strstr(x, "put") != 0)
- && strchr(x, '/') == 0)) {
- cur_group->add_end_text(x);
- cur_group_count++;
- accum.clear();
- continue;
- }
- cur_group = 0;
- }
-
- // add COPY ITEM
- String s = accum.take_string();
- add_item(new Type1CopyItem(s));
- x = s.data();
-
- if (eexec_state == 0 && strncmp(x, "currentfile eexec", 17) == 0 && (isspace((unsigned char) x[17]) || !x[17])) {
- // allow arbitrary whitespace after "currentfile eexec".
- // note: strlen("currentfile eexec") == 17
- for (x += 17; isspace((unsigned char) *x); x++)
- /* nada */;
- reader.switch_eexec(true, (unsigned char *)x, (s.data() + s.length()) - x);
- set_item(nitems() - 1, new Type1EexecItem(true));
- eexec_state = 1;
- } else if (eexec_state == 1 && strstr(x, "currentfile closefile") != 0) {
- reader.switch_eexec(false, 0, 0);
- add_item(new Type1EexecItem(false));
- eexec_state = 2;
- } else if (strstr(x, "begin") != 0) {
- // 30.Sep.2002: NuevaMM's BlendFontInfo dict starts with a simple
- // "/FontInfo ... begin" inside a "/Blend ... begin".
- Dict was_dict = cur_dict;
- if (strstr(x, "/Private") != 0)
- cur_dict = dPrivate;
- else if (strstr(x, "/FontInfo") != 0)
- cur_dict = dFontInfo;
- else
- cur_dict = dFont;
- if (strstr(x, "/Blend") != 0)
- cur_dict = (Dict)(cur_dict + dBlend);
- else if (was_dict == dBlend && cur_dict == dFontInfo)
- cur_dict = (Dict)(cur_dict + dBlend);
- } else if (cur_dict == dFontInfo && strstr(x, "end") != 0)
- cur_dict = dFont;
- }
-
- // set dictionary deltas
- for (int i = dFI; i < dLast; i++)
- _dict_deltas[i] = get_dict_size(i) - _dict[i].size();
- // borrow glyphs and glyph map from _synthetic_item
- if (!_glyphs.size() && _synthetic_item) {
- _glyphs = _synthetic_item->included_font()->_glyphs;
- _glyph_map = _synthetic_item->included_font()->_glyph_map;
- }
-
- return (ok() ? 0 : -1);
-}
-
-bool
-Type1Font::ok() const
-{
- return font_name() && _glyphs.size() > 0;
-}
-
-static char *skip_comment_space(char *s)
-{
- while (1) {
- if (isspace((unsigned char) *s))
- ++s;
- else if (*s == '%') {
- for (++s; *s != '\r' && *s != '\n' && *s != '\0'; ++s)
- /* nada */;
- } else
- return s;
- }
-}
-
-void
-Type1Font::read_encoding(Type1Reader &reader, const char *first_line)
-{
- while (isspace((unsigned char) *first_line))
- first_line++;
- if (strncmp(first_line, "StandardEncoding", 16) == 0) {
- add_type1_encoding(Type1Encoding::standard_encoding());
- return;
- }
-
- add_type1_encoding(new Type1Encoding);
-
- bool got_any = false;
- StringAccum accum;
-
- while (reader.next_line(accum)) {
-
- // check for NULL STRING
- if (!accum.length())
- continue;
- accum.append('\0'); // ensure we don't run off the string
- char *pos = accum.data();
-
- // skip to first `dup' token
- if (!got_any) {
- if (!(pos = strstr(pos, "dup"))) {
- pos = accum.data();
- goto check_done;
- }
- }
-
- // parse as many `dup INDEX */CHARNAME put' as there are in the line
- while (1) {
- // skip spaces, look for `dup '
- while (isspace((unsigned char) pos[0]))
- ++pos;
- if (pos[0] == '%')
- pos = skip_comment_space(pos);
- if (pos[0] != 'd' || pos[1] != 'u' || pos[2] != 'p' || !isspace((unsigned char) pos[3]))
- break;
-
- // look for `INDEX */'
- char *scan;
- int char_value = strtol(pos + 4, &scan, 10);
- if (scan[0] == '#' && char_value > 0 && char_value < 37
- && isalnum((unsigned char) scan[1]))
- char_value = strtol(scan + 1, &scan, char_value);
- while (isspace((unsigned char) scan[0]))
- scan++;
- if (char_value < 0 || char_value >= 256 || scan[0] != '/')
- break;
-
- // look for `CHARNAME put'
- scan++;
- char *name_pos = scan;
- while (!isspace((unsigned char) scan[0]) && scan[0] != '\0')
- ++scan;
- char *name_end = scan;
- while (isspace((unsigned char) scan[0]))
- ++scan;
- if (scan[0] != 'p' || scan[1] != 'u' || scan[2] != 't')
- break;
-
- _encoding->put(char_value, PermString(name_pos, name_end - name_pos));
- got_any = true;
- pos = scan + 3;
- }
-
- check_done:
- // check for end of encoding section
- // if not over, add COPY ITEM for leftovers we didn't parse
- if ((strstr(pos, "readonly") != 0 || strstr(pos, "def") != 0)
- && (got_any || strstr(pos, "for") == 0)) {
- _encoding->set_definer(String(pos));
- return;
- } else if (got_any && *pos)
- add_item(new Type1CopyItem(String(pos)));
-
- accum.clear();
- }
-}
-
-static bool
-read_synthetic_string(Type1Reader &reader, StringAccum &wrong_accum,
- const char *format, int *value)
-{
- StringAccum accum;
- if (!reader.next_line(accum))
- return false;
- wrong_accum << accum;
- accum.append('\0'); // ensure we don't run off the string
- int n = 0;
- if (value)
- sscanf(accum.data(), format, value, &n);
- else
- sscanf(accum.data(), format, &n);
- return (n != 0 && (isspace((unsigned char) accum[n]) || accum[n] == '\0'));
-}
-
-bool
-Type1Font::read_synthetic_font(Type1Reader &reader, const char *first_line,
- StringAccum &wrong_accum)
-{
- // read font name
- PermString font_name;
- {
- char *x = new char[strlen(first_line) + 1];
- int n = 0;
- sscanf(first_line, "FontDirectory /%[^] \t\r\n[{}/] known {%n", x, &n);
- if (n && (isspace((unsigned char) first_line[n]) || first_line[n] == 0))
- font_name = x;
- delete[] x;
- if (!font_name)
- return false;
- }
-
- // check UniqueID
- int unique_id;
- {
- StringAccum accum;
- if (!reader.next_line(accum))
- return false;
- wrong_accum << accum;
- accum.c_str(); // ensure we don't run off the string
- const char *y = accum.data();
- if (*y != '/' || strncmp(y + 1, font_name.c_str(), font_name.length()) != 0)
- return false;
- int n = 0;
- sscanf(y + font_name.length() + 1, " findfont%n", &n);
- y = strstr(y, "/UniqueID get ");
- if (n == 0 || y == 0)
- return false;
- n = 0;
- sscanf(y + 14, "%d%n", &unique_id, &n);
- if (n == 0)
- return false;
- }
-
- // check lines that say how much text
- int multiplier;
- if (!read_synthetic_string(reader, wrong_accum, "save userdict /fbufstr %d string put%n", &multiplier))
- return false;
-
- int multiplicand;
- if (!read_synthetic_string(reader, wrong_accum, "%d {currentfile fbufstr readstring { pop } { clear currentfile%n", &multiplicand))
- return false;
-
- if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse } repeat%n", 0))
- return false;
-
- int extra;
- if (!read_synthetic_string(reader, wrong_accum, "currentfile %d string readstring { pop } { clear currentfile%n", &extra))
- return false;
-
- if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse%n", 0))
- return false;
-
- if (!read_synthetic_string(reader, wrong_accum, "restore } if } if%n", 0))
- return false;
-
- Type1SubsetReader subreader(&reader, multiplier*multiplicand + extra);
- Type1Font *synthetic = new Type1Font(subreader);
- if (!synthetic->ok())
- delete synthetic;
- else {
- _synthetic_item = new Type1IncludedFont(synthetic, unique_id);
- add_item(_synthetic_item);
- }
- return true;
-}
-
-
-void
-Type1Font::undo_synthetic()
-{
- // A synthetic font doesn't share arbitrary code with its base font; it
- // shares just the CharStrings dictionary, according to Adobe Type 1 Font
- // Format. We take advantage of this.
-
- if (!_synthetic_item)
- return;
-
- int mod_ii;
- for (mod_ii = nitems() - 1; mod_ii >= 0; mod_ii--)
- if (_items[mod_ii] == _synthetic_item)
- break;
- if (mod_ii < 0)
- return;
-
- // remove synthetic item and the reference to the included font
- _items[mod_ii] = new Type1NullItem;
- if (Type1CopyItem *copy = _items[mod_ii+1]->cast_copy())
- if (copy->value().find_left("findfont") >= 0) {
- delete copy;
- _items[mod_ii+1] = new Type1NullItem;
- }
-
- Type1Font *f = _synthetic_item->included_font();
- // its glyphs are already stored in our _glyphs array
-
- // copy SubrGroupItem from `f' into `this'
- Type1SubrGroupItem *oth_subrs = 0, *oth_glyphs = 0;
- for (int i = 0; i < f->nitems(); i++)
- if (Type1SubrGroupItem *subr_grp = f->_items[i]->cast_subr_group()) {
- if (subr_grp->is_subrs())
- oth_subrs = subr_grp;
- else
- oth_glyphs = subr_grp;
- }
-
- assert(oth_glyphs != 0);
-
- for (int i = nitems() - 1; i >= 0; i--)
- if (Type1SubrGroupItem *subr_grp = _items[i]->cast_subr_group()) {
- assert(subr_grp->is_subrs());
- if (oth_subrs)
- subr_grp->set_end_text(oth_subrs->end_text());
- shift_indices(i + 1, 1);
- Type1SubrGroupItem *nsubr = new Type1SubrGroupItem(*oth_glyphs, this);
- _items[i + 1] = nsubr;
- break;
- }
-
- // delete included font
- f->_glyphs.clear(); // don't delete glyphs; we've stolen them
- delete _synthetic_item;
- _synthetic_item = 0;
-}
-
-
-Type1Charstring *
-Type1Font::subr(int e) const
-{
- if (e >= 0 && e < _subrs.size() && _subrs[e])
- return &_subrs[e]->t1cs();
- else
- return 0;
-}
-
-PermString
-Type1Font::glyph_name(int i) const
-{
- if (i >= 0 && i < _glyphs.size() && _glyphs[i])
- return _glyphs[i]->name();
- else
- return PermString();
-}
-
-Type1Charstring *
-Type1Font::glyph(int i) const
-{
- if (i >= 0 && i < _glyphs.size() && _glyphs[i])
- return &_glyphs[i]->t1cs();
- else
- return 0;
-}
-
-Type1Charstring *
-Type1Font::glyph(PermString name) const
-{
- int i = _glyph_map[name];
- if (i >= 0)
- return &_glyphs[i]->t1cs();
- else
- return 0;
-}
-
-
-bool
-Type1Font::set_subr(int e, const Type1Charstring &t1cs, PermString definer)
-{
- if (e < 0)
- return false;
- if (e >= _subrs.size())
- _subrs.resize(e + 1, (Type1Subr *)0);
-
- if (!definer) {
- Type1Subr *pattern_subr = _subrs[e];
- for (int i = 0; i < _subrs.size() && !pattern_subr; i++)
- pattern_subr = _subrs[i];
- if (!pattern_subr)
- return false;
- definer = pattern_subr->definer();
- }
-
- delete _subrs[e];
- _subrs[e] = Type1Subr::make_subr(e, t1cs, definer);
- return true;
-}
-
-bool
-Type1Font::remove_subr(int e)
-{
- if (e < 0 || e >= _subrs.size())
- return false;
- delete _subrs[e];
- _subrs[e] = 0;
- return true;
-}
-
-void
-Type1Font::fill_in_subrs()
-{
- while (_subrs.size() && _subrs.back() == 0)
- _subrs.pop_back();
- for (int i = 0; i < _subrs.size(); i++)
- if (!_subrs[i])
- set_subr(i, Type1Charstring(String::make_stable("\013", 1)));
-}
-
-void
-Type1Font::renumber_subrs(const Vector<int> &renumbering)
-{
- Vector<Type1Subr *> old_subrs;
- old_subrs.swap(_subrs);
- for (int i = 0; i < old_subrs.size() && i < renumbering.size(); i++) {
- int r = renumbering[i];
- Type1Subr *s = old_subrs[i];
- if (r >= 0 && s)
- set_subr(r, s->t1cs(), s->definer());
- else
- delete s;
- }
- for (int i = renumbering.size(); i < old_subrs.size(); i++)
- delete old_subrs[i];
-}
-
-
-void
-Type1Font::shift_indices(int move_index, int delta)
-{
- if (delta > 0) {
- _items.resize(_items.size() + delta, (Type1Item *)0);
- memmove(&_items[move_index + delta], &_items[move_index],
- sizeof(Type1Item *) * (_items.size() - move_index - delta));
-
- for (int i = dFont; i < dLast; i++)
- if (_index[i] > move_index)
- _index[i] += delta;
-
- } else {
- memmove(&_items[move_index], &_items[move_index - delta],
- sizeof(Type1Item *) * (_items.size() - (move_index - delta)));
- _items.resize(_items.size() + delta);
-
- for (int i = dFont; i < dLast; i++)
- if (_index[i] >= move_index) {
- if (_index[i] < move_index - delta)
- _index[i] = move_index;
- else
- _index[i] += delta;
- }
- }
-}
-
-Type1Definition *
-Type1Font::ensure(Dict dict, PermString name)
-{
- assert(_index[dict] >= 0);
- Type1Definition *def = _dict[dict][name];
- if (!def) {
- def = new Type1Definition(name, 0, "def");
- int move_index = _index[dict];
- shift_indices(move_index, 1);
- _items[move_index] = def;
- set_dict(dict, name, def);
- }
- return def;
-}
-
-void
-Type1Font::add_header_comment(const String &comment)
-{
- int i;
- for (i = 0; i < _items.size(); i++) {
- Type1CopyItem *copy = _items[i]->cast_copy();
- if (!copy || copy->value()[0] != '%')
- break;
- }
- shift_indices(i, 1);
- _items[i] = new Type1CopyItem(comment);
-}
-
-
-Type1Item *
-Type1Font::dict_size_item(int d) const
-{
- switch (d) {
-
- case dF:
- if (_built && _index[d] > 0)
- return _items[_index[d] - 1];
- break;
-
- case dFI: case dP: case dB:
- if (_index[d] > 0)
- return _items[_index[d] - 1];
- break;
-
- case dBFI:
- if (Type1Item *t1i = b_dict("FontInfo"))
- return t1i;
- else if (_index[dBFI] > 0)
- return _items[_index[dBFI] - 1];
- break;
-
- case dBP:
- if (Type1Item *t1i = b_dict("Private"))
- return t1i;
- else if (_index[dBP] > 0)
- return _items[_index[dBP] - 1];
- break;
-
- }
- return 0;
-}
-
-int
-Type1Font::get_dict_size(int d) const
-{
- Type1Item *item = dict_size_item(d);
- if (!item)
- /* nada */;
- else if (Type1Definition *t1d = item->cast_definition()) {
- int num;
- if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num))
- return num;
- } else if (Type1CopyItem *copy = item->cast_copy()) {
- String value = copy->value();
- int pos = value.find_left(" dict");
- if (pos >= 1 && isdigit((unsigned char) value[pos - 1])) {
- while (pos >= 1 && isdigit((unsigned char) value[pos - 1]))
- pos--;
- return strtol(value.data() + pos, 0, 10);
- }
- }
- return -1;
-}
-
-void
-Type1Font::set_dict_size(int d, int size)
-{
- Type1Item *item = dict_size_item(d);
- if (!item)
- return;
- if (Type1Definition *t1d = item->cast_definition()) {
- int num;
- if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num))
- t1d->set_int(size);
- } else if (Type1CopyItem *copy = item->cast_copy()) {
- String value = copy->value();
- int pos = value.find_left(" dict");
- if (pos >= 1 && isdigit((unsigned char) value[pos - 1])) {
- int numpos = pos - 1;
- while (numpos >= 1 && isdigit((unsigned char) value[numpos - 1]))
- numpos--;
- StringAccum accum;
- accum << value.substring(0, numpos) << size << value.substring(pos);
- copy->set_value(accum.take_string());
- }
- }
-}
-
-void
-Type1Font::write(Type1Writer &w)
-{
- Type1Definition *lenIV_def = p_dict("lenIV");
- int lenIV = 4;
- if (lenIV_def)
- lenIV_def->value_int(lenIV);
- w.set_charstring_start(_charstring_definer);
- w.set_lenIV(lenIV);
-
- // change dict sizes
- for (int i = dF; i < dLast; i++)
- set_dict_size(i, _dict[i].size() + _dict_deltas[i]);
- // XXX what if dict had nothing, but now has something?
-
- for (int i = 0; i < _items.size(); i++)
- _items[i]->gen(w);
-
- w.flush();
-}
-
-void
-Type1Font::cache_defs() const
-{
- Type1Definition *t1d = dict("FontName");
- if (t1d)
- t1d->value_name(_font_name);
- _cached_defs = true;
-}
-
-MultipleMasterSpace *
-Type1Font::mmspace() const
-{
- if (!_cached_mmspace)
- create_mmspace();
- return _mmspace;
-}
-
-MultipleMasterSpace *
-Type1Font::create_mmspace(ErrorHandler *errh) const
-{
- if (_cached_mmspace)
- return _mmspace;
- _cached_mmspace = 1;
-
- Type1Definition *t1d;
-
- Vector< Vector<double> > master_positions;
- t1d = fi_dict("BlendDesignPositions");
- if (!t1d || !t1d->value_numvec_vec(master_positions))
- return 0;
-
- int nmasters = master_positions.size();
- if (nmasters <= 0) {
- errh->error("bad BlendDesignPositions");
- return 0;
- }
- int naxes = master_positions[0].size();
- _mmspace = new MultipleMasterSpace(font_name(), naxes, nmasters);
- _mmspace->set_master_positions(master_positions);
-
- Vector< Vector<double> > normalize_in, normalize_out;
- t1d = fi_dict("BlendDesignMap");
- if (t1d && t1d->value_normalize(normalize_in, normalize_out))
- _mmspace->set_normalize(normalize_in, normalize_out);
-
- Vector<PermString> axis_types;
- t1d = fi_dict("BlendAxisTypes");
- if (t1d && t1d->value_namevec(axis_types) && axis_types.size() == naxes)
- for (int a = 0; a < naxes; a++)
- _mmspace->set_axis_type(a, axis_types[a]);
-
- int ndv, cdv;
- Type1Charstring *cs;
- t1d = p_dict("NDV");
- if (t1d && t1d->value_int(ndv) && (cs = subr(ndv)))
- _mmspace->set_ndv(*cs);
- t1d = p_dict("CDV");
- if (t1d && t1d->value_int(cdv) && (cs = subr(cdv)))
- _mmspace->set_cdv(*cs);
-
- Vector<double> design_vector;
- t1d = dict("DesignVector");
- if (t1d && t1d->value_numvec(design_vector))
- _mmspace->set_design_vector(design_vector);
-
- Vector<double> weight_vector;
- t1d = dict("WeightVector");
- if (t1d && t1d->value_numvec(weight_vector))
- _mmspace->set_weight_vector(weight_vector);
-
- if (!_mmspace->check(errh)) {
- delete _mmspace;
- _mmspace = 0;
- }
- return _mmspace;
-}
-
-void
-Type1Font::uncache_defs()
-{
- _cached_defs = false;
-}
-
-void
-Type1Font::font_matrix(double matrix[6]) const
-{
- Vector<double> t1d_matrix;
- Type1Definition *t1d = dict("FontMatrix");
- if (t1d && t1d->value_numvec(t1d_matrix) && t1d_matrix.size() == 6)
- memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
- else {
- matrix[0] = matrix[3] = 0.001;
- matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
- }
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1interp.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1interp.cc
deleted file mode 100644
index 724fcfe7386..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1interp.cc
+++ /dev/null
@@ -1,1377 +0,0 @@
-// -*- related-file-name: "../include/efont/t1interp.hh" -*-
-
-/* t1interp.{cc,hh} -- Type 1/2 charstring interpretation
- *
- * Copyright (c) 1998-2014 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/t1interp.hh>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#ifdef WIN32
-# define random() rand()
-#endif
-
-#define CHECK_STACK(numargs) do { if (size() < numargs) return error(errUnderflow, cmd); } while (0)
-#define CHECK_STATE() do { if (_state < S_IPATH) return error(errOrdering, cmd); } while (0)
-#define CHECK_PATH_START() do { _state = S_PATH; } while (0)
-#define CHECK_PATH_END() do { if (_state == S_PATH) { act_closepath(cmd); } _state = S_IPATH; } while (0)
-
-#ifndef static_assert
-# define static_assert(c, msg) switch ((int) (c)) case 0: case (c):
-#endif
-
-namespace Efont {
-
-static const char * const error_formats[] = {
- "charstring OK", // errOK
- "charstring internal error in '%C'", // errInternal
- "charstring commands past end", // errRunoff
- "charstring command '%C' unimplemented", // errUnimplemented
- "charstring stack overflow", // errOverflow
- "charstring stack underflow in '%C'", // errUnderflow
- "charstring bad vector operation in '%C'", // errVector
- "charstring bad value in '%C'", // errValue
- "charstring bad subroutine number %d", // errSubr
- "charstring bad glyph number '%d'", // errGlyph
- "charstring no current point in '%C'", // errCurrentPoint
- "charstring flex error", // errFlex
- "charstring multiple master error in '%C'", // errMultipleMaster
- "charstring open stroke", // errOpenStroke
- "charstring late sidebearing command '%C'", // errLateSidebearing
- "charstring bad othersubr number %d", // errOthersubr
- "charstring ordering constraints violated at '%C'", // errOrdering
- "charstring inappropriate hintmask", // errHintmask
- "charstring subrs nested too deep at '%d'" // errSubrDepth
-};
-
-double CharstringInterp::double_for_error;
-
-
-CharstringInterp::CharstringInterp()
- : _error(errOK), _careful(false), _sp(0), _ps_sp(0),
- _scratch_vector(SCRATCH_SIZE, 0), _program(0)
-{
-}
-
-CharstringInterp::CharstringInterp(const Vector<double> &weight_vector)
- : _error(errOK), _careful(false), _sp(0), _ps_sp(0),
- _weight_vector(weight_vector),
- _scratch_vector(SCRATCH_SIZE, 0), _program(0)
-{
-}
-
-void
-CharstringInterp::initialize()
-{
- clear();
- ps_clear();
- _lsb = _cp = _seac_origin = Point(0, 0);
- _state = S_INITIAL;
- _flex = false;
- _t2nhints = 0;
- _subr_depth = 0;
- _done = false;
- _error = errOK;
-}
-
-bool
-CharstringInterp::interpret(const CharstringProgram *program, const Charstring *cs)
-{
- if (cs) {
- initialize();
- _program = program;
- cs->process(*this);
- return _error == errOK;
- } else
- return error(errGlyph, 0);
-}
-
-bool
-CharstringInterp::error(int err, int error_data)
-{
- _error = err;
- _error_data = error_data;
- return false;
-}
-
-String
-CharstringInterp::error_string(int error, int error_data)
-{
- static_assert(-errLastError == (sizeof(error_formats) / sizeof(error_formats[0])) - 1,
- "errLastError defined incorrectly");
- if (error >= 0)
- return error_formats[0];
- else if (error < errLastError)
- return "charstring unknown error number " + String(error);
- String format = error_formats[-error];
- int percent = format.find_left('%');
- if (percent >= 0 && format[percent + 1] == 'C')
- return format.substring(0, percent) + Charstring::command_name(error_data) + format.substring(percent + 2);
- else if (percent >= 0 && format[percent + 1] == 'd')
- return format.substring(0, percent) + String(error_data) + format.substring(percent + 2);
- else
- return format;
-}
-
-bool
-CharstringInterp::number(double v)
-{
- push(v);
- return true;
-}
-
-void
-CharstringInterp::fetch_weight_vector()
-{
- if (_program)
- if (Vector<double> *wv = _program->mm_vector(CharstringProgram::VEC_WEIGHT, false))
- _weight_vector = *wv;
-}
-
-bool
-CharstringInterp::vector_command(int cmd)
-{
- CharstringProgram::VectorType which_vector;
- int vectoroff, offset, num, i;
- Vector<double> *v = 0;
-
- switch (cmd) {
-
- case Cs::cPut:
- CHECK_STACK(2);
- offset = (int)top(0);
- vec(&_scratch_vector, offset) = top(1);
- pop(2);
- break;
-
- case Cs::cGet:
- CHECK_STACK(1);
- offset = (int)top();
- top() = vec(&_scratch_vector, offset);
- break;
-
- case Cs::cStore:
- CHECK_STACK(4);
- which_vector = (CharstringProgram::VectorType)((int)top(3));
- vectoroff = (int)top(2);
- offset = (int)top(1);
- num = (int)top(0);
- pop(4);
-
- if (!_program)
- return error(errVector, cmd);
- v = _program->mm_vector(which_vector, true);
- if (!v)
- return error(errVector, cmd);
-
- for (i = 0; i < num; i++, offset++, vectoroff++)
- vec(v, vectoroff) = vec(&_scratch_vector, offset);
- // erase our weight vector if the global weight vector has changed
- if (which_vector == CharstringProgram::VEC_WEIGHT)
- _weight_vector.clear();
- break;
-
- case Cs::cLoad:
- CHECK_STACK(3);
- which_vector = (CharstringProgram::VectorType)((int)top(2));
- offset = (int)top(1);
- num = (int)top(0);
- pop(3);
-
- if (!_program)
- return error(errVector, cmd);
- v = _program->mm_vector(which_vector, false);
- // use our weight vector if appropriate
- if (!v && which_vector == CharstringProgram::VEC_WEIGHT && _weight_vector.size())
- v = &_weight_vector;
- if (!v)
- return error(errVector, cmd);
-
- for (i = 0; i < num; i++, offset++)
- vec(&_scratch_vector, offset) = vec(v, i);
- break;
-
- default:
- return error(errUnimplemented, cmd);
-
- }
-
- return true;
-}
-
-bool
-CharstringInterp::blend_command()
-{
- const int cmd = Cs::cBlend;
- CHECK_STACK(1);
- int nargs = (int)pop();
-
- ensure_weight_vector();
- if (!_weight_vector.size())
- return error(errVector, cmd);
-
- int nmasters = _weight_vector.size();
- CHECK_STACK(nargs * nmasters);
-
- int base = _sp - nargs * nmasters;
- int off = base + nargs;
- for (int j = 0; j < nargs; j++) {
- double &val = _s[base + j];
- for (int i = 1; i < nmasters; i++, off++)
- val += _weight_vector.at_u(i) * _s[off];
- }
-
- pop(nargs * (nmasters - 1));
- return true;
-}
-
-bool
-CharstringInterp::roll_command()
-{
- const int cmd = Cs::cRoll;
- CHECK_STACK(2);
- int amount = (int)pop();
- int n = (int)pop();
- if (n <= 0)
- return error(errValue, cmd);
- CHECK_STACK(n);
-
- int base = _sp - n;
- while (amount < 0)
- amount += n;
-
- int i;
- double copy_stack[STACK_SIZE];
- for (i = 0; i < n; i++)
- copy_stack[i] = _s[ base + (i+amount) % n ];
- for (i = 0; i < n; i++)
- _s[base + i] = copy_stack[i];
-
- return true;
-}
-
-bool
-CharstringInterp::arith_command(int cmd)
-{
- int i;
- double d;
-
- switch (cmd) {
-
- case Cs::cBlend:
- return blend_command();
-
- case Cs::cAbs:
- CHECK_STACK(1);
- if (top() < 0)
- top() = -top();
- break;
-
- case Cs::cAdd:
- CHECK_STACK(1);
- d = pop();
- top() += d;
- break;
-
- case Cs::cSub:
- CHECK_STACK(1);
- d = pop();
- top() -= d;
- break;
-
- case Cs::cDiv:
- CHECK_STACK(2);
- d = pop();
- top() /= d;
- break;
-
- case Cs::cNeg:
- CHECK_STACK(1);
- top() = -top();
- break;
-
- case Cs::cRandom: {
- double d;
- do {
- d = random() / ((double)RAND_MAX);
- } while (d == 0);
- push(d);
- break;
- }
-
- case Cs::cMul:
- CHECK_STACK(2);
- d = pop();
- top() *= d;
- break;
-
- case Cs::cSqrt:
- CHECK_STACK(1);
- if (top() < 0)
- return error(errValue, cmd);
- top() = sqrt(top());
- break;
-
- case Cs::cDrop:
- CHECK_STACK(1);
- pop();
- break;
-
- case Cs::cExch:
- CHECK_STACK(2);
- d = top(0);
- top(0) = top(1);
- top(1) = d;
- break;
-
- case Cs::cIndex:
- CHECK_STACK(1);
- i = (int)top();
- if (i < 0)
- return error(errValue, cmd);
- CHECK_STACK(i + 2);
- top() = top(i+1);
- break;
-
- case Cs::cRoll:
- return roll_command();
-
- case Cs::cDup:
- CHECK_STACK(1);
- push(top());
- break;
-
- case Cs::cAnd:
- CHECK_STACK(2);
- d = pop();
- top() = (top() != 0) && (d != 0);
- break;
-
- case Cs::cOr:
- CHECK_STACK(2);
- d = pop();
- top() = (top() != 0) || (d != 0);
- break;
-
- case Cs::cNot:
- CHECK_STACK(1);
- top() = (top() == 0);
- break;
-
- case Cs::cEq:
- CHECK_STACK(2);
- d = pop();
- top() = (top() == d);
- break;
-
- case Cs::cIfelse:
- CHECK_STACK(4);
- if (top(1) > top(0))
- top(3) = top(2);
- pop(3);
- break;
-
- case Cs::cPop:
- if (ps_size() < 1)
- return error(errUnderflow, cmd);
- push(ps_pop());
- break;
-
- case 15:
- // this command is found with no explanation in JansonText-Roman
- CHECK_STACK(2);
- pop(2);
- return true;
-
- default:
- return error(errUnimplemented, cmd);
-
- }
-
- return true;
-}
-
-bool
-CharstringInterp::callsubr_command()
-{
- const int cmd = Cs::cCallsubr;
- CHECK_STACK(1);
- int which = (int)pop();
-
- Charstring *subr_cs = get_subr(which);
- if (!subr_cs)
- return error(errSubr, which);
-
- if (_subr_depth >= MAX_SUBR_DEPTH)
- return error(errSubrDepth, which);
- _subr_depth++;
-
- subr_cs->process(*this);
-
- _subr_depth--;
- if (_error != errOK)
- return false;
- return !done();
-}
-
-bool
-CharstringInterp::callgsubr_command()
-{
- const int cmd = Cs::cCallgsubr;
- CHECK_STACK(1);
- int which = (int)pop();
-
- Charstring *subr_cs = get_gsubr(which);
- if (!subr_cs)
- return error(errSubr, which);
-
- if (_subr_depth >= MAX_SUBR_DEPTH)
- return error(errSubrDepth, which);
- _subr_depth++;
-
- subr_cs->process(*this);
-
- _subr_depth--;
- if (_error != errOK)
- return false;
- return !done();
-}
-
-bool
-CharstringInterp::mm_command(int command, int on_stack)
-{
- ensure_weight_vector();
- if (!_weight_vector.size())
- return error(errVector, command);
-
- int nargs;
- switch (command) {
- case Cs::othcMM1: nargs = 1; break;
- case Cs::othcMM2: nargs = 2; break;
- case Cs::othcMM3: nargs = 3; break;
- case Cs::othcMM4: nargs = 4; break;
- case Cs::othcMM6: nargs = 6; break;
- default: return error(errInternal, command);
- }
-
- int nmasters = _weight_vector.size();
- if (size() < nargs * nmasters
- || on_stack != nargs * nmasters)
- return error(errMultipleMaster, command);
-
- int base = size() - on_stack;
-
- int off = base + nargs;
- for (int j = 0; j < nargs; j++) {
- double &val = at(base + j);
- for (int i = 1; i < nmasters; i++, off++)
- val += _weight_vector.at_u(i) * at(off);
- }
-
- for (int i = nargs - 1; i >= 0; i--)
- ps_push(at(base + i));
-
- pop(on_stack);
- return true;
-}
-
-bool
-CharstringInterp::itc_command(int command, int on_stack)
-{
- ensure_weight_vector();
- if (!_weight_vector.size())
- return error(errVector, command);
-
- int base = size() - on_stack;
- switch (command) {
-
- case Cs::othcITC_load: {
- if (on_stack != 1)
- return error(errOthersubr, command);
- int offset = (int)at(base);
- for (int i = 0; i < _weight_vector.size(); i++)
- vec(&_scratch_vector, offset+i) = _weight_vector.at_u(i);
- break;
- }
-
- case Cs::othcITC_put: {
- if (on_stack != 2)
- return error(errOthersubr, command);
- int offset = (int)at(base+1);
- vec(&_scratch_vector, offset) = at(base);
- break;
- }
-
- case Cs::othcITC_get: {
- if (on_stack != 1)
- return error(errOthersubr, command);
- int offset = (int)at(base);
- ps_push(vec(&_scratch_vector, offset));
- break;
- }
-
- case Cs::othcITC_add: {
- if (on_stack != 2)
- return error(errOthersubr, command);
- ps_push(at(base) + at(base+1));
- break;
- }
-
- case Cs::othcITC_sub: {
- if (on_stack != 2)
- return error(errOthersubr, command);
- ps_push(at(base) - at(base+1));
- break;
- }
-
- case Cs::othcITC_mul: {
- if (on_stack != 2)
- return error(errOthersubr, command);
- ps_push(at(base) * at(base+1));
- break;
- }
-
- case Cs::othcITC_div: {
- if (on_stack != 2)
- return error(errOthersubr, command);
- ps_push(at(base) / at(base+1));
- break;
- }
-
- case Cs::othcITC_ifelse: {
- if (on_stack != 4)
- return error(errOthersubr, command);
- if (at(base+2) <= at(base+3))
- ps_push(at(base));
- else
- ps_push(at(base+1));
- break;
- }
-
- default:
- return error(errOthersubr, command);
-
- }
-
- pop(on_stack);
- return true;
-}
-
-
-inline void
-CharstringInterp::actp_rmoveto(int /*cmd*/, double dx, double dy)
-{
- _cp.shift(dx, dy);
-}
-
-inline void
-CharstringInterp::actp_rlineto(int cmd, double dx, double dy)
-{
- Point p0(_cp);
- _cp.shift(dx, dy);
- act_line(cmd, p0, _cp);
-}
-
-void
-CharstringInterp::actp_rrcurveto(int cmd, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
-{
- Point p0(_cp);
- Point p1(p0, dx1, dy1);
- Point p2(p1, dx2, dy2);
- _cp = p2.shifted(dx3, dy3);
- act_curve(cmd, p0, p1, p2, _cp);
-}
-
-void
-CharstringInterp::actp_rrflex(int cmd, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3, double dx4, double dy4, double dx5, double dy5, double dx6, double dy6, double flex_depth)
-{
- Point p0(_cp);
- Point p1(p0, dx1, dy1);
- Point p2(p1, dx2, dy2);
- Point p3_4(p2, dx3, dy3);
- Point p5(p3_4, dx4, dy4);
- Point p6(p5, dx5, dy5);
- _cp = p6.shifted(dx6, dy6);
- act_flex(cmd, p0, p1, p2, p3_4, p5, p6, _cp, flex_depth);
-}
-
-
-bool
-CharstringInterp::callothersubr_command(int othersubrnum, int n)
-{
- switch (othersubrnum) {
-
- case Cs::othcFlexend:
- if (n != 3)
- goto unknown;
- if (!_flex || ps_size() != 16)
- return error(errFlex);
- CHECK_PATH_START();
- act_flex(Cs::cCallothersubr, Point(ps_at(0), ps_at(1)),
- Point(ps_at(4), ps_at(5)), Point(ps_at(6), ps_at(7)),
- Point(ps_at(8), ps_at(9)), Point(ps_at(10), ps_at(11)),
- Point(ps_at(12), ps_at(13)), Point(ps_at(14), ps_at(15)),
- top(2));
- ps_clear();
- ps_push(top(0));
- ps_push(top(1));
- _flex = false;
- _state = S_PATH;
- break;
-
- case Cs::othcFlexbegin:
- if (n != 0)
- goto unknown;
- if (_flex)
- return error(errFlex);
- ps_clear();
- ps_push(_cp.x);
- ps_push(_cp.y);
- _flex = true;
- _state = S_IPATH;
- break;
-
- case Cs::othcFlexmiddle:
- if (n != 0)
- goto unknown;
- if (!_flex)
- return error(errFlex);
- ps_push(_cp.x);
- ps_push(_cp.y);
- break;
-
- case Cs::othcReplacehints:
- if (n != 1)
- goto unknown;
- ps_clear();
- ps_push(top());
- break;
-
- case Cs::othcMM1:
- case Cs::othcMM2:
- case Cs::othcMM3:
- case Cs::othcMM4:
- case Cs::othcMM6:
- return mm_command(othersubrnum, n);
-
- case Cs::othcITC_load:
- case Cs::othcITC_add:
- case Cs::othcITC_sub:
- case Cs::othcITC_mul:
- case Cs::othcITC_div:
- case Cs::othcITC_put:
- case Cs::othcITC_get:
- case Cs::othcITC_unknown:
- case Cs::othcITC_ifelse:
- case Cs::othcITC_random:
- return itc_command(othersubrnum, n);
-
- default: // unknown
- unknown:
- ps_clear();
- for (int i = 0; i < n; i++)
- ps_push(top(i));
- break;
-
- }
-
- pop(n);
- return true;
-}
-
-bool
-CharstringInterp::type1_command(int cmd)
-{
- switch (cmd) {
-
- case Cs::cReturn:
- return false;
-
- case Cs::cHsbw:
- CHECK_STACK(2);
- if (_state > S_SEAC && _careful)
- return error(errOrdering, cmd);
- else {
- _lsb = _cp = _seac_origin.shifted(at(0), 0);
- if (_state == S_INITIAL) {
- act_sidebearing(cmd, _lsb);
- act_width(cmd, Point(at(1), 0));
- }
- if (_state <= S_SEAC)
- _state = S_SBW;
- }
- break;
-
- case Cs::cSbw:
- CHECK_STACK(4);
- if (_state > S_SEAC && _careful)
- return error(errOrdering, cmd);
- else {
- _lsb = _cp = _seac_origin.shifted(at(0), at(1));
- if (_state == S_INITIAL) {
- act_sidebearing(cmd, _lsb);
- act_width(cmd, Point(at(2), at(3)));
- }
- if (_state <= S_SEAC)
- _state = S_SBW;
- }
- break;
-
- case Cs::cSeac:
- CHECK_STACK(5);
- if (_state > S_SBW)
- return error(errOrdering, cmd);
- act_seac(cmd, at(0), at(1), at(2), (int)at(3), (int)at(4));
- clear();
- return false;
-
- case Cs::cCallsubr:
- return callsubr_command();
-
- case Cs::cCallothersubr: {
- CHECK_STACK(2);
- int othersubrnum = (int)top(0);
- int n = (int)top(1);
- pop(2);
- if (othersubrnum < 0 || size() < n)
- return error(errOthersubr, cmd);
- return callothersubr_command(othersubrnum, n);
- }
-
- case Cs::cPut:
- case Cs::cGet:
- case Cs::cStore:
- case Cs::cLoad:
- return vector_command(cmd);
-
- case Cs::cBlend:
- case Cs::cAbs:
- case Cs::cAdd:
- case Cs::cSub:
- case Cs::cDiv:
- case Cs::cNeg:
- case Cs::cRandom:
- case Cs::cMul:
- case Cs::cSqrt:
- case Cs::cDrop:
- case Cs::cExch:
- case Cs::cIndex:
- case Cs::cRoll:
- case Cs::cDup:
- case Cs::cAnd:
- case Cs::cOr:
- case Cs::cNot:
- case Cs::cEq:
- case Cs::cIfelse:
- case Cs::cPop:
- return arith_command(cmd);
-
- case Cs::cHlineto:
- CHECK_STACK(1);
- CHECK_PATH_START();
- actp_rlineto(cmd, at(0), 0);
- break;
-
- case Cs::cHmoveto:
- CHECK_STACK(1);
- CHECK_PATH_END();
- actp_rmoveto(cmd, at(0), 0);
- break;
-
- case Cs::cHvcurveto:
- CHECK_STACK(4);
- CHECK_PATH_START();
- actp_rrcurveto(cmd, at(0), 0, at(1), at(2), 0, at(3));
- break;
-
- case Cs::cRlineto:
- CHECK_STACK(2);
- CHECK_PATH_START();
- actp_rlineto(cmd, at(0), at(1));
- break;
-
- case Cs::cRmoveto:
- CHECK_STACK(2);
- CHECK_PATH_END();
- actp_rmoveto(cmd, at(0), at(1));
- break;
-
- case Cs::cRrcurveto:
- CHECK_STACK(6);
- CHECK_PATH_START();
- actp_rrcurveto(cmd, at(0), at(1), at(2), at(3), at(4), at(5));
- break;
-
- case Cs::cVhcurveto:
- CHECK_STACK(4);
- CHECK_PATH_START();
- actp_rrcurveto(cmd, 0, at(0), at(1), at(2), at(3), 0);
- break;
-
- case Cs::cVlineto:
- CHECK_STACK(1);
- CHECK_PATH_START();
- actp_rlineto(cmd, 0, at(0));
- break;
-
- case Cs::cVmoveto:
- CHECK_STACK(1);
- CHECK_PATH_END();
- actp_rmoveto(cmd, 0, at(0));
- break;
-
- case Cs::cDotsection:
- break;
-
- case Cs::cHstem:
- CHECK_STACK(2);
- act_hstem(cmd, _lsb.y + at(0), at(1));
- break;
-
- case Cs::cHstem3:
- CHECK_STACK(6);
- act_hstem3(cmd, _lsb.y + at(0), at(1), _lsb.y + at(2), at(3), _lsb.y + at(4), at(5));
- break;
-
- case Cs::cVstem:
- CHECK_STACK(2);
- act_vstem(cmd, _lsb.x + at(0), at(1));
- break;
-
- case Cs::cVstem3:
- CHECK_STACK(6);
- act_vstem3(cmd, _lsb.x + at(0), at(1), _lsb.x + at(2), at(3), _lsb.x + at(4), at(5));
- break;
-
- case Cs::cSetcurrentpoint:
- CHECK_STACK(2);
- _cp = Point(at(0), at(1));
- break;
-
- case Cs::cClosepath:
- CHECK_PATH_END();
- break;
-
- case Cs::cEndchar:
- CHECK_PATH_END();
- set_done();
- return false;
-
- case Cs::cError:
- default:
- return error(errUnimplemented, cmd);
-
- }
-
- clear();
- return error() >= 0;
-}
-
-
-#undef DEBUG_TYPE2
-
-int
-CharstringInterp::type2_handle_width(int cmd, bool have_width)
-{
- _cp = _lsb = _seac_origin;
- if (_state != S_INITIAL)
- /* ignore width */;
- else if (have_width)
- act_nominal_width_delta(cmd, at(0));
- else
- act_default_width(cmd);
- return (have_width ? 1 : 0);
-}
-
-bool
-CharstringInterp::type2_command(int cmd, const uint8_t *data, int *left)
-{
- int bottom = 0;
-
-#ifdef DEBUG_TYPE2
- fprintf(stderr, "%s [%d/%d]\n", Charstring::command_name(cmd).c_str(), _t2nhints, size());
-#endif
-
- switch (cmd) {
-
- case Cs::cHstem:
- case Cs::cHstemhm:
- CHECK_STACK(2);
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, (size() % 2) == 1);
- if (_state > S_HSTEM)
- return error(errOrdering, cmd);
- _state = S_HSTEM;
- for (double pos = 0; bottom + 1 < size(); bottom += 2) {
- _t2nhints++;
- act_hstem(cmd, pos + at(bottom), at(bottom + 1));
- pos += at(bottom) + at(bottom + 1);
- }
- break;
-
- case Cs::cVstem:
- case Cs::cVstemhm:
- CHECK_STACK(2);
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, (size() % 2) == 1);
- if (_state > S_VSTEM)
- return error(errOrdering, cmd);
- _state = S_VSTEM;
- for (double pos = 0; bottom + 1 < size(); bottom += 2) {
- _t2nhints++;
- act_vstem(cmd, pos + at(bottom), at(bottom + 1));
- pos += at(bottom) + at(bottom + 1);
- }
- break;
-
- case Cs::cHintmask:
- case Cs::cCntrmask:
- if (_state <= S_SEAC && size() >= 1) {
- bottom = type2_handle_width(cmd, (size() % 2) == 1);
- for (double pos = 0; bottom + 1 < size(); bottom += 2) {
- _t2nhints++;
- act_hstem(cmd, pos + at(bottom), at(bottom + 1));
- pos += at(bottom) + at(bottom + 1);
- }
- }
- if ((_state == S_HSTEM || _state == S_VSTEM) && size() >= 2)
- for (double pos = 0; bottom + 1 < size(); bottom += 2) {
- _t2nhints++;
- act_vstem(cmd, pos + at(bottom), at(bottom + 1));
- pos += at(bottom) + at(bottom + 1);
- }
- if (_state < S_HINTMASK)
- _state = S_HINTMASK;
- if (_t2nhints == 0)
- return error(errHintmask, cmd);
- if (!data || !left)
- return error(errInternal, cmd);
- if (((_t2nhints - 1) >> 3) + 1 > *left)
- return error(errRunoff, cmd);
- act_hintmask(cmd, data, _t2nhints);
- *left -= ((_t2nhints - 1) >> 3) + 1;
- break;
-
- case Cs::cRmoveto:
- CHECK_STACK(2);
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, size() > 2);
- CHECK_PATH_END();
- actp_rmoveto(cmd, at(bottom), at(bottom + 1));
-#if DEBUG_TYPE2
- bottom += 2;
-#endif
- break;
-
- case Cs::cHmoveto:
- CHECK_STACK(1);
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, size() > 1);
- CHECK_PATH_END();
- actp_rmoveto(cmd, at(bottom), 0);
-#if DEBUG_TYPE2
- bottom++;
-#endif
- break;
-
- case Cs::cVmoveto:
- CHECK_STACK(1);
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, size() > 1);
- CHECK_PATH_END();
- actp_rmoveto(cmd, 0, at(bottom));
-#if DEBUG_TYPE2
- bottom++;
-#endif
- break;
-
- case Cs::cRlineto:
- CHECK_STACK(2);
- CHECK_STATE();
- CHECK_PATH_START();
- for (; bottom + 1 < size(); bottom += 2)
- actp_rlineto(cmd, at(bottom), at(bottom + 1));
- break;
-
- case Cs::cHlineto:
- CHECK_STACK(1);
- CHECK_STATE();
- CHECK_PATH_START();
- while (bottom < size()) {
- actp_rlineto(cmd, at(bottom++), 0);
- if (bottom < size())
- actp_rlineto(cmd, 0, at(bottom++));
- }
- break;
-
- case Cs::cVlineto:
- CHECK_STACK(1);
- CHECK_STATE();
- CHECK_PATH_START();
- while (bottom < size()) {
- actp_rlineto(cmd, 0, at(bottom++));
- if (bottom < size())
- actp_rlineto(cmd, at(bottom++), 0);
- }
- break;
-
- case Cs::cRrcurveto:
- CHECK_STACK(6);
- CHECK_STATE();
- CHECK_PATH_START();
- for (; bottom + 5 < size(); bottom += 6)
- actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
- break;
-
- case Cs::cHhcurveto:
- CHECK_STACK(4);
- CHECK_STATE();
- CHECK_PATH_START();
- if (size() % 2 == 1) {
- actp_rrcurveto(cmd, at(bottom + 1), at(bottom), at(bottom + 2), at(bottom + 3), at(bottom + 4), 0);
- bottom += 5;
- }
- for (; bottom + 3 < size(); bottom += 4)
- actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), at(bottom + 3), 0);
- break;
-
- case Cs::cHvcurveto:
- CHECK_STACK(4);
- CHECK_STATE();
- CHECK_PATH_START();
- while (bottom + 3 < size()) {
- double dx3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
- actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), dx3, at(bottom + 3));
- bottom += 4;
- if (bottom + 3 < size()) {
- double dy3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
- actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), dy3);
- bottom += 4;
- }
- }
-#if DEBUG_TYPE2
- if (bottom + 1 == size())
- bottom++;
-#endif
- break;
-
- case Cs::cRcurveline:
- CHECK_STACK(8);
- CHECK_STATE();
- CHECK_PATH_START();
- for (; bottom + 7 < size(); bottom += 6)
- actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
- actp_rlineto(cmd, at(bottom), at(bottom + 1));
-#if DEBUG_TYPE2
- bottom += 2;
-#endif
- break;
-
- case Cs::cRlinecurve:
- CHECK_STACK(8);
- CHECK_STATE();
- CHECK_PATH_START();
- for (; bottom + 7 < size(); bottom += 2)
- actp_rlineto(cmd, at(bottom), at(bottom + 1));
- actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
-#if DEBUG_TYPE2
- bottom += 6;
-#endif
- break;
-
- case Cs::cVhcurveto:
- CHECK_STACK(4);
- CHECK_STATE();
- CHECK_PATH_START();
- while (bottom + 3 < size()) {
- double dy3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
- actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), dy3);
- bottom += 4;
- if (bottom + 3 < size()) {
- double dx3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
- actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), dx3, at(bottom + 3));
- bottom += 4;
- }
- }
-#if DEBUG_TYPE2
- if (bottom + 1 == size())
- bottom++;
-#endif
- break;
-
- case Cs::cVvcurveto:
- CHECK_STACK(4);
- CHECK_STATE();
- CHECK_PATH_START();
- if (size() % 2 == 1) {
- actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), 0, at(bottom + 4));
- bottom += 5;
- }
- for (; bottom + 3 < size(); bottom += 4)
- actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), 0, at(bottom + 3));
- break;
-
- case Cs::cFlex:
- CHECK_STACK(13);
- CHECK_STATE();
- CHECK_PATH_START();
- assert(bottom == 0);
- actp_rrflex(cmd,
- at(0), at(1), at(2), at(3), at(4), at(5),
- at(6), at(7), at(8), at(9), at(10), at(11),
- at(12));
-#if DEBUG_TYPE2
- bottom += 13;
-#endif
- break;
-
- case Cs::cHflex:
- CHECK_STACK(7);
- CHECK_STATE();
- CHECK_PATH_START();
- assert(bottom == 0);
- actp_rrflex(cmd,
- at(0), 0, at(1), at(2), at(3), 0,
- at(4), 0, at(5), -at(2), at(6), 0,
- 50);
-#if DEBUG_TYPE2
- bottom += 7;
-#endif
- break;
-
- case Cs::cHflex1:
- CHECK_STACK(9);
- CHECK_STATE();
- CHECK_PATH_START();
- assert(bottom == 0);
- actp_rrflex(cmd,
- at(0), at(1), at(2), at(3), at(4), 0,
- at(5), 0, at(6), at(7), at(8), -(at(1) + at(3) + at(7)),
- 50);
-#if DEBUG_TYPE2
- bottom += 9;
-#endif
- break;
-
- case Cs::cFlex1: {
- CHECK_STACK(11);
- CHECK_STATE();
- CHECK_PATH_START();
- assert(bottom == 0);
- double dx = at(0) + at(2) + at(4) + at(6) + at(8);
- double dy = at(1) + at(3) + at(5) + at(7) + at(9);
- if (fabs(dx) > fabs(dy))
- actp_rrflex(cmd,
- at(0), at(1), at(2), at(3), at(4), at(5),
- at(6), at(7), at(8), at(9), at(10), -dy,
- 50);
- else
- actp_rrflex(cmd,
- at(0), at(1), at(2), at(3), at(4), at(5),
- at(6), at(7), at(8), at(9), -dx, at(10),
- 50);
- break;
-#if DEBUG_TYPE2
- bottom += 11;
-#endif
- }
-
- case Cs::cEndchar:
- if (_state <= S_SEAC)
- bottom = type2_handle_width(cmd, size() > 0 && size() != 4);
- if (bottom + 3 < size() && _state == S_INITIAL)
- act_seac(cmd, 0, at(bottom), at(bottom + 1), (int)at(bottom + 2), (int)at(bottom + 3));
- CHECK_PATH_END();
- set_done();
- clear();
- return false;
-
- case Cs::cReturn:
- return false;
-
- case Cs::cCallsubr:
- return callsubr_command();
-
- case Cs::cCallgsubr:
- return callgsubr_command();
-
- case Cs::cPut:
- case Cs::cGet:
- case Cs::cStore:
- case Cs::cLoad:
- return vector_command(cmd);
-
- case Cs::cBlend:
- case Cs::cAbs:
- case Cs::cAdd:
- case Cs::cSub:
- case Cs::cDiv:
- case Cs::cNeg:
- case Cs::cRandom:
- case Cs::cMul:
- case Cs::cSqrt:
- case Cs::cDrop:
- case Cs::cExch:
- case Cs::cIndex:
- case Cs::cRoll:
- case Cs::cDup:
- case Cs::cAnd:
- case Cs::cOr:
- case Cs::cNot:
- case Cs::cEq:
- case Cs::cIfelse:
- case Cs::cPop:
- return arith_command(cmd);
-
- case Cs::cDotsection:
- break;
-
- case Cs::cError:
- default:
- return error(errUnimplemented, cmd);
-
- }
-
-#if DEBUG_TYPE2
- if (bottom != size())
- fprintf(stderr, "[left %d on stack] ", size() - bottom);
-#endif
-
- clear();
- return error() >= 0;
-}
-
-
-void
-CharstringInterp::act_sidebearing(int, const Point &)
-{
- /* do nothing */
-}
-
-void
-CharstringInterp::act_width(int, const Point &)
-{
- /* do nothing */
-}
-
-void
-CharstringInterp::act_default_width(int cmd)
-{
- double d = (_program ? _program->global_width_x(false) : UNKDOUBLE);
- if (KNOWN(d))
- act_width(cmd, Point(d, 0));
-}
-
-void
-CharstringInterp::act_nominal_width_delta(int cmd, double delta)
-{
- double d = (_program ? _program->global_width_x(true) : UNKDOUBLE);
- if (KNOWN(d))
- act_width(cmd, Point(d + delta, 0));
-}
-
-void
-CharstringInterp::act_seac(int cmd, double asb, double adx, double ady, int bchar, int achar)
-{
- Charstring *acs = 0, *bcs = 0;
- if (achar < 0 || achar >= 256 || bchar < 0 || bchar >= 256
- || !_program || _program->parent_program()
- || !(acs = get_glyph(Charstring::standard_encoding[achar]))
- || !(bcs = get_glyph(Charstring::standard_encoding[bchar]))) {
- error(errGlyph, cmd);
- return;
- }
-
- Point apos = Point(adx + _lsb.x - asb, ady + _lsb.y);
- Point save_lsb = _lsb;
- Point save_seac_origin = _seac_origin;
-
- CharstringInterp::initialize();
- _seac_origin = apos;
- _state = S_SEAC;
- acs->process(*this);
- if (error() == errOK) {
- CharstringInterp::initialize();
- _seac_origin = save_seac_origin;
- _state = S_SEAC;
- bcs->process(*this);
- }
-
- _lsb = save_lsb;
-}
-
-void
-CharstringInterp::act_line(int cmd, const Point &p0, const Point &p1)
-{
- act_curve(cmd, p0, p0, p1, p1);
-}
-
-void
-CharstringInterp::act_curve(int cmd, const Point &, const Point &, const Point &, const Point &)
-{
- error(errUnimplemented, cmd);
-}
-
-void
-CharstringInterp::act_flex(int cmd, const Point &p0, const Point &p1, const Point &p2, const Point &p3_4, const Point &p5, const Point &p6, const Point &p7, double flex_depth)
-{
- (void) flex_depth;
- act_curve(cmd, p0, p1, p2, p3_4);
- act_curve(cmd, p3_4, p5, p6, p7);
-}
-
-void
-CharstringInterp::act_closepath(int)
-{
- /* do nothing */
-}
-
-void
-CharstringInterp::act_hstem(int, double, double)
-{
- /* do nothing */
-}
-
-void
-CharstringInterp::act_vstem(int, double, double)
-{
- /* do nothing */
-}
-
-void
-CharstringInterp::act_hstem3(int cmd, double y0, double dy0, double y1, double dy1, double y2, double dy2)
-{
- act_hstem(cmd, y0, dy0);
- act_hstem(cmd, y1, dy1);
- act_hstem(cmd, y2, dy2);
-}
-
-void
-CharstringInterp::act_vstem3(int cmd, double x0, double dx0, double x1, double dx1, double x2, double dx2)
-{
- act_vstem(cmd, x0, dx0);
- act_vstem(cmd, x1, dx1);
- act_vstem(cmd, x2, dx2);
-}
-
-void
-CharstringInterp::act_hintmask(int, const uint8_t *, int)
-{
- /* do nothing */
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfcs.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfcs.cc
deleted file mode 100644
index 39b3c5325b5..00000000000
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfcs.cc
+++ /dev/null
@@ -1,221 +0,0 @@
-// -*- related-file-name: "../include/efont/ttfcs.hh" -*-
-
-/* ttfcs.{cc,hh} -- TrueType "charstring" emulation
- *
- * Copyright (c) 2006-2014 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/ttfcs.hh>
-#include <efont/ttfhead.hh>
-#include <efont/t1csgen.hh>
-#include <efont/otfpost.hh>
-#include <efont/otfcmap.hh>
-#include <lcdf/hashmap.hh>
-namespace Efont {
-
-TrueTypeBoundsCharstringProgram::TrueTypeBoundsCharstringProgram(const OpenType::Font* otf)
- : CharstringProgram(otf->units_per_em()),
- _otf(otf), _nglyphs(-1), _loca_long(false),
- _loca(otf->table("loca")), _glyf(otf->table("glyf")),
- _hmtx(otf->table("hmtx")), _got_glyph_names(false), _got_unicodes(false)
-{
- OpenType::Data maxp(otf->table("maxp"));
- if (maxp.length() >= 6)
- _nglyphs = maxp.u16(4);
-
- OpenType::Head head(otf->table("head"), 0);
- if (head.ok())
- _loca_long = head.index_to_loc_format() != 0;
- if (_loca_long)
- _loca.align_long();
- int loca_onesize = (_loca_long ? 4 : 2);
- if (_nglyphs >= _loca.length() / loca_onesize)
- _nglyphs = (_loca.length() / loca_onesize) - 1;
-
- // horizontal metrics
- OpenType::Data hhea(_otf->table("hhea"));
- // HHEA format:
- // 0 Fixed Table version number 0x00010000 for version 1.0.
- // 4 FWORD Ascender
- // 6 FWORD Descender
- // 8 FWORD LineGap
- // 10 UFWORD advanceWidthMax
- // 12 FWORD minLeftSideBearing
- // 14 FWORD minRightSideBearing
- // 16 FWORD xMaxExtent
- // 18 SHORT caretSlopeRise
- // 20 SHORT caretSlopeRun
- // 22 SHORT caretOffset
- // 24 SHORT (reserved)
- // 26 SHORT (reserved)
- // 28 SHORT (reserved)
- // 30 SHORT (reserved)
- // 32 SHORT metricDataFormat
- // 34 USHORT numberOfHMetrics
- if (hhea.length() >= 36
- && hhea.u32(0) == 0x10000)
- _nhmtx = hhea.u16(34);
- if (_nhmtx * 4 > _hmtx.length())
- _nhmtx = _hmtx.length() / 4;
-}
-
-TrueTypeBoundsCharstringProgram::~TrueTypeBoundsCharstringProgram()
-{
- for (Charstring **cs = _charstrings.begin(); cs < _charstrings.end(); cs++)
- delete *cs;
-}
-
-void TrueTypeBoundsCharstringProgram::font_matrix(double matrix[6]) const {
- matrix[0] = matrix[3] = 1.0 / _otf->units_per_em();
- matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
-}
-
-int
-TrueTypeBoundsCharstringProgram::nglyphs() const
-{
- return _nglyphs;
-}
-
-PermString
-TrueTypeBoundsCharstringProgram::glyph_name(int gi) const
-{
- // generate glyph names based on what pdftex can understand
- if (gi == 0)
- return PermString(".notdef");
-
- // try 'post' table glyph names
- if (!_got_glyph_names) {
- OpenType::Post post(_otf->table("post"));
- if (post.ok())
- post.glyph_names(_glyph_names);
- HashMap<PermString, int> name2glyph(-1);
- // some 'post' tables are bogus, reject multiply-encoded names
- for (int gi = 0; gi < _glyph_names.size(); ++gi) {
- int& xgi = name2glyph.find_force(_glyph_names[gi]);
- if (xgi == -1)
- xgi = gi;
- else if (xgi == 0)
- _glyph_names[gi] = PermString();
- else
- _glyph_names[gi] = _glyph_names[xgi] = PermString();
- }
- _got_glyph_names = true;
- }
- if (gi >= 0 && gi < _glyph_names.size() && _glyph_names[gi])
- return _glyph_names[gi];
-
- // try 'uniXXXX' names
- if (!_got_unicodes) {
- OpenType::Cmap cmap(_otf->table("cmap"));
- if (cmap.ok())
- cmap.unmap_all(_unicodes);
- // make sure we only use uniquely identified glyphs
- HashMap<uint32_t, int> unicode_usage(-1);
- for (int g = 0; g < _unicodes.size(); g++)
- if (_unicodes[g]) {
- int i = unicode_usage.find_force(_unicodes[g], g);
- if (i != g)
- _unicodes[i] = _unicodes[g] = 0;
- }
- _got_unicodes = true;
- }
-
- if (gi >= 0 && gi < _unicodes.size() && _unicodes[gi] > 0 && _unicodes[gi] <= 0xFFFF) {
- char buf[10];
- sprintf(buf, "uni%04X", _unicodes[gi]);
- return PermString(buf);
- } else
- return permprintf("index%d", gi);
-}
-
-void
-TrueTypeBoundsCharstringProgram::glyph_names(Vector<PermString> &gn) const
-{
- gn.clear();
- for (int gi = 0; gi < _nglyphs; gi++)
- gn.push_back(glyph_name(gi));
-}
-
-Charstring *
-TrueTypeBoundsCharstringProgram::glyph(int gi) const
-{
- if (gi < 0 || gi >= _nglyphs)
- return 0;
- if (_charstrings.size() <= gi)
- _charstrings.resize(gi + 1, (Charstring *) 0);
- if (!_charstrings[gi]) {
- // calculate glyf offsets
- uint32_t offset, end_offset;
- if (_loca_long) {
- offset = _loca.u32(gi * 4);
- end_offset = _loca.u32(gi * 4 + 4);
- } else {
- offset = _loca.u16(gi * 2) * 2;
- end_offset = _loca.u16(gi * 2 + 2) * 2;
- }
-
- // fetch bounding box from glyf
- int ncontours, xmin, ymin, xmax, ymax;
- if (offset != end_offset) {
- if (offset > end_offset || offset + 10 > end_offset
- || end_offset > (uint32_t) _glyf.length())
- return 0;
-
- ncontours = _glyf.s16(offset);
- xmin = _glyf.s16(offset + 2);
- ymin = _glyf.s16(offset + 4);
- xmax = _glyf.s16(offset + 6);
- ymax = _glyf.s16(offset + 8);
- } else
- ncontours = xmin = ymin = xmax = ymax = 0;
-
- // fetch horizontal metrics
- int advance_width, lsb;
- if (gi >= _nhmtx) {
- advance_width = (_nhmtx ? _hmtx.u16((_nhmtx - 1) * 4) : 0);
- int hmtx_offset = _nhmtx * 4 + (gi - _nhmtx) * 2;
- lsb = (hmtx_offset + 2 <= _hmtx.length() ? _hmtx.s16(hmtx_offset) : 0);
- } else {
- advance_width = _hmtx.u16(gi * 4);
- lsb = _hmtx.s16(gi * 4 + 2);
- }
-
- // make charstring
- Type1CharstringGen gen;
- if (ncontours == 0) {
- gen.gen_number(0, 'X');
- gen.gen_number(advance_width);
- gen.gen_command(Charstring::cHsbw);
- } else {
- gen.gen_number(lsb, 'X');
- gen.gen_number(advance_width);
- gen.gen_command(Charstring::cHsbw);
- gen.gen_moveto(Point(xmin, ymin), false, false);
- if (xmax != xmin || ymax == ymin)
- gen.gen_number(xmax - xmin, 'x');
- if (ymax != ymin)
- gen.gen_number(ymax - ymin, 'y');
- gen.gen_command(ymax == ymin ? Charstring::cHlineto
- : (xmax == xmin ? Charstring::cVlineto
- : Charstring::cRlineto));
- gen.gen_command(Charstring::cClosepath);
- }
- gen.gen_command(Charstring::cEndchar);
-
- _charstrings[gi] = gen.output();
- }
- return _charstrings[gi];
-}
-
-}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/ChangeLog b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/ChangeLog
index 1aaa9375bf6..09e8554c652 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/ChangeLog
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-26 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Import lcdf-typetools-2.105.
+ * patch-01-win64 (removed): Now in distribution.
+ * patch-02-mingw64, patch-20-TL-binary, patch-21-TL-paths,
+ patch-30-W32TeX: Adapted.
+
2014-11-06 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-02-mingw64 (new): Avoid MinGW64 warnings.
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/TL-Changes b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/TL-Changes
index e086a979ec2..e086a979ec2 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/TL-Changes
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/TL-Changes
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-02-mingw64 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-02-mingw64
index 0c4eb654b3c..3eac34deab2 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-02-mingw64
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-02-mingw64
@@ -1,9 +1,9 @@
MinGW64 complains when <winsock2.h> is included after <windows.h>
(via include/efont/otfdata.hh).
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/include/config.h lcdf-typetools-2.104/include/config.h
---- lcdf-typetools-2.104.orig/include/config.h 2013-09-17 15:27:20.000000000 +0200
-+++ lcdf-typetools-2.104/include/config.h 2014-11-06 11:47:10.000000000 +0100
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/include/config.h lcdf-typetools-2.105/include/config.h
+--- lcdf-typetools-2.105.orig/include/config.h 2013-08-13 22:12:16.000000000 +0200
++++ lcdf-typetools-2.105/include/config.h 2015-09-26 21:41:12.000000000 +0200
@@ -6,6 +6,7 @@
/* Allow compilation on Windows (thanks, Fabrice Popineau). */
#ifdef WIN32
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-20-TL-binary b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-20-TL-binary
index ccc0e2637f1..9f6e4ac00d3 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-20-TL-binary
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-20-TL-binary
@@ -1,8 +1,8 @@
In TeX Live we treat all output files as binary.
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/liblcdf/filename.cc lcdf-typetools-2.104/liblcdf/filename.cc
---- lcdf-typetools-2.104.orig/liblcdf/filename.cc 2013-09-17 15:40:15.000000000 +0200
-+++ lcdf-typetools-2.104/liblcdf/filename.cc 2014-07-05 11:50:21.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/liblcdf/filename.cc lcdf-typetools-2.105/liblcdf/filename.cc
+--- lcdf-typetools-2.105.orig/liblcdf/filename.cc 2013-08-13 22:18:57.000000000 +0200
++++ lcdf-typetools-2.105/liblcdf/filename.cc 2015-09-26 21:43:34.000000000 +0200
@@ -126,5 +126,5 @@
if (_actual || !_path)
return _actual;
@@ -10,9 +10,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
- return fopen(_path.c_str(), binary ? "wb" : "w");
+ return fopen(_path.c_str(), "wb");
}
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/automatic.cc lcdf-typetools-2.104/otftotfm/automatic.cc
---- lcdf-typetools-2.104.orig/otftotfm/automatic.cc 2014-04-10 14:27:02.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/automatic.cc 2014-07-05 11:50:21.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/automatic.cc lcdf-typetools-2.105/otftotfm/automatic.cc
+--- lcdf-typetools-2.105.orig/otftotfm/automatic.cc 2014-01-09 17:24:47.000000000 +0100
++++ lcdf-typetools-2.105/otftotfm/automatic.cc 2015-09-26 21:43:34.000000000 +0200
@@ -311,7 +311,7 @@
String ls_r = writable_texdir + "ls-R";
bool success = false;
@@ -31,9 +31,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
fd = fileno(f);
}
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc lcdf-typetools-2.104/otftotfm/otftotfm.cc
---- lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc 2014-07-06 15:17:25.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/otftotfm.cc 2014-07-07 08:32:34.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/otftotfm.cc lcdf-typetools-2.105/otftotfm/otftotfm.cc
+--- lcdf-typetools-2.105.orig/otftotfm/otftotfm.cc 2015-09-15 19:05:30.000000000 +0200
++++ lcdf-typetools-2.105/otftotfm/otftotfm.cc 2015-09-26 21:43:34.000000000 +0200
@@ -582,7 +582,7 @@
if (verbose)
@@ -52,9 +52,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
fd = fileno(f);
}
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/t1dotlessj/t1dotlessj.cc lcdf-typetools-2.104/t1dotlessj/t1dotlessj.cc
---- lcdf-typetools-2.104.orig/t1dotlessj/t1dotlessj.cc 2014-05-23 15:13:20.000000000 +0200
-+++ lcdf-typetools-2.104/t1dotlessj/t1dotlessj.cc 2014-07-05 11:50:21.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/t1dotlessj/t1dotlessj.cc lcdf-typetools-2.105/t1dotlessj/t1dotlessj.cc
+--- lcdf-typetools-2.105.orig/t1dotlessj/t1dotlessj.cc 2014-05-23 22:17:05.000000000 +0200
++++ lcdf-typetools-2.105/t1dotlessj/t1dotlessj.cc 2015-09-26 21:43:34.000000000 +0200
@@ -410,10 +410,10 @@
// write it to output
if (!outputf)
@@ -68,12 +68,12 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
Type1PFBWriter w(outputf);
dotless_font->write(w);
} else {
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/t1rawafm/t1rawafm.cc lcdf-typetools-2.104/t1rawafm/t1rawafm.cc
---- lcdf-typetools-2.104.orig/t1rawafm/t1rawafm.cc 2014-05-23 15:13:20.000000000 +0200
-+++ lcdf-typetools-2.104/t1rawafm/t1rawafm.cc 2014-07-05 11:50:21.000000000 +0200
-@@ -356,6 +356,9 @@
- if (!outf)
- errh->fatal("%s: %s", output_file, strerror(errno));
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/t1rawafm/t1rawafm.cc lcdf-typetools-2.105/t1rawafm/t1rawafm.cc
+--- lcdf-typetools-2.105.orig/t1rawafm/t1rawafm.cc 2015-09-15 20:03:32.000000000 +0200
++++ lcdf-typetools-2.105/t1rawafm/t1rawafm.cc 2015-09-26 21:43:34.000000000 +0200
+@@ -359,6 +359,9 @@
+ if (!outf)
+ errh->fatal("%s: %s", output_file, strerror(errno));
}
+#if defined(_MSDOS) || defined(_WIN32)
+ _setmode(_fileno(outf), _O_BINARY);
@@ -81,9 +81,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
write_afm(outf, font);
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/t1reencode/t1reencode.cc lcdf-typetools-2.104/t1reencode/t1reencode.cc
---- lcdf-typetools-2.104.orig/t1reencode/t1reencode.cc 2013-09-17 15:27:20.000000000 +0200
-+++ lcdf-typetools-2.104/t1reencode/t1reencode.cc 2014-07-05 11:50:21.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/t1reencode/t1reencode.cc lcdf-typetools-2.105/t1reencode/t1reencode.cc
+--- lcdf-typetools-2.105.orig/t1reencode/t1reencode.cc 2013-08-13 22:20:37.000000000 +0200
++++ lcdf-typetools-2.105/t1reencode/t1reencode.cc 2015-09-26 21:43:34.000000000 +0200
@@ -1094,10 +1094,10 @@
if (!outf)
errh->fatal("%s: %s", output_file, strerror(errno));
@@ -97,9 +97,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
Type1PFBWriter w(outf);
font->write(w);
} else {
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/t1testpage/t1testpage.cc lcdf-typetools-2.104/t1testpage/t1testpage.cc
---- lcdf-typetools-2.104.orig/t1testpage/t1testpage.cc 2013-09-17 15:27:20.000000000 +0200
-+++ lcdf-typetools-2.104/t1testpage/t1testpage.cc 2014-07-05 11:50:21.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/t1testpage/t1testpage.cc lcdf-typetools-2.105/t1testpage/t1testpage.cc
+--- lcdf-typetools-2.105.orig/t1testpage/t1testpage.cc 2013-08-13 22:20:45.000000000 +0200
++++ lcdf-typetools-2.105/t1testpage/t1testpage.cc 2015-09-26 21:43:34.000000000 +0200
@@ -665,6 +665,9 @@
if (!outf)
errh->fatal("%s: %s", output_file, strerror(errno));
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-21-TL-paths b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-21-TL-paths
index 86d7de6c1be..760b4bcda38 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-21-TL-paths
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-21-TL-paths
@@ -1,6 +1,6 @@
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/automatic.cc lcdf-typetools-2.104/otftotfm/automatic.cc
---- lcdf-typetools-2.104.orig/otftotfm/automatic.cc 2014-07-05 11:50:21.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/automatic.cc 2014-07-05 11:53:11.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/automatic.cc lcdf-typetools-2.105/otftotfm/automatic.cc
+--- lcdf-typetools-2.105.orig/otftotfm/automatic.cc 2015-09-26 21:43:34.000000000 +0200
++++ lcdf-typetools-2.105/otftotfm/automatic.cc 2015-09-26 21:49:48.000000000 +0200
@@ -321,7 +321,11 @@
if (!success && writable_texdir.find_left('\'') < 0 && directory.find_left('\'') < 0 && file.find_left('\'') < 0) {
// look for mktexupd script
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-30-W32TeX b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-30-W32TeX
index 22065d49576..524c415ea77 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-30-W32TeX
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105-PATCHES/patch-30-W32TeX
@@ -1,6 +1,6 @@
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/automatic.cc lcdf-typetools-2.104/otftotfm/automatic.cc
---- lcdf-typetools-2.104.orig/otftotfm/automatic.cc 2014-07-05 11:53:11.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/automatic.cc 2014-07-05 11:54:07.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/automatic.cc lcdf-typetools-2.105/otftotfm/automatic.cc
+--- lcdf-typetools-2.105.orig/otftotfm/automatic.cc 2015-09-26 21:49:48.000000000 +0200
++++ lcdf-typetools-2.105/otftotfm/automatic.cc 2015-09-26 21:50:40.000000000 +0200
@@ -39,6 +39,10 @@
#include <algorithm>
@@ -49,9 +49,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
+ CMD_SEP " updmap" + redirect;
int retval = mysystem(command.c_str(), errh);
if (retval == 127)
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/kpseinterface.c lcdf-typetools-2.104/otftotfm/kpseinterface.c
---- lcdf-typetools-2.104.orig/otftotfm/kpseinterface.c 2014-04-10 14:27:02.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/kpseinterface.c 2014-07-05 11:54:07.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/kpseinterface.c lcdf-typetools-2.105/otftotfm/kpseinterface.c
+--- lcdf-typetools-2.105.orig/otftotfm/kpseinterface.c 2014-01-09 17:27:02.000000000 +0100
++++ lcdf-typetools-2.105/otftotfm/kpseinterface.c 2015-09-26 21:50:40.000000000 +0200
@@ -21,6 +21,9 @@
#include <kpathsea/expand.h>
#include <kpathsea/c-pathch.h>
@@ -74,9 +74,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
+ return kpse_var_value(name);
+}
+#endif
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/kpseinterface.h lcdf-typetools-2.104/otftotfm/kpseinterface.h
---- lcdf-typetools-2.104.orig/otftotfm/kpseinterface.h 2013-09-17 15:27:20.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/kpseinterface.h 2014-07-05 11:54:07.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/kpseinterface.h lcdf-typetools-2.105/otftotfm/kpseinterface.h
+--- lcdf-typetools-2.105.orig/otftotfm/kpseinterface.h 2013-08-13 22:12:16.000000000 +0200
++++ lcdf-typetools-2.105/otftotfm/kpseinterface.h 2015-09-26 21:50:40.000000000 +0200
@@ -13,6 +13,10 @@
char* kpsei_find_file(const char* name, int format);
void kpsei_set_debug_flags(unsigned flags);
@@ -88,9 +88,9 @@ diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetoo
#ifdef __cplusplus
}
#endif
-diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc lcdf-typetools-2.104/otftotfm/otftotfm.cc
---- lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc 2014-07-07 08:32:34.000000000 +0200
-+++ lcdf-typetools-2.104/otftotfm/otftotfm.cc 2014-07-07 08:34:35.000000000 +0200
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.105.orig/otftotfm/otftotfm.cc lcdf-typetools-2.105/otftotfm/otftotfm.cc
+--- lcdf-typetools-2.105.orig/otftotfm/otftotfm.cc 2015-09-26 21:43:34.000000000 +0200
++++ lcdf-typetools-2.105/otftotfm/otftotfm.cc 2015-09-26 21:50:40.000000000 +0200
@@ -63,6 +63,9 @@
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/7t.enc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/7t.enc
index 727f29e5f8c..727f29e5f8c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/7t.enc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/7t.enc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/COPYING b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/COPYING
index 67572846722..67572846722 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/COPYING
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/COPYING
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/INSTALL b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/INSTALL
index 95d84c820fb..95d84c820fb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/INSTALL
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/INSTALL
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.am
index de0535c5252..9542d940c87 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.am
@@ -6,7 +6,7 @@ DIST_SUBDIRS = liblcdf libefont cfftot1 mmafm mmpfb otfinfo otftotfm \
t1dotlessj t1lint t1rawafm t1reencode t1testpage ttftotype42
EXTRA_DIST = \
- ONEWS \
+ ONEWS README.md \
lcdf-typetools.spec \
include/config.h \
include/lcdf/bezier.hh \
@@ -74,7 +74,7 @@ t1reencode t1testpage ttftotype42: liblcdf libefont
versionize:
perl -pi -e 's/^\.ds V.*/.ds V $(VERSION)/;' $(srcdir)/cfftot1/cfftot1.1 $(srcdir)/mmafm/mmafm.1 $(srcdir)/mmpfb/mmpfb.1 $(srcdir)/otfinfo/otfinfo.1 $(srcdir)/otftotfm/otftotfm.1 $(srcdir)/t1dotlessj/t1dotlessj.1 $(srcdir)/t1lint/t1lint.1 $(srcdir)/t1rawafm/t1rawafm.1 $(srcdir)/t1reencode/t1reencode.1 $(srcdir)/t1testpage/t1testpage.1 $(srcdir)/ttftotype42/ttftotype42.1
- perl -pi -e 's/^(\U$(PACKAGE)\E) [\d.ab]+$$/$$1 $(VERSION)/;' $(srcdir)/README
+ perl -pi -e 's/^(\U$(PACKAGE)\E) [\d.ab]+$$/$$1 $(VERSION)/;' $(srcdir)/README.md
perl -pi -e 's/^Version: [\d.ab]+$$/Version: $(VERSION)/;' $(srcdir)/lcdf-typetools.spec
dist-hook:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.in
index 126545c7cf6..6024dea5f73 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/Makefile.in
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = lcdf-typetools-2.104
+subdir = lcdf-typetools-2.105
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -192,7 +192,7 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
-am__DIST_COMMON = $(srcdir)/Makefile.in COPYING INSTALL NEWS README
+am__DIST_COMMON = $(srcdir)/Makefile.in COPYING INSTALL NEWS
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -360,7 +360,7 @@ DIST_SUBDIRS = liblcdf libefont cfftot1 mmafm mmpfb otfinfo otftotfm \
t1dotlessj t1lint t1rawafm t1reencode t1testpage ttftotype42
EXTRA_DIST = \
- ONEWS \
+ ONEWS README.md \
lcdf-typetools.spec \
include/config.h \
include/lcdf/bezier.hh \
@@ -430,9 +430,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -789,7 +789,7 @@ t1reencode t1testpage ttftotype42: liblcdf libefont
versionize:
perl -pi -e 's/^\.ds V.*/.ds V $(VERSION)/;' $(srcdir)/cfftot1/cfftot1.1 $(srcdir)/mmafm/mmafm.1 $(srcdir)/mmpfb/mmpfb.1 $(srcdir)/otfinfo/otfinfo.1 $(srcdir)/otftotfm/otftotfm.1 $(srcdir)/t1dotlessj/t1dotlessj.1 $(srcdir)/t1lint/t1lint.1 $(srcdir)/t1rawafm/t1rawafm.1 $(srcdir)/t1reencode/t1reencode.1 $(srcdir)/t1testpage/t1testpage.1 $(srcdir)/ttftotype42/ttftotype42.1
- perl -pi -e 's/^(\U$(PACKAGE)\E) [\d.ab]+$$/$$1 $(VERSION)/;' $(srcdir)/README
+ perl -pi -e 's/^(\U$(PACKAGE)\E) [\d.ab]+$$/$$1 $(VERSION)/;' $(srcdir)/README.md
perl -pi -e 's/^Version: [\d.ab]+$$/Version: $(VERSION)/;' $(srcdir)/lcdf-typetools.spec
dist-hook:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/NEWS b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/NEWS
index 120ece7a6a5..bc5b996fb78 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/NEWS
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/NEWS
@@ -1,5 +1,16 @@
LCDF Typetools NEWS
+Version 2.105 15.Sep.2015
+
+* Several crash fixes.
+
+* otfinfo -g: Print all Unicode mappings for a glyph.
+
+* t1lint: Support counter control hints.
+
+* Thanks to Github issue contributors.
+
+
Version 2.104 7.Jul.2014
* Fix a nit with format-1 chaining context substitutions.
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ONEWS b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ONEWS
index 6bd9dc8c42d..6bd9dc8c42d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ONEWS
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ONEWS
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/README.md b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/README.md
new file mode 100644
index 00000000000..3d4d5ab38e8
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/README.md
@@ -0,0 +1,118 @@
+LCDF Typetools
+==============
+
+LCDF Typetools comprises several programs for manipulating PostScript
+Type 1, Type 1 Multiple Master, OpenType, and TrueType fonts.
+
+**cfftot1** translates a Compact Font Format (CFF) font, or a
+PostScript-flavored OpenType font, into PostScript Type 1 format. It
+correctly handles subroutines and hints.
+
+**mmafm** creates an AFM file (font metrics) corresponding to an instance of
+a Type 1 Multiple Master font. It reads the AMFM and AFM files distributed
+with the font.
+
+**mmpfb** creates a normal, single-master font program which looks like an
+instance of a Type 1 Multiple Master font. It reads the multiple master font
+program in PFA or PFB format.
+
+**otfinfo** reports information about OpenType and TrueType fonts, such as
+the OpenType features and Unicode code points they support, or the contents
+of their `size` optical size features.
+
+**otftotfm** creates TeX font metrics and encodings that correspond to an
+OpenType or TrueType font. It interprets glyph positionings, substitutions,
+and ligatures as far as it is able. You can say which OpenType features
+should be activated.
+
+**t1dotlessj** reads a Type 1 font, then creates a new Type 1 font whose
+only character is a dotless lower-case j matching the input font’s design.
+
+**t1lint** checks Type 1 fonts for correctness. It tests most of the
+requirements listed in Adobe Systems’ Black Book (“Adobe Type 1 Font
+Format”), and some others.
+
+**t1rawafm** creates an AFM font metrics file corresponding to a raw Type 1
+font file (in PFA or PFB format).
+
+**t1reencode** reencodes a Type 1 font, replacing its internal encoding with
+one you specify.
+
+**t1testpage** creates PostScript test pages for a given Type 1 font. These
+pages show every character defined in the font.
+
+**ttftotype42** creates a Type 42 wrapper for a TrueType or
+TrueType-flavored OpenType font. This allows the font to be embedded in a
+PostScript file.
+
+Each of these programs has a manual page; `man PROGRAMNAME/PROGRAMNAME.1`
+for more information.
+
+See `NEWS` in this directory for changes in recent versions. The LCDF
+Typetools home page is:
+
+http://www.lcdf.org/type/
+
+
+Installation
+------------
+
+Type `./configure`, then `make`.
+
+If `./configure` does not exist (you downloaded from Github), run
+`./bootstrap.sh` first.
+
+`./configure` accepts the usual options; see `INSTALL` for details.
+Some of the typetools programs can link with additional libraries. Otftotfm
+can use the Kpathsea library for integration with TeX directories; if your
+version of this library is in a nonstandard place, supply `./configure` with
+the `--with-kpathsea=PREFIX` option to find it.
+
+You can also disable individual programs by supplying `./configure` with
+`--disable-PROGNAME` options. See `./configure --help` for more
+information.
+
+
+Mmafm and mmpfb
+---------------
+
+Run `mmafm --help` and `mmpfb --help` for a full option summary. Here are
+two example runs:
+
+ % mmafm MyriadMM.amfm --weight=300 --width=585 > MyriadMM_300_585_.afm
+ % mmpfb MyriadMM.pfb --weight=300 --width=585 > MyriadMM_300_585_.pfb
+
+Mmafm expects the name of an AMFM file on the command line. It also needs
+an AFM file for each master (these should have been distributed with the
+AMFM file). You can give the AFM files’ names on the command line, along
+with the AMFM file, or you let mmafm find the AFM files automatically. For
+the automatic method, you must follow one of these 2 conventions:
+
+1. The AFM files are in the same directory as the AMFM file. They are
+named `FONTNAME.afm` -- `MyriadMM-LightCn.afm`, for example.
+
+2. There is a `PSres.upr` file that lists the AFMs by font name, and the
+`PSRESOURCEPATH` environment variable contains the directory with that
+`PSres.upr` file. (`ps2pk` comes with a sample `PSres.upr` file.)
+
+
+Copyright and license
+---------------------
+
+All source code is Copyright (c) 1997-2015 Eddie Kohler.
+
+This code is distributed under the GNU General Public License, Version 2
+(and only Version 2). The GNU General Public License is available via the
+Web at <http://www.gnu.org/licenses/gpl.html>, or in the COPYING file in
+this directory.
+
+
+Author
+------
+
+Eddie Kohler <ekohler@gmail.com>, http://www.lcdf.org/
+
+The current version of the lcdf-typetools package is available on the Web at
+http://www.lcdf.org/type/
+
+LCDF stands for Little Cambridgeport Design Factory.
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/autoconf.h.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/autoconf.h.in
index e85d1263fd1..e85d1263fd1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/autoconf.h.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/autoconf.h.in
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.am
index 8f63f7a06e8..8f63f7a06e8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.in
index 523c34ad2a2..04bf5ce7628 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = cfftot1$(EXEEXT)
-subdir = lcdf-typetools-2.104/cfftot1
+subdir = lcdf-typetools-2.105/cfftot1
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -386,9 +386,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/cfftot1/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/cfftot1/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/cfftot1/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/cfftot1/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.1
index 4e56b899fc7..9e29aaafe67 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.cc
index e4d37e59ec9..e4d37e59ec9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/cfftot1.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/cfftot1.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.cc
index ff17b98b5d9..ff17b98b5d9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.hh
index 75f2527897f..75f2527897f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/cfftot1/maket1font.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/cfftot1/maket1font.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/configure.ac b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/configure.ac
index bf1eac21337..ea8daf4cbdb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/configure.ac
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([lcdf-typetools], [2.104])
+AC_INIT([lcdf-typetools], [2.105])
AC_CONFIG_SRCDIR([NEWS])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([autoconf.h])
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphlist.txt b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphlist.txt
index 0304ffc6674..0304ffc6674 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphlist.txt
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphlist.txt
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphtounicode.tex b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphtounicode.tex
index adaf8c82fc1..adaf8c82fc1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/glyphtounicode.tex
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/glyphtounicode.tex
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/config.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/config.h
index 18cab5cff07..18cab5cff07 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/config.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/config.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afm.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afm.hh
index f462e0079a4..5c37d1e942e 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afm.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afm.hh
@@ -14,7 +14,7 @@ struct AfmMetricsXt: public MetricsXt {
PermString notice;
PermString encoding_scheme;
- PermString kind() const { return "AFM"; }
+ PermString kind() const { return "AFM"; }
};
@@ -41,7 +41,7 @@ class AfmReader { public:
void y_width_warning() const;
void no_match_warning(const char *context = 0) const;
- double &fd(int i) { return _afm->fd(i); }
+ double &fd(int i) { return _afm->fd(i); }
GlyphIndex find_err(PermString, const char *) const;
void read_char_metric_data() const;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmparse.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmparse.hh
index c29d990ceab..c97c4949b0c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmparse.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmparse.hh
@@ -10,29 +10,29 @@ class AfmParser { public:
AfmParser(Slurper &);
- bool ok() const { return _slurper.ok(); }
- operator Landmark() const { return _slurper.landmark(); }
- Landmark landmark() const { return _slurper.landmark(); }
- unsigned lineno() const { return _slurper.lineno(); }
- const Filename &filename() const { return _slurper.filename(); }
+ bool ok() const { return _slurper.ok(); }
+ operator Landmark() const { return _slurper.landmark(); }
+ Landmark landmark() const { return _slurper.landmark(); }
+ unsigned lineno() const { return _slurper.lineno(); }
+ const Filename &filename() const { return _slurper.filename(); }
- bool key_matched() const { return _fail_field >= 0; }
- int fail_field() const { return _fail_field; }
- PermString message() const { return _message; }
- void clear_message() { _message = PermString(); }
+ bool key_matched() const { return _fail_field >= 0; }
+ int fail_field() const { return _fail_field; }
+ PermString message() const { return _message; }
+ void clear_message() { _message = PermString(); }
PermString keyword() const;
bool is(const char *, ...);
bool isall(const char *, ...);
inline bool next_line();
- void save_line() { _slurper.save_line(); }
+ void save_line() { _slurper.save_line(); }
void skip_until(unsigned char);
- unsigned char *cur_line() const { return _pos; }
- unsigned char first() const { return _pos[0]; }
+ unsigned char *cur_line() const { return _pos; }
+ unsigned char first() const { return _pos[0]; }
unsigned char operator[](int i) const { return _pos[i]; }
- bool left() const { return *_pos != 0; }
+ bool left() const { return *_pos != 0; }
private:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmw.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmw.hh
index 4eda701b688..d901b3cd3c2 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/afmw.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/afmw.hh
@@ -19,7 +19,7 @@ class AfmWriter { public:
void write_kerns() const;
void write();
- double fd(int i) const { return _m->fd(i); }
+ double fd(int i) const { return _m->fd(i); }
AfmWriter(Metrics *, FILE *);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/amfm.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/amfm.hh
index 6cc1db90b6e..55cf1909546 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/amfm.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/amfm.hh
@@ -24,7 +24,7 @@ struct AmfmMaster {
bool loaded;
Metrics *afm;
- AmfmMaster() : loaded(0), afm(0) { }
+ AmfmMaster() : loaded(0), afm(0) { }
};
@@ -44,25 +44,25 @@ class AmfmMetrics { public:
AmfmMetrics(MetricsFinder *);
~AmfmMetrics();
- void use() { _uses++; }
- void unuse() { if (--_uses == 0) delete this; }
+ void use() { _uses++; }
+ void unuse() { if (--_uses == 0) delete this; }
bool sanity(ErrorHandler *) const;
- double fd(int i) const { return _fdv[i]; }
- double &fd(int i) { return _fdv[i]; }
+ double fd(int i) const { return _fdv[i]; }
+ double &fd(int i) { return _fdv[i]; }
- PermString font_name() const { return _font_name; }
- PermString directory() const { return _directory; }
+ PermString font_name() const { return _font_name; }
+ PermString directory() const { return _directory; }
- int naxes() const { return _naxes; }
- int nmasters() const { return _nmasters; }
+ int naxes() const { return _naxes; }
+ int nmasters() const { return _nmasters; }
MultipleMasterSpace *mmspace() const { return _mmspace; }
int primary_label_value(int, PermString) const;
Metrics *interpolate(const Vector<double> &design,
- const Vector<double> &weight, ErrorHandler *);
+ const Vector<double> &weight, ErrorHandler *);
private:
@@ -96,8 +96,8 @@ class AmfmMetrics { public:
friend class AmfmReader;
- AmfmMetrics(const AmfmMetrics &) { assert(0); }
- AmfmMetrics &operator=(const AmfmMetrics &) { assert(0); return *this; }
+ AmfmMetrics(const AmfmMetrics &) { assert(0); }
+ AmfmMetrics &operator=(const AmfmMetrics &) { assert(0); return *this; }
AmfmPrimaryFont *find_primary_font(const Vector<double> &design) const;
@@ -122,9 +122,9 @@ class AmfmReader { public:
MultipleMasterSpace *_mmspace;
ErrorHandler *_errh;
- double &fd(int i) const { return _amfm->fd(i); }
- int naxes() const { return _amfm->_naxes; }
- int nmasters() const { return _amfm->_nmasters; }
+ double &fd(int i) const { return _amfm->fd(i); }
+ int naxes() const { return _amfm->_naxes; }
+ int nmasters() const { return _amfm->_nmasters; }
void check_mmspace();
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/cff.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/cff.hh
index 3035fe76a60..e33c74abf00 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/cff.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/cff.hh
@@ -22,54 +22,54 @@ class Cff { public:
ErrorHandler* errh = 0);
~Cff();
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
- const String &data_string() const { return _data_string; }
- const uint8_t *data() const { return _data; }
- int length() const { return _len; }
+ const String &data_string() const { return _data_string; }
+ const uint8_t *data() const { return _data; }
+ int length() const { return _len; }
- int nfonts() const { return _name_index.size(); }
- PermString font_name(int i) const { return _name_index[i]; }
+ int nfonts() const { return _name_index.size(); }
+ PermString font_name(int i) const { return _name_index[i]; }
FontParent *font(PermString = PermString(), ErrorHandler * = 0);
enum { NSTANDARD_STRINGS = 391, MAX_SID = 64999 };
- int max_sid() const { return NSTANDARD_STRINGS - 1 + _strings.size(); }
+ int max_sid() const { return NSTANDARD_STRINGS - 1 + _strings.size(); }
int sid(PermString);
String sid_string(int sid) const;
PermString sid_permstring(int sid) const;
- int ngsubrs() const { return _gsubrs_index.nitems(); }
+ int ngsubrs() const { return _gsubrs_index.nitems(); }
Charstring *gsubr(int i);
- unsigned units_per_em() const { return _units_per_em; }
+ unsigned units_per_em() const { return _units_per_em; }
enum DictOperator {
- oVersion = 0, oNotice = 1, oFullName = 2, oFamilyName = 3,
- oWeight = 4, oFontBBox = 5, oBlueValues = 6, oOtherBlues = 7,
- oFamilyBlues = 8, oFamilyOtherBlues = 9, oStdHW = 10, oStdVW = 11,
- oUniqueID = 13, oXUID = 14, oCharset = 15, oEncoding = 16,
- oCharStrings = 17, oPrivate = 18, oSubrs = 19, oDefaultWidthX = 20,
- oNominalWidthX = 21,
- oCopyright = 32 + 0, oIsFixedPitch = 32 + 1, oItalicAngle = 32 + 2,
- oUnderlinePosition = 32 + 3, oUnderlineThickness = 32 + 4,
- oPaintType = 32 + 5, oCharstringType = 32 + 6, oFontMatrix = 32 + 7,
- oStrokeWidth = 32 + 8, oBlueScale = 32 + 9, oBlueShift = 32 + 10,
- oBlueFuzz = 32 + 11, oStemSnapH = 32 + 12, oStemSnapV = 32 + 13,
- oForceBold = 32 + 14, oLanguageGroup = 32 + 17,
- oExpansionFactor = 32 + 18, oInitialRandomSeed = 32 + 19,
- oSyntheticBase = 32 + 20, oPostScript = 32 + 21,
- oBaseFontName = 32 + 22, oBaseFontBlend = 32 + 23,
- oROS = 32 + 30, oCIDFontVersion = 32 + 31, oCIDFontRevision = 32 + 32,
- oCIDFontType = 32 + 33, oCIDCount = 32 + 34, oUIDBase = 32 + 35,
- oFDArray = 32 + 36, oFDSelect = 32 + 37, oFontName = 32 + 38,
- oLastOperator = oFontName
+ oVersion = 0, oNotice = 1, oFullName = 2, oFamilyName = 3,
+ oWeight = 4, oFontBBox = 5, oBlueValues = 6, oOtherBlues = 7,
+ oFamilyBlues = 8, oFamilyOtherBlues = 9, oStdHW = 10, oStdVW = 11,
+ oUniqueID = 13, oXUID = 14, oCharset = 15, oEncoding = 16,
+ oCharStrings = 17, oPrivate = 18, oSubrs = 19, oDefaultWidthX = 20,
+ oNominalWidthX = 21,
+ oCopyright = 32 + 0, oIsFixedPitch = 32 + 1, oItalicAngle = 32 + 2,
+ oUnderlinePosition = 32 + 3, oUnderlineThickness = 32 + 4,
+ oPaintType = 32 + 5, oCharstringType = 32 + 6, oFontMatrix = 32 + 7,
+ oStrokeWidth = 32 + 8, oBlueScale = 32 + 9, oBlueShift = 32 + 10,
+ oBlueFuzz = 32 + 11, oStemSnapH = 32 + 12, oStemSnapV = 32 + 13,
+ oForceBold = 32 + 14, oLanguageGroup = 32 + 17,
+ oExpansionFactor = 32 + 18, oInitialRandomSeed = 32 + 19,
+ oSyntheticBase = 32 + 20, oPostScript = 32 + 21,
+ oBaseFontName = 32 + 22, oBaseFontBlend = 32 + 23,
+ oROS = 32 + 30, oCIDFontVersion = 32 + 31, oCIDFontRevision = 32 + 32,
+ oCIDFontType = 32 + 33, oCIDCount = 32 + 34, oUIDBase = 32 + 35,
+ oFDArray = 32 + 36, oFDSelect = 32 + 37, oFontName = 32 + 38,
+ oLastOperator = oFontName
};
enum DictType {
- tNone = 0, tSID, tFontNumber, tBoolean, tNumber, tOffset, tLocalOffset,
- tArray, tArray2, tArray3, tArray4, tArray5, tArray6, tPrivateType,
- tTypeMask = 0x7F, tPrivate = 0x80, tP = tPrivate
+ tNone = 0, tSID, tFontNumber, tBoolean, tNumber, tOffset, tLocalOffset,
+ tArray, tArray2, tArray3, tArray4, tArray5, tArray6, tPrivateType,
+ tTypeMask = 0x7F, tPrivate = 0x80, tP = tPrivate
};
static const char * const operator_names[];
@@ -78,33 +78,33 @@ class Cff { public:
class IndexIterator { public:
- IndexIterator() : _offset(0), _last_offset(0), _offsize(-1) { }
- IndexIterator(const uint8_t *, int, int, ErrorHandler * = 0, const char *index_name = "INDEX");
+ IndexIterator() : _offset(0), _last_offset(0), _offsize(-1) { }
+ IndexIterator(const uint8_t *, int, int, ErrorHandler * = 0, const char *index_name = "INDEX");
- int error() const { return (_offsize < 0 ? _offsize : 0); }
+ int error() const { return (_offsize < 0 ? _offsize : 0); }
typedef bool (IndexIterator::*unspecified_bool_type)() const;
- bool live() const { return _offset < _last_offset; }
- operator unspecified_bool_type() const {
+ bool live() const { return _offset < _last_offset; }
+ operator unspecified_bool_type() const {
return live() ? &IndexIterator::live : 0;
}
- int nitems() const;
+ int nitems() const;
- inline const uint8_t *operator*() const;
- inline const uint8_t *operator[](int) const;
- const uint8_t *index_end() const;
+ inline const uint8_t *operator*() const;
+ inline const uint8_t *operator[](int) const;
+ const uint8_t *index_end() const;
- void operator++() { _offset += _offsize; }
- void operator++(int) { ++(*this); }
+ void operator++() { _offset += _offsize; }
+ void operator++(int) { ++(*this); }
private:
- const uint8_t *_contents;
- const uint8_t *_offset;
- const uint8_t *_last_offset;
- int _offsize;
+ const uint8_t *_contents;
+ const uint8_t *_offset;
+ const uint8_t *_last_offset;
+ int _offsize;
- inline uint32_t offset_at(const uint8_t *) const;
+ inline uint32_t offset_at(const uint8_t *) const;
};
@@ -144,8 +144,8 @@ class Cff::Dict { public:
Dict(Cff *, int pos, int dict_len, ErrorHandler * = 0, const char *dict_name = "DICT");
int assign(Cff *, int pos, int dict_len, ErrorHandler * = 0, const char *dict_name = "DICT");
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
int check(bool is_private, ErrorHandler * = 0, const char *dict_name = "DICT") const;
@@ -173,14 +173,14 @@ class Cff::Dict { public:
class Cff::Charset { public:
- Charset() : _error(-1) { }
+ Charset() : _error(-1) { }
Charset(const Cff *, int pos, int nglyphs, int max_sid, ErrorHandler * = 0);
void assign(const Cff *, int pos, int nglyphs, int max_sid, ErrorHandler * = 0);
- int error() const { return _error; }
+ int error() const { return _error; }
- int nglyphs() const { return _sids.size(); }
- int nsids() const { return _gids.size(); }
+ int nglyphs() const { return _sids.size(); }
+ int nsids() const { return _gids.size(); }
inline int gid_to_sid(int gid) const;
inline int sid_to_gid(int sid) const;
@@ -198,13 +198,13 @@ class Cff::Charset { public:
class Cff::FDSelect { public:
- FDSelect() : _fds(0), _my_fds(false), _nglyphs(0), _error(-1) { }
+ FDSelect() : _fds(0), _my_fds(false), _nglyphs(0), _error(-1) { }
~FDSelect();
void assign(const Cff *, int pos, int nglyphs, ErrorHandler * = 0);
- int error() const { return _error; }
+ int error() const { return _error; }
- int nglyphs() const { return _nglyphs; }
+ int nglyphs() const { return _nglyphs; }
inline int gid_to_fd(int gid) const;
private:
@@ -225,11 +225,11 @@ class Cff::FontParent : public CharstringProgram { public:
FontParent(Cff* cff);
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
- int ngsubrs_x() const { return _cff->ngsubrs(); }
- int ngsubrs() const { return ngsubrs_x(); }
+ int ngsubrs_x() const { return _cff->ngsubrs(); }
+ int ngsubrs() const { return ngsubrs_x(); }
Charstring *gsubr(int) const;
int gsubr_bias() const;
@@ -255,10 +255,10 @@ class Cff::CIDFont : public Cff::FontParent { public:
CIDFont(Cff* cff, PermString, const Dict &, ErrorHandler *);
~CIDFont();
- PermString font_name() const { return _font_name; }
+ PermString font_name() const { return _font_name; }
void font_matrix(double[6]) const;
- int nglyphs() const { return _charstrings_index.nitems(); }
+ int nglyphs() const { return _charstrings_index.nitems(); }
PermString glyph_name(int) const;
void glyph_names(Vector<PermString> &) const;
Charstring *glyph(int) const;
@@ -296,23 +296,23 @@ class Cff::ChildFont : public Cff::FontParent { public:
ChildFont(Cff* cff, Cff::CIDFont *, int charstring_type, const Dict &, ErrorHandler * = 0);
~ChildFont();
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
- PermString font_name() const { return _parent->font_name(); }
- void font_matrix(double m[6]) const { _parent->font_matrix(m); }
+ PermString font_name() const { return _parent->font_name(); }
+ void font_matrix(double m[6]) const { _parent->font_matrix(m); }
inline bool cid() const;
- int nsubrs_x() const { return _subrs_index.nitems(); }
- int nsubrs() const { return nsubrs_x(); }
+ int nsubrs_x() const { return _subrs_index.nitems(); }
+ int nsubrs() const { return nsubrs_x(); }
Charstring *subr(int) const;
int subr_bias() const;
- int nglyphs() const { return _parent->nglyphs(); }
- PermString glyph_name(int gi) const { return _parent->glyph_name(gi); }
+ int nglyphs() const { return _parent->nglyphs(); }
+ PermString glyph_name(int gi) const { return _parent->glyph_name(gi); }
void glyph_names(Vector<PermString> &v) const { _parent->glyph_names(v); }
- Charstring *glyph(int gi) const { return _parent->glyph(gi); }
+ Charstring *glyph(int gi) const { return _parent->glyph(gi); }
Charstring *glyph(PermString n) const { return _parent->glyph(n); }
double global_width_x(bool) const;
@@ -344,10 +344,10 @@ class Cff::Font : public Cff::ChildFont { public:
Font(Cff* cff, PermString, const Dict &, ErrorHandler *);
~Font();
- PermString font_name() const { return _font_name; }
+ PermString font_name() const { return _font_name; }
void font_matrix(double[6]) const;
- int nglyphs() const { return _charstrings_index.nitems(); }
+ int nglyphs() const { return _charstrings_index.nitems(); }
PermString glyph_name(int) const;
void glyph_names(Vector<PermString> &) const;
Charstring *glyph(int) const;
@@ -361,7 +361,7 @@ class Cff::Font : public Cff::ChildFont { public:
String dict_string(DictOperator) const;
inline bool dict_value(DictOperator, double *) const;
inline bool dict_value(DictOperator, Vector<double> &) const;
- const Dict &top_dict() const { return _top_dict; }
+ const Dict &top_dict() const { return _top_dict; }
private:
@@ -388,15 +388,15 @@ inline uint32_t Cff::IndexIterator::offset_at(const uint8_t *x) const
{
switch (_offsize) {
case 0:
- return 0;
+ return 0;
case 1:
- return x[0];
+ return x[0];
case 2:
- return (x[0] << 8) | x[1];
+ return (x[0] << 8) | x[1];
case 3:
- return (x[0] << 16) | (x[1] << 8) | x[2];
+ return (x[0] << 16) | (x[1] << 8) | x[2];
default:
- return (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3];
+ return (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3];
}
}
@@ -415,25 +415,25 @@ inline const uint8_t *Cff::IndexIterator::operator[](int which) const
inline int Cff::Charset::gid_to_sid(int gid) const
{
if (gid >= 0 && gid < _sids.size())
- return _sids[gid];
+ return _sids[gid];
else
- return -1;
+ return -1;
}
inline int Cff::Charset::sid_to_gid(int sid) const
{
if (sid >= 0 && sid < _gids.size())
- return _gids[sid];
+ return _gids[sid];
else
- return -1;
+ return -1;
}
inline int Cff::FDSelect::gid_to_fd(int gid) const
{
if (gid >= 0 && gid < _nglyphs)
- return _fds[gid];
+ return _fds[gid];
else
- return -1;
+ return -1;
}
inline bool Cff::Dict::has_first(DictOperator op) const
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/encoding.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/encoding.hh
index fd8d749acec..eb7aa004f28 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/encoding.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/encoding.hh
@@ -12,14 +12,14 @@ class Encoding8 {
public:
- Encoding8() : _code_map(256, -1) { }
+ Encoding8() : _code_map(256, -1) { }
void reserve_glyphs(int);
- int code(GlyphIndex gi) const { return _codes[gi]; }
- GlyphIndex find_code(int c) const { return _code_map[c]; }
+ int code(GlyphIndex gi) const { return _codes[gi]; }
+ GlyphIndex find_code(int c) const { return _code_map[c]; }
- void set_code(GlyphIndex gi, int c) { _codes[gi] = c; _code_map[c] = gi; }
+ void set_code(GlyphIndex gi, int c) { _codes[gi] = c; _code_map[c] = gi; }
};
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/findmet.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/findmet.hh
index 74b3ecee141..542ed6dddc6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/findmet.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/findmet.hh
@@ -13,10 +13,10 @@ class PsresDatabase;
class MetricsFinder { public:
- MetricsFinder() : _next(0), _prev(0) { }
+ MetricsFinder() : _next(0), _prev(0) { }
virtual ~MetricsFinder();
- MetricsFinder *next() const { return _next; }
+ MetricsFinder *next() const { return _next; }
void add_finder(MetricsFinder *);
@@ -35,8 +35,8 @@ class MetricsFinder { public:
MetricsFinder *_next;
MetricsFinder *_prev;
- MetricsFinder(const MetricsFinder &) { }
- MetricsFinder &operator=(const MetricsFinder &) { return *this; }
+ MetricsFinder(const MetricsFinder &) { }
+ MetricsFinder &operator=(const MetricsFinder &) { return *this; }
protected:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/metrics.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/metrics.hh
new file mode 100644
index 00000000000..82c5eb0d26f
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/metrics.hh
@@ -0,0 +1,177 @@
+// -*- related-file-name: "../../libefont/metrics.cc" -*-
+#ifndef EFONT_METRICS_HH
+#define EFONT_METRICS_HH
+#include <lcdf/permstr.hh>
+#include <lcdf/vector.hh>
+#include <lcdf/hashmap.hh>
+#include <efont/encoding.hh>
+#include <efont/pairop.hh>
+namespace Efont {
+class MetricsXt;
+
+class Metrics { public:
+
+ Metrics();
+ Metrics(PermString font_name, PermString full_name, const Metrics &);
+ ~Metrics();
+
+ void use() { _uses++; }
+ void unuse() { if (--_uses == 0) delete this; }
+
+ // GLOBALS
+
+ PermString font_name() const { return _font_name; }
+ PermString family() const { return _family; }
+ PermString full_name() const { return _full_name; }
+ PermString weight() const { return _weight; }
+ PermString version() const { return _version; }
+
+ void set_font_name(PermString);
+ void set_family(PermString s) { _family = s; }
+ void set_full_name(PermString s) { _full_name = s; }
+ void set_weight(PermString s) { _weight = s; }
+ void set_version(PermString s) { _version = s; }
+
+ // GLYPHS
+
+ int nglyphs() const { return _names.size(); }
+ PermString name(GlyphIndex gi) const { return _names[gi]; }
+ GlyphIndex find(PermString n) const { return _name_map[n]; }
+
+ int code(GlyphIndex gi) const { return _encoding.code(gi); }
+ GlyphIndex find_code(int c) const { return _encoding.find_code(c); }
+ void set_code(GlyphIndex gi, int c) { _encoding.set_code(gi, c); }
+
+ GlyphIndex add_glyph(PermString);
+ void reserve_glyphs(int);
+
+ // DIMENSIONS
+
+ double scale() const { return _scale; }
+ void set_scale(double d) { _scale = d; }
+
+ int nfd() const { return _fdv.size(); }
+ int nkv() const { return _kernv.size(); }
+
+ double fd(int i) const { return _fdv[i]; }
+ double wd(int i) const { return _wdv[i]; }
+ double lf(int i) const { return _lfv[i]; }
+ double rt(int i) const { return _rtv[i]; }
+ double tp(int i) const { return _tpv[i]; }
+ double bt(int i) const { return _btv[i]; }
+ double kv(int i) const { return _kernv[i]; }
+
+ double &fd(int i) { return _fdv[i]; }
+ double &wd(int i) { return _wdv[i]; }
+ double &lf(int i) { return _lfv[i]; }
+ double &rt(int i) { return _rtv[i]; }
+ double &tp(int i) { return _tpv[i]; }
+ double &bt(int i) { return _btv[i]; }
+ double &kv(int i) { return _kernv[i]; }
+
+ inline int add_kv(double d);
+
+ void interpolate_dimens(const Metrics &, double, bool increment);
+
+ // PAIR PROGRAM
+
+ PairProgram *pair_program() { return &_pairp; }
+ const PairProgram *pair_program() const { return &_pairp; }
+ inline bool add_kern(GlyphIndex, GlyphIndex, int);
+ inline bool add_lig(GlyphIndex, GlyphIndex, GlyphIndex, int = opLigSimple);
+
+ // EXTENSIONS
+
+ MetricsXt *find_xt(PermString name) const { return _xt[_xt_map[name]]; }
+ void add_xt(MetricsXt *);
+
+ private:
+
+ PermString _font_name;
+
+ PermString _family;
+ PermString _full_name;
+ PermString _weight;
+ PermString _version;
+
+ HashMap<PermString, GlyphIndex> _name_map;
+ Vector<PermString> _names;
+ Encoding8 _encoding;
+
+ double _scale;
+
+ Vector<double> _fdv;
+ Vector<double> _wdv;
+ Vector<double> _lfv;
+ Vector<double> _rtv;
+ Vector<double> _tpv;
+ Vector<double> _btv;
+
+ PairProgram _pairp;
+ Vector<double> _kernv;
+
+ HashMap<PermString, int> _xt_map;
+ Vector<MetricsXt *> _xt;
+
+ unsigned _uses;
+
+};
+
+
+class MetricsXt {
+
+ public:
+
+ MetricsXt() { }
+ virtual ~MetricsXt() { }
+
+ virtual PermString kind() const = 0;
+
+ virtual void reserve_glyphs(int) { }
+
+};
+
+
+enum FontDimensionDefs {
+
+ fdCapHeight = 0,
+ fdXHeight,
+ fdAscender,
+ fdDescender,
+
+ fdItalicAngle,
+ fdUnderlinePosition,
+ fdUnderlineThickness,
+
+ fdFontBBllx,
+ fdFontBBlly,
+ fdFontBBurx,
+ fdFontBBury,
+
+ fdStdHW,
+ fdStdVW,
+
+ fdLast
+
+};
+
+
+inline bool Metrics::add_kern(GlyphIndex g1, GlyphIndex g2, int ki)
+{
+ return _pairp.add_kern(g1, g2, ki);
+}
+
+inline bool Metrics::add_lig(GlyphIndex g1, GlyphIndex g2, GlyphIndex gr, int kind)
+{
+ return _pairp.add_lig(g1, g2, gr, kind);
+}
+
+inline int Metrics::add_kv(double d)
+{
+ int k = _kernv.size();
+ _kernv.push_back(d);
+ return k;
+}
+
+}
+#endif
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otf.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otf.hh
index b8fb5c50e05..c47c1c29cf8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otf.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otf.hh
@@ -8,26 +8,26 @@ namespace Efont { namespace OpenType {
class Post;
class Name;
-typedef int Glyph; // 16-bit integer
+typedef int Glyph; // 16-bit integer
class Tag {
public:
- Tag() : _tag(0U) { }
- explicit Tag(uint32_t tag) : _tag(tag) { }
+ Tag() : _tag(0U) { }
+ explicit Tag(uint32_t tag) : _tag(tag) { }
Tag(const char *name);
Tag(const String &name);
// default destructor
- static Tag head_tag() { return Tag(0x68656164U); }
+ static Tag head_tag() { return Tag(0x68656164U); }
typedef bool (Tag::*unspecified_bool_type)() const;
- bool null() const { return _tag == 0; }
+ bool null() const { return _tag == 0; }
operator unspecified_bool_type() const {
return _tag != 0 ? &Tag::null : 0;
}
bool valid() const;
- uint32_t value() const { return _tag; }
+ uint32_t value() const { return _tag; }
String text() const;
static String langsys_text(Tag script, Tag langsys = Tag());
@@ -51,15 +51,15 @@ class Font {
Font(const String& str, ErrorHandler* errh = 0);
// default destructor
- bool ok() const { return _error >= 0; }
+ bool ok() const { return _error >= 0; }
bool check_checksums(ErrorHandler* errh = 0) const;
- int error() const { return _error; }
+ int error() const { return _error; }
- const String& data_string() const { return _str; }
- const uint8_t* data() const { return _str.udata(); }
- int length() const { return _str.length(); }
+ const String& data_string() const { return _str; }
+ const uint8_t* data() const { return _str.udata(); }
+ int length() const { return _str.length(); }
- unsigned units_per_em() const { return _units_per_em; }
+ unsigned units_per_em() const { return _units_per_em; }
int ntables() const;
bool has_table(Tag tag) const;
@@ -83,20 +83,20 @@ class Font {
class ScriptList {
public:
- ScriptList() { }
+ ScriptList() { }
inline ScriptList(const String&, ErrorHandler* = 0);
int assign(const String&, ErrorHandler* = 0);
// default destructor
- bool ok() const { return _str.length() > 0; }
+ bool ok() const { return _str.length() > 0; }
int language_systems(Vector<Tag>& scripts, Vector<Tag>& langsys, ErrorHandler* = 0) const;
int features(Tag script, Tag langsys, int& required_fid, Vector<int>& fids, ErrorHandler* = 0, bool clear_fids = true) const;
private:
enum { SCRIPTLIST_HEADERSIZE = 2, SCRIPT_RECSIZE = 6,
- SCRIPT_HEADERSIZE = 4, LANGSYS_RECSIZE = 6,
- LANGSYS_HEADERSIZE = 6, FEATURE_RECSIZE = 2 };
+ SCRIPT_HEADERSIZE = 4, LANGSYS_RECSIZE = 6,
+ LANGSYS_HEADERSIZE = 6, FEATURE_RECSIZE = 2 };
String _str;
@@ -108,12 +108,12 @@ class ScriptList {
class FeatureList {
public:
- FeatureList() { }
+ FeatureList() { }
inline FeatureList(const String&, ErrorHandler* = 0);
int assign(const String&, ErrorHandler* = 0);
// default destructor
- bool ok() const { return _str.length() > 0; }
+ bool ok() const { return _str.length() > 0; }
Tag tag(int fid) const;
String params(int fid, int length, ErrorHandler* = 0, bool old_style_offset = false) const;
@@ -131,7 +131,7 @@ class FeatureList {
private:
enum { FEATURELIST_HEADERSIZE = 2, FEATURE_RECSIZE = 6,
- FEATURE_HEADERSIZE = 4, LOOKUPLIST_RECSIZE = 2 };
+ FEATURE_HEADERSIZE = 4, LOOKUPLIST_RECSIZE = 2 };
String _str;
@@ -142,62 +142,62 @@ class FeatureList {
class Coverage {
public:
- Coverage() throw (); // empty coverage
- Coverage(Glyph first, Glyph last) throw (); // range coverage
+ Coverage() throw (); // empty coverage
+ Coverage(Glyph first, Glyph last) throw (); // range coverage
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; }
+ 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;
+ 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; }
+ bool covers(Glyph g) const throw () { return coverage_index(g) >= 0; }
void unparse(StringAccum&) const throw ();
String unparse() const throw ();
class iterator { public:
- iterator() : _pos(0), _value(0) { }
- // private constructor
- // default destructor
+ iterator() : _pos(0), _value(0) { }
+ // private constructor
+ // default destructor
- bool ok() const { return _pos < _str.length(); }
- operator bool() const { return ok(); }
+ bool ok() const { return _pos < _str.length(); }
+ operator bool() const { return ok(); }
- Glyph operator*() const { return _value; }
- Glyph value() const { return _value; }
- int coverage_index() const;
+ Glyph operator*() const { return _value; }
+ Glyph value() const { return _value; }
+ int coverage_index() const;
- void operator++(int);
- void operator++() { (*this)++; }
- bool forward_to(Glyph);
+ void operator++(int);
+ void operator++() { (*this)++; }
+ bool forward_to(Glyph);
- // XXX should check iterators are of same type
- bool operator<(const iterator& o) { return _value < o._value; }
- bool operator<=(const iterator& o) { return _value <= o._value; }
- bool operator>=(const iterator& o) { return _value >= o._value; }
- bool operator>(const iterator& o) { return _value > o._value; }
- bool operator==(const iterator& o) { return _value == o._value; }
- bool operator!=(const iterator& o) { return _value != o._value; }
+ // XXX should check iterators are of same type
+ bool operator<(const iterator& o) { return _value < o._value; }
+ bool operator<=(const iterator& o) { return _value <= o._value; }
+ bool operator>=(const iterator& o) { return _value >= o._value; }
+ bool operator>(const iterator& o) { return _value > o._value; }
+ bool operator==(const iterator& o) { return _value == o._value; }
+ bool operator!=(const iterator& o) { return _value != o._value; }
private:
- String _str;
- int _pos;
- Glyph _value;
- friend class Coverage;
- iterator(const String &str, bool is_end);
+ String _str;
+ int _pos;
+ Glyph _value;
+ friend class Coverage;
+ iterator(const String &str, bool is_end);
};
- iterator begin() const { return iterator(_str, false); }
- iterator end() const { return iterator(_str, true); }
+ 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, T_X_BYTEMAP = 3,
- HEADERSIZE = 4, LIST_RECSIZE = 2, RANGES_RECSIZE = 6 };
+ HEADERSIZE = 4, LIST_RECSIZE = 2, RANGES_RECSIZE = 6 };
private:
String _str;
@@ -221,16 +221,16 @@ class GlyphSet {
inline bool covers(Glyph g) const;
inline bool operator[](Glyph g) const;
int change(Glyph, bool);
- void insert(Glyph g) { change(g, true); }
- void remove(Glyph g) { change(g, false); }
+ void insert(Glyph g) { change(g, true); }
+ void remove(Glyph g) { change(g, false); }
GlyphSet& operator=(const GlyphSet&);
private:
enum { GLYPHBITS = 16, SHIFT = 8,
- MAXGLYPH = (1 << GLYPHBITS) - 1, UNSHIFT = GLYPHBITS - SHIFT,
- MASK = (1 << UNSHIFT) - 1, VLEN = (1 << SHIFT),
- VULEN = (1 << UNSHIFT) >> 5
+ MAXGLYPH = (1 << GLYPHBITS) - 1, UNSHIFT = GLYPHBITS - SHIFT,
+ MASK = (1 << UNSHIFT) - 1, VLEN = (1 << SHIFT),
+ VULEN = (1 << UNSHIFT) >> 5
};
uint32_t* _v[VLEN];
@@ -241,7 +241,7 @@ class ClassDef {
ClassDef(const String&, ErrorHandler* = 0) throw ();
// default destructor
- bool ok() const { return _str.length() > 0; }
+ bool ok() const { return _str.length() > 0; }
int nclass() const throw ();
int lookup(Glyph) const throw ();
@@ -252,46 +252,46 @@ class ClassDef {
class class_iterator {
public:
- // private constructor
- // default destructor
+ // private constructor
+ // default destructor
- bool ok() const { return _pos < _str.length(); }
- operator bool() const { return ok(); }
+ bool ok() const { return _pos < _str.length(); }
+ operator bool() const { return ok(); }
- Glyph operator*() const { return *_coviter; }
- Glyph value() const { return *_coviter; }
- int class_value() const { return _class; }
+ Glyph operator*() const { return *_coviter; }
+ Glyph value() const { return *_coviter; }
+ int class_value() const { return _class; }
- void operator++(int);
- void operator++() { (*this)++; }
+ void operator++(int);
+ void operator++() { (*this)++; }
- // XXX should check iterators are of same type
- bool operator<(const class_iterator& o) { return _coviter < o._coviter; }
- bool operator<=(const class_iterator& o) { return _coviter <= o._coviter; }
- bool operator>=(const class_iterator& o) { return _coviter >= o._coviter; }
- bool operator>(const class_iterator& o) { return _coviter > o._coviter; }
- bool operator==(const class_iterator& o) { return _coviter == o._coviter; }
- bool operator!=(const class_iterator& o) { return _coviter != o._coviter; }
+ // XXX should check iterators are of same type
+ bool operator<(const class_iterator& o) { return _coviter < o._coviter; }
+ bool operator<=(const class_iterator& o) { return _coviter <= o._coviter; }
+ bool operator>=(const class_iterator& o) { return _coviter >= o._coviter; }
+ bool operator>(const class_iterator& o) { return _coviter > o._coviter; }
+ bool operator==(const class_iterator& o) { return _coviter == o._coviter; }
+ bool operator!=(const class_iterator& o) { return _coviter != o._coviter; }
private:
- String _str;
- int _pos;
- int _class;
- Coverage::iterator _coviter;
- friend class ClassDef;
- class_iterator(const String&, int, int, const Coverage::iterator&);
- void increment_class0();
- enum { FIRST_POS = -1, LAST_POS = -2 };
+ String _str;
+ int _pos;
+ int _class;
+ Coverage::iterator _coviter;
+ friend class ClassDef;
+ class_iterator(const String&, int, int, const Coverage::iterator&);
+ void increment_class0();
+ enum { FIRST_POS = -1, LAST_POS = -2 };
};
// XXX does not work correctly for class 0
- class_iterator begin(int c) const { return class_iterator(_str, 0, c, Coverage::iterator()); }
+ class_iterator begin(int c) const { return class_iterator(_str, 0, c, Coverage::iterator()); }
class_iterator begin(int c, const Coverage& coverage) const { return class_iterator(_str, 0, c, coverage.begin()); }
- class_iterator end(int c) const { return class_iterator(_str, _str.length(), c, Coverage::iterator()); }
+ class_iterator end(int c) const { return class_iterator(_str, _str.length(), c, Coverage::iterator()); }
enum { T_LIST = 1, T_RANGES = 2,
- LIST_HEADERSIZE = 6, LIST_RECSIZE = 2,
- RANGES_HEADERSIZE = 4, RANGES_RECSIZE = 6 };
+ LIST_HEADERSIZE = 6, LIST_RECSIZE = 2,
+ RANGES_HEADERSIZE = 4, RANGES_RECSIZE = 6 };
private:
String _str;
@@ -354,11 +354,11 @@ inline void FeatureList::filter(Vector<int>& fids, Tag ftag) const {
inline bool GlyphSet::covers(Glyph g) const {
if ((unsigned)g > MAXGLYPH)
- return false;
+ return false;
else if (const uint32_t* u = _v[g >> SHIFT])
- return (u[(g & MASK) >> 5] & (1 << (g & 0x1F))) != 0;
+ return (u[(g & MASK) >> 5] & (1 << (g & 0x1F))) != 0;
else
- return false;
+ return false;
}
inline bool GlyphSet::operator[](Glyph g) const {
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfcmap.hh
index 3ac7f49f9cd..1fdce99802d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfcmap.hh
@@ -3,6 +3,7 @@
#define EFONT_OTFCMAP_HH
#include <efont/otf.hh>
#include <lcdf/error.hh>
+#include <utility>
namespace Efont { namespace OpenType {
class Cmap { public:
@@ -10,12 +11,12 @@ class Cmap { public:
Cmap(const String &, ErrorHandler * = 0);
// default destructor
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
inline Glyph map_uni(uint32_t c) const;
int map_uni(const Vector<uint32_t> &in, Vector<Glyph> &out) const;
- inline void unmap_all(Vector<uint32_t> &g2c) const;
+ inline void unmap_all(Vector<std::pair<uint32_t, Glyph> > &ugp) const;
private:
@@ -26,30 +27,28 @@ class Cmap { public:
mutable Vector<int> _table_error;
enum { HEADER_SIZE = 4, ENCODING_SIZE = 8,
- HIBYTE_SUBHEADERS = 524 };
+ HIBYTE_SUBHEADERS = 524 };
enum Format { F_BYTE = 0, F_HIBYTE = 2, F_SEGMENTED = 4, F_TRIMMED = 6,
- F_HIBYTE32 = 8, F_TRIMMED32 = 10, F_SEGMENTED32 = 12 };
+ F_HIBYTE32 = 8, F_TRIMMED32 = 10, F_SEGMENTED32 = 12 };
enum { USE_FIRST_UNICODE_TABLE = -2 };
int parse_header(ErrorHandler *);
- int first_unicode_table() const { return _first_unicode_table; }
+ int first_unicode_table() const { return _first_unicode_table; }
int first_table(int platform, int encoding) const;
int check_table(int t, ErrorHandler * = 0) const;
Glyph map_table(int t, uint32_t, ErrorHandler * = 0) const;
- void dump_table(int t, Vector<uint32_t> &g2c, ErrorHandler * = 0) const;
+ void dump_table(int t, Vector<std::pair<uint32_t, Glyph> > &ugp, ErrorHandler * = 0) const;
inline const uint8_t* table_data(int t) const;
};
-inline Glyph Cmap::map_uni(uint32_t c) const
-{
+inline Glyph Cmap::map_uni(uint32_t c) const {
return map_table(USE_FIRST_UNICODE_TABLE, c, ErrorHandler::default_handler());
}
-inline void Cmap::unmap_all(Vector<uint32_t> &g2c) const
-{
- dump_table(USE_FIRST_UNICODE_TABLE, g2c, ErrorHandler::default_handler());
+inline void Cmap::unmap_all(Vector<std::pair<uint32_t, Glyph> > &ugp) const {
+ dump_table(USE_FIRST_UNICODE_TABLE, ugp, ErrorHandler::default_handler());
}
inline const uint8_t* Cmap::table_data(int t) const {
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfdata.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfdata.hh
index a78e068bcb3..30e40860291 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfdata.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfdata.hh
@@ -37,39 +37,40 @@ namespace Efont { namespace OpenType {
class Error {
public:
String description;
- Error() : description(String::make_stable("unspecified error")) { }
- Error(const String &d) : description(d) { }
+ Error() : description(String::make_stable("unspecified error")) { }
+ Error(const String &d) : description(d) { }
};
class Bounds : public Error {
public:
- Bounds() : Error(String::make_stable("bounds error")) { }
+ Bounds() : Error(String::make_stable("bounds error")) { }
};
class Format : public Error {
public:
- Format(const String& name) : Error(name + " format error") { }
+ Format(const String& name) : Error(name + " format error") { }
Format(const String& name, const String& type)
- : Error(name + " " + type + " format error") { }
+ : Error(name + " " + type + " format error") { }
};
class BlankTable : public Format {
public:
- BlankTable(const String& name) : Format(name, "blank table") { }
+ BlankTable(const String& name) : Format(name, "blank table") { }
};
class Data {
public:
- Data() { }
- Data(const String& str) : _str(str) { _str.align(2); }
+ Data() { }
+ Data(const String& str) : _str(str) { _str.align(2); }
// default copy constructor
// default destructor
- operator const String&() const { return _str; }
+ const String& string() const { return _str; }
+ operator const String&() const { return _str; }
operator String::unspecified_bool_type() const { return _str; }
- const uint8_t *udata() const { return _str.udata(); }
- int length() const { return _str.length(); }
+ const uint8_t *udata() const { return _str.udata(); }
+ int length() const { return _str.length(); }
static inline uint16_t u16(const unsigned char* s);
static inline uint16_t u16_aligned(const unsigned char* s);
@@ -97,7 +98,7 @@ class Data {
Data offset_subtable(unsigned offset_offset) const throw (Bounds);
inline Data substring(int left, int len = -1) const throw ();
- void align_long() { _str.align(4); }
+ void align_long() { _str.align(4); }
private:
@@ -107,9 +108,9 @@ class Data {
inline uint8_t Data::operator[](unsigned offset) const throw (Bounds) {
if (offset >= static_cast<unsigned>(_str.length()))
- throw Bounds();
+ throw Bounds();
else
- return _str[offset];
+ return _str[offset];
}
inline uint16_t Data::u16(const unsigned char* s) {
@@ -184,30 +185,30 @@ inline int32_t Data::s32_aligned(const unsigned char* s) {
inline uint16_t Data::u16(unsigned offset) const throw (Bounds) {
if (offset + 1 >= static_cast<unsigned>(_str.length()) || offset + 1 == 0)
- throw Bounds();
+ throw Bounds();
else
- return u16_aligned(_str.udata() + offset);
+ return u16_aligned(_str.udata() + offset);
}
inline int16_t Data::s16(unsigned offset) const throw (Bounds) {
if (offset + 1 >= static_cast<unsigned>(_str.length()) || offset + 1 == 0)
- throw Bounds();
+ throw Bounds();
else
- return s16_aligned(_str.udata() + offset);
+ return s16_aligned(_str.udata() + offset);
}
inline uint32_t Data::u32(unsigned offset) const throw (Bounds) {
if (offset + 3 >= static_cast<unsigned>(_str.length()) || offset + 3 < 3)
- throw Bounds();
+ throw Bounds();
else
- return u32_aligned16(_str.udata() + offset);
+ return u32_aligned16(_str.udata() + offset);
}
inline int32_t Data::s32(unsigned offset) const throw (Bounds) {
if (offset + 3 >= static_cast<unsigned>(_str.length()) || offset + 3 < 3)
- throw Bounds();
+ throw Bounds();
else
- return s32_aligned16(_str.udata() + offset);
+ return s32_aligned16(_str.udata() + offset);
}
inline uint8_t Data::operator[](int offset) const throw (Bounds) {
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgpos.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgpos.hh
index 84de5a2126b..ec5573cb964 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgpos.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgpos.hh
@@ -30,14 +30,14 @@ class Gpos { public:
class GposLookup { public:
GposLookup(const Data &) throw (Error);
- int type() const { return _type; }
- uint16_t flags() const { return _d.u16(2); }
+ int type() const { return _type; }
+ uint16_t flags() const { return _d.u16(2); }
bool unparse_automatics(Vector<Positioning> &, ErrorHandler * = 0) const;
enum {
- HEADERSIZE = 6, RECSIZE = 2,
- L_SINGLE = 1, L_PAIR = 2, L_CURSIVE = 3, L_MARKTOBASE = 4,
- L_MARKTOLIGATURE = 5, L_MARKTOMARK = 6, L_CONTEXT = 7,
- L_CHAIN = 8, L_EXTENSION = 9
+ HEADERSIZE = 6, RECSIZE = 2,
+ L_SINGLE = 1, L_PAIR = 2, L_CURSIVE = 3, L_MARKTOBASE = 4,
+ L_MARKTOLIGATURE = 5, L_MARKTOMARK = 6, L_CONTEXT = 7,
+ L_CHAIN = 8, L_EXTENSION = 9
};
private:
Data _d;
@@ -52,14 +52,14 @@ class GposValue { public:
static inline int16_t xadvance(uint16_t format, const Data &);
static inline int16_t yadvance(uint16_t format, const Data &);
enum {
- F_XPLACEMENT = 0x0001,
- F_YPLACEMENT = 0x0002,
- F_XADVANCE = 0x0004,
- F_YADVANCE = 0x0008,
- F_XPLACEMENT_DEVICE = 0x0010,
- F_YPLACEMENT_DEVICE = 0x0020,
- F_XADVANCE_DEVICE = 0x0040,
- F_YADVANCE_DEVICE = 0x0080
+ F_XPLACEMENT = 0x0001,
+ F_YPLACEMENT = 0x0002,
+ F_XADVANCE = 0x0004,
+ F_YADVANCE = 0x0008,
+ F_XPLACEMENT_DEVICE = 0x0010,
+ F_YPLACEMENT_DEVICE = 0x0020,
+ F_XADVANCE_DEVICE = 0x0040,
+ F_YADVANCE_DEVICE = 0x0080
};
private:
static const int nibble_bitcount_x2[];
@@ -81,25 +81,25 @@ class GposPair { public:
Coverage coverage() const throw ();
void unparse(Vector<Positioning> &) const;
enum { F1_HEADERSIZE = 10, F1_RECSIZE = 2,
- PAIRSET_HEADERSIZE = 2, PAIRVALUE_HEADERSIZE = 2,
- F2_HEADERSIZE = 16 };
+ PAIRSET_HEADERSIZE = 2, PAIRVALUE_HEADERSIZE = 2,
+ F2_HEADERSIZE = 16 };
private:
Data _d;
};
struct Position {
Glyph g;
- int pdx, pdy; // placement
- int adx, ady; // advance
+ int pdx, pdy; // placement
+ int adx, ady; // advance
inline 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; }
- bool placed() const { return pdx != 0 || pdy != 0; }
+ 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; }
+ bool placed() const { return pdx != 0 || pdy != 0; }
void unparse(StringAccum &, const Vector<PermString> * = 0) const;
String unparse(const Vector<PermString> * = 0) const;
};
@@ -124,10 +124,10 @@ class Positioning { public:
inline bool is_pairkern() const;
// extract data
- const Position &left() const { return _left; }
- Glyph left_glyph() const { return _left.g; }
- const Position &right() const { return _right; }
- Glyph right_glyph() const { return _right.g; }
+ const Position &left() const { return _left; }
+ Glyph left_glyph() const { return _left.g; }
+ const Position &right() const { return _right; }
+ Glyph right_glyph() const { return _right.g; }
inline void all_in_glyphs(Vector<Glyph> &gs) const;
void unparse(StringAccum &, const Vector<PermString> * = 0) const;
@@ -148,33 +148,33 @@ inline int GposValue::size(uint16_t format)
inline int16_t GposValue::xplacement(uint16_t format, const Data &d)
{
if (format & F_XPLACEMENT)
- return d.s16(0);
+ return d.s16(0);
else
- return 0;
+ return 0;
}
inline int16_t GposValue::yplacement(uint16_t format, const Data &d)
{
if (format & F_YPLACEMENT)
- return d.s16((format & F_XPLACEMENT ? 2 : 0));
+ return d.s16((format & F_XPLACEMENT ? 2 : 0));
else
- return 0;
+ return 0;
}
inline int16_t GposValue::xadvance(uint16_t format, const Data &d)
{
if (format & F_XADVANCE)
- return d.s16(nibble_bitcount_x2[format & (F_XADVANCE - 1)]);
+ return d.s16(nibble_bitcount_x2[format & (F_XADVANCE - 1)]);
else
- return 0;
+ return 0;
}
inline int16_t GposValue::yadvance(uint16_t format, const Data &d)
{
if (format & F_YADVANCE)
- return d.s16(nibble_bitcount_x2[format & (F_YADVANCE - 1)]);
+ return d.s16(nibble_bitcount_x2[format & (F_YADVANCE - 1)]);
else
- return 0;
+ return 0;
}
inline Position::Position()
@@ -240,9 +240,9 @@ inline void Positioning::all_in_glyphs(Vector<Glyph> &gs) const
{
gs.clear();
if (_left.g != 0)
- gs.push_back(_left.g);
+ gs.push_back(_left.g);
if (_right.g != 0)
- gs.push_back(_right.g);
+ gs.push_back(_right.g);
}
}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgsub.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgsub.hh
index 65c721ea4fd..383389e5895 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfgsub.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfgsub.hh
@@ -32,15 +32,15 @@ class Gsub { public:
class GsubLookup { public:
GsubLookup(const Data &) throw (Error);
- int type() const { return _type; }
- uint16_t flags() const { return _d.u16(2); }
+ int type() const { return _type; }
+ uint16_t flags() const { return _d.u16(2); }
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,
- L_SINGLE = 1, L_MULTIPLE = 2, L_ALTERNATE = 3, L_LIGATURE = 4,
- L_CONTEXT = 5, L_CHAIN = 6, L_EXTENSION = 7, L_REVCHAIN = 8
+ HEADERSIZE = 6, RECSIZE = 2,
+ L_SINGLE = 1, L_MULTIPLE = 2, L_ALTERNATE = 3, L_LIGATURE = 4,
+ L_CONTEXT = 5, L_CHAIN = 6, L_EXTENSION = 7, L_REVCHAIN = 8
};
private:
Data _d;
@@ -70,7 +70,7 @@ class GsubMultiple { public:
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,
- SEQ_HEADERSIZE = 2, SEQ_RECSIZE = 2 };
+ SEQ_HEADERSIZE = 2, SEQ_RECSIZE = 2 };
private:
Data _d;
};
@@ -84,8 +84,8 @@ class GsubLigature { public:
void unparse(Vector<Substitution> &) const;
bool apply(const Glyph *, int pos, int n, Substitution &) const;
enum { HEADERSIZE = 6, RECSIZE = 2,
- SET_HEADERSIZE = 2, SET_RECSIZE = 2,
- LIG_HEADERSIZE = 4, LIG_RECSIZE = 2 };
+ SET_HEADERSIZE = 2, SET_RECSIZE = 2,
+ LIG_HEADERSIZE = 4, LIG_RECSIZE = 2 };
private:
Data _d;
};
@@ -105,10 +105,10 @@ class GsubContext { public:
const Gsub& gsub, Vector<Substitution>& outsubs,
Substitution prototype_sub);
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);
+ 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;
};
@@ -119,8 +119,8 @@ class GsubChainContext { public:
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 };
+ F1_SRS_HSIZE = 2, F1_SRS_RSIZE = 2,
+ F3_HSIZE = 4, F3_INPUT_HSIZE = 2, F3_LOOKAHEAD_HSIZE = 2, F3_SUBST_HSIZE = 2 };
private:
Data _d;
bool f1_unparse(const Gsub &gsub, Vector<Substitution> &subs, const Coverage &limit) const;
@@ -210,9 +210,9 @@ class Substitution { public:
enum { T_NONE = 0, T_GLYPH, T_GLYPHS, T_COVERAGE };
typedef union {
- Glyph gid;
- Glyph *gids; // first entry is a count
- Coverage *coverage;
+ Glyph gid;
+ Glyph *gids; // first entry is a count
+ Coverage *coverage;
} Substitute;
Substitute _left;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfname.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfname.hh
index 42f08e614be..692354f0f97 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfname.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfname.hh
@@ -2,7 +2,7 @@
#ifndef EFONT_OTFNAME_HH
#define EFONT_OTFNAME_HH
#include <efont/otf.hh>
-#include <efont/otfdata.hh> // for ntohl()
+#include <efont/otfdata.hh> // for ntohl()
#include <lcdf/error.hh>
namespace Efont { namespace OpenType {
@@ -11,20 +11,20 @@ class Name { public:
Name(const String &, ErrorHandler * = 0);
// default destructor
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
enum NameID { N_COPYRIGHT = 0, N_FAMILY = 1, N_SUBFAMILY = 2,
- N_UNIQUEID = 3, N_FULLNAME = 4, N_VERSION = 5,
- N_POSTSCRIPT = 6, N_TRADEMARK = 7, N_MANUFACTURER = 8,
- N_DESIGNER = 9, N_DESCRIPTION = 10, N_VENDOR_URL = 11,
- N_DESIGNER_URL = 12, N_LICENSE_DESCRIPTION = 13,
- N_LICENSE_URL = 14, N_PREF_FAMILY = 16,
- N_PREF_SUBFAMILY = 17, N_MAC_COMPAT_FULLNAME = 18,
- N_SAMPLE_TEXT = 19, N_POSTSCRIPT_CID = 20 };
+ N_UNIQUEID = 3, N_FULLNAME = 4, N_VERSION = 5,
+ N_POSTSCRIPT = 6, N_TRADEMARK = 7, N_MANUFACTURER = 8,
+ N_DESIGNER = 9, N_DESCRIPTION = 10, N_VENDOR_URL = 11,
+ N_DESIGNER_URL = 12, N_LICENSE_DESCRIPTION = 13,
+ N_LICENSE_URL = 14, N_PREF_FAMILY = 16,
+ N_PREF_SUBFAMILY = 17, N_MAC_COMPAT_FULLNAME = 18,
+ N_SAMPLE_TEXT = 19, N_POSTSCRIPT_CID = 20 };
enum Platform { P_UNICODE = 0, P_MACINTOSH = 1, P_MICROSOFT = 3,
- E_MS_UNICODE_BMP = 1, E_MAC_ROMAN = 0,
- L_MS_ENGLISH_AMERICAN = 0x409 };
+ E_MS_UNICODE_BMP = 1, E_MAC_ROMAN = 0,
+ L_MS_ENGLISH_AMERICAN = 0x409 };
enum { HEADER_SIZE = 6, NAMEREC_SIZE = 12 };
typedef uint8_t namerecord_t[NAMEREC_SIZE];
@@ -45,17 +45,17 @@ class Name { public:
bool version_chaincontext_reverse_backtrack() const;
struct PlatformPred {
- inline PlatformPred(int nameid, int platform = -1, int encoding = -1, int language = -1);
- inline bool operator()(const namerecord_t &) const;
+ inline PlatformPred(int nameid, int platform = -1, int encoding = -1, int language = -1);
+ inline bool operator()(const namerecord_t &) const;
private:
- int _nameid, _platform, _encoding, _language;
+ int _nameid, _platform, _encoding, _language;
};
struct EnglishPlatformPred {
- EnglishPlatformPred(int nameid) : _nameid(nameid) { }
- inline bool operator()(const namerecord_t &) const;
+ EnglishPlatformPred(int nameid) : _nameid(nameid) { }
+ inline bool operator()(const namerecord_t &) const;
private:
- int _nameid;
+ int _nameid;
};
private:
@@ -90,10 +90,10 @@ inline Name::const_iterator Name::begin() const {
inline Name::const_iterator Name::end() const {
if (_error >= 0) {
- int count = Data::u16_aligned(_str.udata() + 2);
- return reinterpret_cast<const_iterator>(_str.udata() + HEADER_SIZE + NAMEREC_SIZE * count);
+ int count = Data::u16_aligned(_str.udata() + 2);
+ return reinterpret_cast<const_iterator>(_str.udata() + HEADER_SIZE + NAMEREC_SIZE * count);
} else
- return reinterpret_cast<const_iterator>(_str.udata() + HEADER_SIZE);
+ return reinterpret_cast<const_iterator>(_str.udata() + HEADER_SIZE);
}
@@ -103,18 +103,18 @@ inline Name::PlatformPred::PlatformPred(int nid, int p, int e, int l)
inline bool Name::PlatformPred::operator()(const namerecord_t &i) const {
return (_nameid == nameid(i))
- && (_platform < 0 || _platform == platform(i))
- && (_encoding < 0 || _encoding == encoding(i))
- && (_language < 0 || _language == language(i));
+ && (_platform < 0 || _platform == platform(i))
+ && (_encoding < 0 || _encoding == encoding(i))
+ && (_language < 0 || _language == language(i));
}
inline bool Name::EnglishPlatformPred::operator()(const namerecord_t &i) const {
if (_nameid == nameid(i)) {
- int p = platform(i), e = encoding(i), l = language(i);
- return (p == P_MACINTOSH && e == E_MAC_ROMAN && l == 0)
- || (p == P_MICROSOFT && e == E_MS_UNICODE_BMP && l == L_MS_ENGLISH_AMERICAN);
+ int p = platform(i), e = encoding(i), l = language(i);
+ return (p == P_MACINTOSH && e == E_MAC_ROMAN && l == 0)
+ || (p == P_MICROSOFT && e == E_MS_UNICODE_BMP && l == L_MS_ENGLISH_AMERICAN);
} else
- return false;
+ return false;
}
} // namespace Efont::OpenType
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfos2.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfos2.hh
index db26b674522..30eaaef1a83 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfos2.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfos2.hh
@@ -11,17 +11,18 @@ class Os2 { public:
Os2(const Data &, ErrorHandler * = 0);
// default destructor
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
enum Offsets { O_AVGCHARWIDTH = 2, O_SUBSCRIPTXSIZE = 10,
- O_SUBSCRIPTYSIZE = 12, O_SUBSCRIPTXOFFSET = 14,
- O_SUBSCRIPTYOFFSET = 16, O_SUPERSCRIPTXSIZE = 18,
- O_SUPERSCRIPTYSIZE = 20, O_SUPERSCRIPTXOFFSET = 22,
- O_SUPERSCRIPTYOFFSET = 24, O_STRIKEOUTSIZE = 26,
- O_STRIKEOUTPOSITION = 28, O_VENDORID = 58,
- O_TYPOASCENDER = 68, O_TYPODESCENDER = 70,
- O_TYPOLINEGAP = 72, O_XHEIGHT = 86, O_CAPHEIGHT = 88 };
+ O_SUBSCRIPTYSIZE = 12, O_SUBSCRIPTXOFFSET = 14,
+ O_SUBSCRIPTYOFFSET = 16, O_SUPERSCRIPTXSIZE = 18,
+ O_SUPERSCRIPTYSIZE = 20, O_SUPERSCRIPTXOFFSET = 22,
+ O_SUPERSCRIPTYOFFSET = 24, O_STRIKEOUTSIZE = 26,
+ O_STRIKEOUTPOSITION = 28, O_VENDORID = 58,
+ O_TYPOASCENDER = 68, O_TYPODESCENDER = 70,
+ O_TYPOLINEGAP = 72, O_XHEIGHT = 86, O_CAPHEIGHT = 88,
+ O_LOWEROPTICALPOINTSIZE = 96, O_UPPEROPTICALPOINTSIZE = 98 };
enum { HEADER_SIZE = 2 };
inline int16_t typo_ascender() const throw (Bounds);
@@ -29,6 +30,9 @@ class Os2 { public:
inline int16_t typo_line_gap() const throw (Bounds);
inline int16_t x_height() const throw (Bounds);
inline int16_t cap_height() const throw (Bounds);
+ inline double lower_optical_point_size() const throw (Bounds);
+ inline double upper_optical_point_size() const throw (Bounds);
+ inline bool has_optical_point_size() const throw ();
inline String vendor_id() const throw ();
private:
@@ -66,9 +70,24 @@ inline int16_t Os2::cap_height() const throw (Bounds)
return _data.s16(O_CAPHEIGHT);
}
+inline double Os2::lower_optical_point_size() const throw (Bounds)
+{
+ return _data.u16(O_LOWEROPTICALPOINTSIZE) / 20.;
+}
+
+inline double Os2::upper_optical_point_size() const throw (Bounds)
+{
+ return _data.u16(O_UPPEROPTICALPOINTSIZE) / 20.;
+}
+
+inline bool Os2::has_optical_point_size() const throw ()
+{
+ return _data.length() >= O_UPPEROPTICALPOINTSIZE + 2;
+}
+
inline String Os2::vendor_id() const throw ()
{
- return _data.substring(O_VENDORID, 4);
+ return _data.substring(O_VENDORID, 4).string();
}
}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfpost.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfpost.hh
index 58651583fcb..57564efc6a3 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfpost.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/otfpost.hh
@@ -10,15 +10,15 @@ class Post { public:
Post(const String &, ErrorHandler * = 0);
// default destructor
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
double italic_angle() const;
bool is_fixed_pitch() const;
inline int underline_position() const;
inline int underline_thickness() const;
inline uint32_t mem_type42(bool ismax) const;
- int nglyphs() const { return _nglyphs; }
+ int nglyphs() const { return _nglyphs; }
bool glyph_names(Vector<PermString> &gnames) const;
private:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/pairop.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/pairop.hh
index bbb42073e44..360912a00d1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/pairop.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/pairop.hh
@@ -6,16 +6,16 @@ namespace Efont {
enum PairOpDefs {
- opNoop = -1,
- opLigature = -2,
+ opNoop = -1,
+ opLigature = -2,
- opLigSimple = 0,
- opLigSaveLeft = 1,
- opLigSaveRight = 2,
- opLigPast1 = 4,
- opLigPast2 = 8,
+ opLigSimple = 0,
+ opLigSaveLeft = 1,
+ opLigSaveRight = 2,
+ opLigPast1 = 4,
+ opLigPast2 = 8,
- opAllblock = 0
+ opAllblock = 0
};
@@ -25,24 +25,24 @@ typedef int PairOpIndex;
class PairOp { public:
- PairOp() { }
+ PairOp() { }
inline PairOp(GlyphIndex l, GlyphIndex r, int v, PairOpIndex nl);
inline PairOp(GlyphIndex l, GlyphIndex r, GlyphIndex x, int kind, PairOpIndex nl);
- void noopify() { _val = opNoop; }
- void set_value(int val) { _val = val; }
+ void noopify() { _val = opNoop; }
+ void set_value(int val) { _val = val; }
inline void set_next(PairOpIndex);
- bool is_lig() const { return _val <= opLigature; }
- bool is_kern() const { return _val >= 0; }
- bool is_noop() const { return _val == opNoop; }
- int lig_kind() const { assert(is_lig()); return -_val+opLigature; }
+ bool is_lig() const { return _val <= opLigature; }
+ bool is_kern() const { return _val >= 0; }
+ bool is_noop() const { return _val == opNoop; }
+ int lig_kind() const { assert(is_lig()); return -_val+opLigature; }
- GlyphIndex left() const { return _left; }
- GlyphIndex right() const { return _right; }
- GlyphIndex result() const { assert(is_lig()); return _result; }
- int value() const { return _val; }
+ GlyphIndex left() const { return _left; }
+ GlyphIndex right() const { return _right; }
+ GlyphIndex result() const { assert(is_lig()); return _result; }
+ int value() const { return _val; }
PairOpIndex next_left() const { return _next_left; }
private:
@@ -59,22 +59,22 @@ class PairOp { public:
class PairProgram { public:
- PairProgram() : _reversed(false) { }
+ PairProgram() : _reversed(false) { }
PairProgram(const PairProgram &);
void reserve_glyphs(int);
- PairOpIndex find_left(GlyphIndex gi) const { return _left_map[gi]; }
+ PairOpIndex find_left(GlyphIndex gi) const { return _left_map[gi]; }
PairOpIndex find(GlyphIndex leftgi, GlyphIndex rightgi) const;
- int op_count() const { return _op.size(); }
- const PairOp &op(PairOpIndex i) const { return _op[i]; }
+ int op_count() const { return _op.size(); }
+ const PairOp &op(PairOpIndex i) const { return _op[i]; }
// Return true if it's a duplicate.
bool add_kern(GlyphIndex, GlyphIndex, int);
bool add_lig(GlyphIndex, GlyphIndex, GlyphIndex, int kind = opLigSimple);
- void set_reversed(bool r) { _reversed = r; }
+ void set_reversed(bool r) { _reversed = r; }
void unreverse();
void optimize();
@@ -88,7 +88,7 @@ class PairProgram { public:
inline const char *print_name(GlyphIndex) const;
- PairProgram &operator=(const PairProgram &) { assert(0); return *this; }
+ PairProgram &operator=(const PairProgram &) { assert(0); return *this; }
};
@@ -99,7 +99,7 @@ inline PairOp::PairOp(GlyphIndex l, GlyphIndex r, int v, PairOpIndex nl)
}
inline PairOp::PairOp(GlyphIndex l, GlyphIndex r, GlyphIndex x, int kind,
- PairOpIndex nl)
+ PairOpIndex nl)
: _left(l), _right(r), _result(x), _val(opLigature - kind), _next_left(nl)
{
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/psres.hh
index ee302821fdb..f33ee8ab0e8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/psres.hh
@@ -38,12 +38,12 @@ class PsresDatabaseSection { public:
PsresDatabaseSection(PermString);
- PermString section_name() const { return _section_name; }
+ PermString section_name() const { return _section_name; }
void add_psres_file_section(Slurper&, PermString, bool);
void add_section(PsresDatabaseSection*, bool override);
- const String& value(PermString key) { return value(_map[key]); }
+ const String& value(PermString key) { return value(_map[key]); }
inline const String& unescaped_value(PermString key) const;
Filename filename_value(PermString key);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1bounds.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1bounds.hh
index a96707f7bc4..1f1addaebc2 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1bounds.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1bounds.hh
@@ -10,17 +10,17 @@ class CharstringBounds : public CharstringInterp { public:
CharstringBounds();
CharstringBounds(const Transform&);
CharstringBounds(const Transform&, const Vector<double>& weight_vec);
- ~CharstringBounds() { }
-
- const Point& width() const { return _width; }
- double x_width() const { return _width.x; }
- bool bb_known() const { return KNOWN(_lb.x); }
- double bb_left() const { return _lb.x; }
- double bb_top() const { return _rt.y; }
- double bb_right() const { return _rt.x; }
- double bb_bottom() const { return _lb.y; }
- const Point& bb_bottom_left() const { return _lb; }
- const Point& bb_top_right() const { return _rt; }
+ ~CharstringBounds() { }
+
+ const Point& width() const { return _width; }
+ double x_width() const { return _width.x; }
+ bool bb_known() const { return KNOWN(_lb.x); }
+ double bb_left() const { return _lb.x; }
+ double bb_top() const { return _rt.y; }
+ double bb_right() const { return _rt.x; }
+ double bb_bottom() const { return _lb.y; }
+ const Point& bb_bottom_left() const { return _lb; }
+ const Point& bb_top_right() const { return _rt; }
void act_width(int, const Point&);
void act_line(int, const Point&, const Point&);
@@ -60,15 +60,15 @@ class CharstringBounds : public CharstringInterp { public:
inline void CharstringBounds::xf_mark(const Point& p)
{
if (!KNOWN(_lb.x))
- _lb = _rt = p;
+ _lb = _rt = p;
if (p.x < _lb.x)
- _lb.x = p.x;
+ _lb.x = p.x;
else if (p.x > _rt.x)
- _rt.x = p.x;
+ _rt.x = p.x;
if (p.y < _lb.y)
- _lb.y = p.y;
+ _lb.y = p.y;
else if (p.y > _rt.y)
- _rt.y = p.y;
+ _rt.y = p.y;
}
inline void CharstringBounds::mark(const Point& p)
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1cs.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1cs.hh
new file mode 100644
index 00000000000..d9f36db6cd9
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1cs.hh
@@ -0,0 +1,345 @@
+// -*- related-file-name: "../../libefont/t1cs.cc" -*-
+#ifndef EFONT_T1CS_HH
+#define EFONT_T1CS_HH
+#include <lcdf/permstr.hh>
+#include <lcdf/string.hh>
+#include <lcdf/vector.hh>
+#include <lcdf/inttypes.h>
+namespace Efont {
+
+// Allow unknown doubles to have some `fuzz' -- so if an unknown double
+// is a bit off from the canonical UNKDOUBLE value, we'll still recognize
+// it as unknown. (Useful for interpolation.)
+#define UNKDOUBLE -9.79797e97
+#define MIN_KNOWN_DOUBLE -9.69696e97
+#define KNOWN(d) ((d) >= MIN_KNOWN_DOUBLE)
+
+class CharstringProgram;
+class CharstringInterp;
+struct CharstringContext;
+class MultipleMasterSpace;
+class Type1Encoding;
+
+class Charstring { public:
+
+ Charstring() { }
+ virtual ~Charstring();
+
+ virtual bool process(CharstringInterp &) const = 0;
+
+ enum Commands {
+ cError = 0,
+ cHstem = 1,
+ cVstem = 3,
+ cVmoveto = 4,
+ cRlineto = 5,
+ cHlineto = 6,
+ cVlineto = 7,
+ cRrcurveto = 8,
+ cClosepath = 9,
+ cCallsubr = 10,
+ cReturn = 11,
+ cEscape = 12,
+ cHsbw = 13,
+ cEndchar = 14,
+ cBlend = 16,
+ cHstemhm = 18,
+ cHintmask = 19,
+ cCntrmask = 20,
+ cRmoveto = 21,
+ cHmoveto = 22,
+ cVstemhm = 23,
+ cRcurveline = 24,
+ cRlinecurve = 25,
+ cVvcurveto = 26,
+ cHhcurveto = 27,
+ cShortint = 28,
+ cCallgsubr = 29,
+ cVhcurveto = 30,
+ cHvcurveto = 31,
+
+ cEscapeDelta = 32,
+ cDotsection = 32 + 0,
+ cVstem3 = 32 + 1,
+ cHstem3 = 32 + 2,
+ cAnd = 32 + 3,
+ cOr = 32 + 4,
+ cNot = 32 + 5,
+ cSeac = 32 + 6,
+ cSbw = 32 + 7,
+ cStore = 32 + 8,
+ cAbs = 32 + 9,
+ cAdd = 32 + 10,
+ cSub = 32 + 11,
+ cDiv = 32 + 12,
+ cLoad = 32 + 13,
+ cNeg = 32 + 14,
+ cEq = 32 + 15,
+ cCallothersubr = 32 + 16,
+ cPop = 32 + 17,
+ cDrop = 32 + 18,
+ cPut = 32 + 20,
+ cGet = 32 + 21,
+ cIfelse = 32 + 22,
+ cRandom = 32 + 23,
+ cMul = 32 + 24,
+ cSqrt = 32 + 26,
+ cDup = 32 + 27,
+ cExch = 32 + 28,
+ cIndex = 32 + 29,
+ cRoll = 32 + 30,
+ cSetcurrentpoint = 32 + 33,
+ cHflex = 32 + 34,
+ cFlex = 32 + 35,
+ cHflex1 = 32 + 36,
+ cFlex1 = 32 + 37,
+
+ cLastCommand = cFlex1
+ };
+
+ enum OthersubrCommands {
+ othcFlexend = 0,
+ othcFlexbegin = 1,
+ othcFlexmiddle = 2,
+ othcReplacehints = 3,
+ othcCountercontrolpart = 12,
+ othcCountercontrol = 13,
+ othcMM1 = 14,
+ othcMM2 = 15,
+ othcMM3 = 16,
+ othcMM4 = 17,
+ othcMM6 = 18,
+ othcITC_load = 19,
+ othcITC_add = 20,
+ othcITC_sub = 21,
+ othcITC_mul = 22,
+ othcITC_div = 23,
+ othcITC_put = 24,
+ othcITC_get = 25,
+ othcITC_unknown = 26,
+ othcITC_ifelse = 27,
+ othcITC_random = 28
+ };
+
+ static String command_name(int);
+ static const char * const command_names[];
+
+ static const char * const standard_encoding[256];
+
+};
+
+
+class Type1Charstring : public Charstring { public:
+
+ Type1Charstring() { }
+ inline Type1Charstring(const String &); // unencrypted
+ Type1Charstring(int lenIV, const String &); // encrypted
+ // default copy constructor
+ // default destructor
+ // default assignment operator
+
+ inline const uint8_t *data() const;
+ int length() const { return _s.length(); }
+ operator String::unspecified_bool_type() const { return _s; }
+
+ inline const String &data_string() const;
+ inline String substring(int pos, int len) const;
+ int first_caret_after(int pos) const;
+
+ inline void assign(const String &);
+ void prepend(const Type1Charstring &);
+ void assign_substring(int pos, int len, const String &);
+
+ bool process(CharstringInterp &) const;
+
+ private:
+
+ mutable String _s;
+ mutable int _key;
+
+ void decrypt() const;
+
+};
+
+
+class Type2Charstring : public Charstring { public:
+
+ Type2Charstring() { }
+ inline Type2Charstring(const String &);
+ // default copy constructor
+ // default destructor
+ // default assignment operator
+
+ inline const uint8_t *data() const;
+ int length() const { return _s.length(); }
+
+ bool process(CharstringInterp &) const;
+
+ private:
+
+ String _s;
+
+};
+
+
+struct CharstringContext {
+
+ CharstringContext(const CharstringProgram *program_, const Charstring *cs_) : program(program_), cs(cs_) { }
+
+ operator String::unspecified_bool_type() const {
+ return cs != 0 ? &String::length : 0;
+ }
+
+ const CharstringProgram *program;
+ const Charstring *cs;
+
+};
+
+
+class CharstringProgram { public:
+
+ explicit CharstringProgram(unsigned units_per_em);
+ virtual ~CharstringProgram() { }
+
+ virtual PermString font_name() const { return PermString(); }
+ virtual void font_matrix(double[6]) const;
+ unsigned units_per_em() const { return _units_per_em; }
+
+ inline const CharstringProgram *program(int) const;
+ virtual const CharstringProgram *child_program(int) const;
+ bool parent_program() const { return _parent_program; }
+ void set_parent_program(bool pp) { _parent_program = pp; }
+
+ virtual int nsubrs() const { return 0; }
+ virtual Charstring *subr(int) const { return 0; }
+ virtual int subr_bias() const { return 0; }
+
+ virtual int ngsubrs() const { return 0; }
+ virtual Charstring *gsubr(int) const { return 0; }
+ virtual int gsubr_bias() const { return 0; }
+
+ inline int nxsubrs(bool g) const;
+ inline Charstring *xsubr(bool g, int) const;
+ inline int xsubr_bias(bool g) const;
+
+ virtual int nglyphs() const { return 0; }
+ virtual PermString glyph_name(int) const { return PermString(); }
+ virtual void glyph_names(Vector<PermString> &) const;
+ virtual Charstring *glyph(int) const { return 0; }
+ virtual Charstring *glyph(PermString) const { return 0; }
+
+ inline CharstringContext glyph_context(int) const;
+ inline CharstringContext glyph_context(PermString) const;
+
+ virtual bool is_mm() const { return mmspace() != 0; }
+ virtual MultipleMasterSpace *mmspace() const { return 0; }
+ enum VectorType { VEC_WEIGHT = 0, VEC_NORM_DESIGN = 1, VEC_DESIGN = 2 };
+ virtual Vector<double> *mm_vector(VectorType, bool writable) const;
+
+ virtual Type1Encoding *type1_encoding() const { return 0; }
+
+ virtual double global_width_x(bool is_nominal) const;
+
+ private:
+
+ bool _parent_program;
+ uint16_t _units_per_em;
+
+};
+
+
+enum Type1Defs {
+ t1Warmup_ee = 4,
+ t1R_ee = 55665,
+ t1R_cs = 4330,
+ t1C1 = 52845,
+ t1C2 = 22719
+};
+
+
+inline Type1Charstring::Type1Charstring(const String &s)
+ : Charstring(), _s(s), _key(-1)
+{
+}
+
+inline void Type1Charstring::assign(const String &s)
+{
+ _s = s;
+ _key = -1;
+}
+
+inline const uint8_t *Type1Charstring::data() const
+{
+ if (_key >= 0)
+ decrypt();
+ return reinterpret_cast<const uint8_t *>(_s.data());
+}
+
+inline const String &Type1Charstring::data_string() const
+{
+ if (_key >= 0)
+ decrypt();
+ return _s;
+}
+
+inline String Type1Charstring::substring(int pos, int len) const
+{
+ if (_key >= 0)
+ decrypt();
+ return _s.substring(pos, len);
+}
+
+inline bool operator==(const Type1Charstring &a, const Type1Charstring &b)
+{
+ return a.data_string() == b.data_string();
+}
+
+
+inline Type2Charstring::Type2Charstring(const String &s)
+ : _s(s)
+{
+}
+
+inline const uint8_t *Type2Charstring::data() const
+{
+ return reinterpret_cast<const uint8_t *>(_s.data());
+}
+
+
+inline int CharstringProgram::nxsubrs(bool g) const
+{
+ return (g ? ngsubrs() : nsubrs());
+}
+
+inline Charstring *CharstringProgram::xsubr(bool g, int i) const
+{
+ return (g ? gsubr(i) : subr(i));
+}
+
+inline int CharstringProgram::xsubr_bias(bool g) const
+{
+ return (g ? gsubr_bias() : subr_bias());
+}
+
+inline const CharstringProgram *CharstringProgram::program(int gi) const
+{
+ return (_parent_program ? child_program(gi) : this);
+}
+
+inline CharstringContext CharstringProgram::glyph_context(int gi) const
+{
+ if (!_parent_program)
+ return CharstringContext(this, glyph(gi));
+ else if (const CharstringProgram *p = child_program(gi))
+ return CharstringContext(p, p->glyph(gi));
+ else
+ return CharstringContext(0, 0);
+}
+
+inline CharstringContext CharstringProgram::glyph_context(PermString gn) const
+{
+ return CharstringContext(this, glyph(gn));
+}
+
+}
+#endif
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1csgen.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1csgen.hh
index 226497a4a6b..f5cb128fd8f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1csgen.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1csgen.hh
@@ -10,12 +10,12 @@ class Type1CharstringGen { public:
Type1CharstringGen(int precision = 5);
- int precision() const { return _precision; }
+ int precision() const { return _precision; }
void clear();
- char *data() { return _ncs.data(); }
- const char *data() const { return _ncs.data(); }
- int length() const { return _ncs.length(); }
+ char *data() { return _ncs.data(); }
+ const char *data() const { return _ncs.data(); }
+ int length() const { return _ncs.length(); }
void gen_number(double, int kind = 0);
void gen_command(int);
@@ -53,15 +53,15 @@ class Type1CharstringGenInterp : public CharstringInterp { public:
Type1CharstringGenInterp(int precision);
- int precision() const { return _csgen.precision(); }
- void set_direct_hint_replacement(bool dhr) { _direct_hr = dhr; }
+ int precision() const { return _csgen.precision(); }
+ void set_direct_hint_replacement(bool dhr) { _direct_hr = dhr; }
void set_hint_replacement_storage(Type1Font *);
- int nhints() const { return _stem_hstem.size(); }
- double max_flex_height() const { return _max_flex_height; }
- bool bad_flex() const { return _bad_flex; }
+ int nhints() const { return _stem_hstem.size(); }
+ double max_flex_height() const { return _max_flex_height; }
+ bool bad_flex() const { return _bad_flex; }
- const Type1CharstringGen &csgen() const { return _csgen; }
+ const Type1CharstringGen &csgen() const { return _csgen; }
void act_width(int, const Point &);
void act_seac(int, double, double, double, int, int);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1font.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1font.hh
index 4ec827e7e24..a879a11e9ab 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1font.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1font.hh
@@ -27,53 +27,53 @@ class Type1Font : public CharstringProgram { public:
inline PermString font_name() const;
void font_matrix(double[6]) const;
- int nitems() const { return _items.size(); }
- Type1Item *item(int i) const { return _items[i]; }
- void add_item(Type1Item *it) { _items.push_back(it); }
+ int nitems() const { return _items.size(); }
+ Type1Item *item(int i) const { return _items[i]; }
+ void add_item(Type1Item *it) { _items.push_back(it); }
void add_definition(int dict, Type1Definition *);
void add_type1_encoding(Type1Encoding *);
- int nsubrs() const { return _subrs.size(); }
+ int nsubrs() const { return _subrs.size(); }
Type1Charstring *subr(int) const;
- int nglyphs() const { return _glyphs.size(); }
+ int nglyphs() const { return _glyphs.size(); }
PermString glyph_name(int) const;
Type1Charstring *glyph(int) const;
Type1Charstring *glyph(PermString) const;
void add_glyph(Type1Subr *);
- Type1Subr *subr_x(int i) const { return _subrs[i]; }
+ Type1Subr *subr_x(int i) const { return _subrs[i]; }
bool set_subr(int, const Type1Charstring &, PermString definer = PermString());
bool remove_subr(int);
void fill_in_subrs();
void renumber_subrs(const Vector<int> &); // dangerous!
- Type1Subr *glyph_x(int i) const { return _glyphs[i]; }
+ Type1Subr *glyph_x(int i) const { return _glyphs[i]; }
Type1Encoding *type1_encoding() const { return _encoding; }
// note: the order is relevant
enum Dict {
- dFont = 0, dF = dFont,
- dFontInfo = 1, dFI = dFontInfo,
- dPrivate = 2, dP = dPrivate,
- dBlend = 3, dB = dBlend,
- dBlendFontInfo = dB+dFI, dBFI = dBlendFontInfo,
- dBlendPrivate = dB+dP, dBP = dBlendPrivate,
- dLast
+ dFont = 0, dF = dFont,
+ dFontInfo = 1, dFI = dFontInfo,
+ dPrivate = 2, dP = dPrivate,
+ dBlend = 3, dB = dBlend,
+ dBlendFontInfo = dB+dFI, dBFI = dBlendFontInfo,
+ dBlendPrivate = dB+dP, dBP = dBlendPrivate,
+ dLast
};
Type1Definition *dict(int d, PermString s) const { return _dict[d][s]; }
- Type1Definition *dict(PermString s) const { return _dict[dF][s]; }
- Type1Definition *p_dict(PermString s) const { return _dict[dP][s]; }
- Type1Definition *b_dict(PermString s) const { return _dict[dB][s]; }
+ Type1Definition *dict(PermString s) const { return _dict[dF][s]; }
+ Type1Definition *p_dict(PermString s) const { return _dict[dP][s]; }
+ Type1Definition *b_dict(PermString s) const { return _dict[dB][s]; }
Type1Definition *bp_dict(PermString s) const { return _dict[dBP][s];}
Type1Definition *fi_dict(PermString s) const { return _dict[dFI][s];}
typedef HashMap<PermString, Type1Definition *> DictHashMap;
inline DictHashMap::const_iterator dict_begin(int dict) const;
inline DictHashMap::iterator dict_begin(int dict);
- int first_dict_item(int d) const { return _index[d]; }
+ int first_dict_item(int d) const { return _index[d]; }
Type1Definition *ensure(Dict, PermString);
void add_header_comment(const String &);
@@ -83,7 +83,7 @@ class Type1Font : public CharstringProgram { public:
void undo_synthetic();
- void set_charstring_definer(PermString d) { _charstring_definer = d; }
+ void set_charstring_definer(PermString d) { _charstring_definer = d; }
void write(Type1Writer &);
@@ -159,7 +159,7 @@ inline void Type1Font::set_dict(int dict, PermString name, Type1Definition *t1d)
inline PermString Type1Font::font_name() const
{
if (!_cached_defs)
- cache_defs();
+ cache_defs();
return _font_name;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1interp.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1interp.hh
index 0b693b08c70..16c878a3677 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1interp.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1interp.hh
@@ -10,39 +10,39 @@ class CharstringInterp { public:
CharstringInterp();
CharstringInterp(const Vector<double> &weight_vec);
- virtual ~CharstringInterp() { }
+ virtual ~CharstringInterp() { }
- int error() const { return _error; }
- int error_data() const { return _error_data; }
+ int error() const { return _error; }
+ int error_data() const { return _error_data; }
static String error_string(int error, int error_data);
inline String error_string() const;
- bool careful() const { return _careful; }
- void set_careful(bool c) { _careful = c; }
+ bool careful() const { return _careful; }
+ void set_careful(bool c) { _careful = c; }
- bool done() const { return _done; }
- void set_done() { _done = true; }
+ bool done() const { return _done; }
+ void set_done() { _done = true; }
- int size() const { return _sp; }
- double &at(unsigned i) { return _s[i]; }
- double &top(unsigned i = 0) { return _s[_sp - i - 1]; }
- double pop(unsigned n = 1) { _sp -= n; return _s[_sp]; }
+ int size() const { return _sp; }
+ double &at(unsigned i) { return _s[i]; }
+ double &top(unsigned i = 0) { return _s[_sp - i - 1]; }
+ double pop(unsigned n = 1) { _sp -= n; return _s[_sp]; }
inline void push(double);
- void clear() { _sp = 0; }
+ void clear() { _sp = 0; }
- int ps_size() const { return _ps_sp; }
- double ps_at(unsigned i) const { return _ps_s[i]; }
- double ps_pop() { return _ps_s[--_ps_sp]; }
+ int ps_size() const { return _ps_sp; }
+ double ps_at(unsigned i) const { return _ps_s[i]; }
+ double ps_pop() { return _ps_s[--_ps_sp]; }
inline void ps_push(double);
- void ps_clear() { _ps_sp = 0; }
+ void ps_clear() { _ps_sp = 0; }
- int subr_depth() const { return _subr_depth; }
+ int subr_depth() const { return _subr_depth; }
inline double &vec(Vector<double> *, int);
- const Vector<double> &weight_vector() const { return _weight_vector; }
- Vector<double> *scratch_vector() { return &_scratch_vector; }
+ const Vector<double> &weight_vector() const { return _weight_vector; }
+ Vector<double> *scratch_vector() { return &_scratch_vector; }
- const CharstringProgram *program() const { return _program; }
+ const CharstringProgram *program() const { return _program; }
inline Charstring *get_subr(int) const;
inline Charstring *get_gsubr(int) const;
inline Charstring *get_xsubr(bool g, int) const;
@@ -52,7 +52,7 @@ class CharstringInterp { public:
inline bool interpret(const CharstringContext &);
//virtual void init(const CharstringProgram *);
- bool error(int c) { return error(c, 0); }
+ bool error(int c) { return error(c, 0); }
virtual bool error(int, int);
virtual bool number(double);
@@ -65,9 +65,9 @@ class CharstringInterp { public:
bool mm_command(int, int);
bool itc_command(int, int);
- const Point &left_sidebearing() const { return _lsb; }
- const Point &currentpoint() const { return _cp; }
- void set_state_path() { _state = S_PATH; }
+ const Point &left_sidebearing() const { return _lsb; }
+ const Point &currentpoint() const { return _cp; }
+ void set_state_path() { _state = S_PATH; }
virtual bool callothersubr_command(int, int);
virtual bool type1_command(int);
@@ -94,30 +94,30 @@ class CharstringInterp { public:
typedef Charstring Cs;
enum Errors {
- errOK = 0,
- errInternal = -1,
- errRunoff = -2,
- errUnimplemented = -3,
- errOverflow = -4,
- errUnderflow = -5,
- errVector = -6,
- errValue = -7,
- errSubr = -8,
- errGlyph = -9,
- errCurrentPoint = -10,
- errFlex = -11,
- errMultipleMaster = -12,
- errOpenStroke = -13,
- errLateSidebearing = -14,
- errOthersubr = -15,
- errOrdering = -16,
- errHintmask = -17,
- errSubrDepth = -18,
- errLastError = -18
+ errOK = 0,
+ errInternal = -1,
+ errRunoff = -2,
+ errUnimplemented = -3,
+ errOverflow = -4,
+ errUnderflow = -5,
+ errVector = -6,
+ errValue = -7,
+ errSubr = -8,
+ errGlyph = -9,
+ errCurrentPoint = -10,
+ errFlex = -11,
+ errMultipleMaster = -12,
+ errOpenStroke = -13,
+ errLateSidebearing = -14,
+ errOthersubr = -15,
+ errOrdering = -16,
+ errHintmask = -17,
+ errSubrDepth = -18,
+ errLastError = -18
};
enum { STACK_SIZE = 48, PS_STACK_SIZE = 24, MAX_SUBR_DEPTH = 10,
- SCRATCH_SIZE = 32 };
+ SCRATCH_SIZE = 32 };
private:
@@ -143,7 +143,7 @@ class CharstringInterp { public:
const CharstringProgram *_program;
enum State {
- S_INITIAL, S_SEAC, S_SBW, S_HSTEM, S_VSTEM, S_HINTMASK, S_IPATH, S_PATH
+ S_INITIAL, S_SEAC, S_SBW, S_HSTEM, S_VSTEM, S_HINTMASK, S_IPATH, S_PATH
};
State _state;
bool _flex;
@@ -177,26 +177,26 @@ inline String CharstringInterp::error_string() const
inline void CharstringInterp::push(double d)
{
if (_sp < STACK_SIZE)
- _s[_sp++] = d;
+ _s[_sp++] = d;
else
- error(errOverflow);
+ error(errOverflow);
}
inline void CharstringInterp::ps_push(double d)
{
if (_ps_sp < PS_STACK_SIZE)
- _ps_s[_ps_sp++] = d;
+ _ps_s[_ps_sp++] = d;
else
- error(errOverflow);
+ error(errOverflow);
}
inline double &CharstringInterp::vec(Vector<double> *v, int i)
{
if (i < 0 || i >= v->size()) {
- error(errVector);
- return double_for_error;
+ error(errVector);
+ return double_for_error;
} else
- return v->at_u(i);
+ return v->at_u(i);
}
inline Charstring *CharstringInterp::get_subr(int n) const
@@ -222,7 +222,7 @@ inline Charstring *CharstringInterp::get_glyph(PermString n) const
inline void CharstringInterp::ensure_weight_vector()
{
if (!_weight_vector.size())
- fetch_weight_vector();
+ fetch_weight_vector();
}
inline bool CharstringInterp::callxsubr_command(bool g)
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1item.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1item.hh
index 056ba0e71d4..8b5bfb8f8cb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1item.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1item.hh
@@ -15,14 +15,14 @@ class Type1Definition;
class Type1Item { public:
- Type1Item() { }
- virtual ~Type1Item() { }
+ Type1Item() { }
+ virtual ~Type1Item() { }
virtual void gen(Type1Writer &) = 0;
- virtual Type1CopyItem *cast_copy() { return 0; }
- virtual Type1Subr *cast_subr() { return 0; }
- virtual Type1Definition *cast_definition() { return 0; }
+ virtual Type1CopyItem *cast_copy() { return 0; }
+ virtual Type1Subr *cast_subr() { return 0; }
+ virtual Type1Definition *cast_definition() { return 0; }
virtual Type1SubrGroupItem *cast_subr_group() { return 0; }
private:
@@ -34,7 +34,7 @@ class Type1Item { public:
class Type1NullItem : public Type1Item { public:
- Type1NullItem() { }
+ Type1NullItem() { }
void gen(Type1Writer &);
@@ -42,17 +42,17 @@ class Type1NullItem : public Type1Item { public:
class Type1CopyItem : public Type1Item { public:
- Type1CopyItem(const String &s) : _value(s) { }
- ~Type1CopyItem() { }
+ Type1CopyItem(const String &s) : _value(s) { }
+ ~Type1CopyItem() { }
- const String &value() const { return _value; }
- int length() const { return _value.length(); }
+ const String &value() const { return _value; }
+ int length() const { return _value.length(); }
- void set_value(const String &s) { _value = s; }
+ void set_value(const String &s) { _value = s; }
void gen(Type1Writer &);
- Type1CopyItem *cast_copy() { return this; }
+ Type1CopyItem *cast_copy() { return this; }
private:
@@ -62,7 +62,7 @@ class Type1CopyItem : public Type1Item { public:
class Type1EexecItem : public Type1Item { public:
- Type1EexecItem(bool on) : _eexec_on(on) { }
+ Type1EexecItem(bool on) : _eexec_on(on) { }
void gen(Type1Writer &w);
@@ -77,15 +77,15 @@ class Type1Definition : public Type1Item { public:
typedef Vector<double> NumVector;
Type1Definition(PermString, const String &, PermString);
- ~Type1Definition() { }
+ ~Type1Definition() { }
static Type1Definition *make(StringAccum &, Type1Reader * = 0, bool force = false);
static Type1Definition *make_string(PermString, const String &, PermString);
static inline Type1Definition *make_literal(PermString, const String &, PermString);
static inline Type1Definition *make(PermString, double, PermString);
- PermString name() const { return _name; }
- const String &value() const { return _val; }
- PermString definer() const { return _definer; }
+ PermString name() const { return _name; }
+ const String &value() const { return _val; }
+ PermString definer() const { return _definer; }
bool value_bool(bool &) const;
bool value_int(int &) const;
@@ -102,7 +102,7 @@ class Type1Definition : public Type1Item { public:
void set_num(double);
void set_string(const String &);
void set_name(PermString, bool name = true);
- void set_code(const char *s) { set_val(s); }
+ void set_code(const char *s) { set_val(s); }
void set_numvec(const NumVector &, bool executable = false);
void set_numvec_vec(const Vector<NumVector> &);
void set_normalize(const Vector<NumVector> &, const Vector<NumVector> &);
@@ -111,7 +111,7 @@ class Type1Definition : public Type1Item { public:
void gen(Type1Writer &);
void gen(StringAccum &);
- Type1Definition *cast_definition() { return this; }
+ Type1Definition *cast_definition() { return this; }
private:
@@ -136,13 +136,13 @@ class Type1Encoding : public Type1Item { public:
void clear();
void unshare();
- PermString operator[](int e) const { assert(e>=0&&e<256); return _v[e]; }
- PermString elt(int e) const { return (*this)[e]; }
+ PermString operator[](int e) const { assert(e>=0&&e<256); return _v[e]; }
+ PermString elt(int e) const { return (*this)[e]; }
PermString operator[](unsigned char e) const { return _v[e]; }
PermString elt(unsigned char e) const { return operator[](e); }
inline void put(int e, PermString p);
- void set_definer(PermString s) { _definer = s; }
+ void set_definer(PermString s) { _definer = s; }
static Type1Encoding *standard_encoding();
@@ -165,19 +165,19 @@ class Type1Subr : public Type1Item { public:
static Type1Subr *make_subr(int, const Type1Charstring &, PermString);
static Type1Subr *make_glyph(PermString, const Type1Charstring &, PermString);
- bool is_subr() const { return !_name; }
- PermString name() const { return _name; }
- int subrno() const { return _subrno; }
- PermString definer() const { return _definer; }
+ bool is_subr() const { return !_name; }
+ PermString name() const { return _name; }
+ int subrno() const { return _subrno; }
+ PermString definer() const { return _definer; }
- Type1Charstring &t1cs() { return _cs; }
- const Type1Charstring &t1cs() const { return _cs; }
- operator Type1Charstring &() { return _cs; }
+ Type1Charstring &t1cs() { return _cs; }
+ const Type1Charstring &t1cs() const { return _cs; }
+ operator Type1Charstring &() { return _cs; }
operator const Type1Charstring &() const { return _cs; }
void gen(Type1Writer &);
- virtual Type1Subr *cast_subr() { return this; }
+ virtual Type1Subr *cast_subr() { return this; }
private:
@@ -198,17 +198,17 @@ class Type1SubrGroupItem : public Type1Item { public:
Type1SubrGroupItem(Type1Font *, bool, const String &);
Type1SubrGroupItem(const Type1SubrGroupItem &, Type1Font *);
- ~Type1SubrGroupItem() { }
+ ~Type1SubrGroupItem() { }
- void set_end_text(const String &s) { _end_text = s; }
+ void set_end_text(const String &s) { _end_text = s; }
void add_end_text(const String &);
- bool is_subrs() const { return _is_subrs; }
- const String &end_text() const { return _end_text; }
+ bool is_subrs() const { return _is_subrs; }
+ const String &end_text() const { return _end_text; }
void gen(Type1Writer &);
- Type1SubrGroupItem *cast_subr_group() { return this; }
+ Type1SubrGroupItem *cast_subr_group() { return this; }
private:
@@ -224,7 +224,7 @@ class Type1IncludedFont : public Type1Item { public:
Type1IncludedFont(Type1Font *, int);
~Type1IncludedFont();
- Type1Font *included_font() const { return _included_font; }
+ Type1Font *included_font() const { return _included_font; }
void gen(Type1Writer &);
@@ -259,7 +259,7 @@ inline void Type1Definition::set_val(StringAccum &sa)
inline void Type1Encoding::put(int e, PermString glyph)
{
if (_copy_of)
- unshare();
+ unshare();
assert(e >= 0 && e < 256);
_v[e] = glyph;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1mm.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1mm.hh
index bf2e81a00e9..8564f46cf67 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1mm.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1mm.hh
@@ -13,21 +13,21 @@ class MultipleMasterSpace : public CharstringProgram { public:
typedef Vector<double> NumVector;
- PermString font_name() const { return _font_name; }
- int naxes() const { return _naxes; }
- int nmasters() const { return _nmasters; }
+ PermString font_name() const { return _font_name; }
+ int naxes() const { return _naxes; }
+ int nmasters() const { return _nmasters; }
int axis(PermString) const;
double axis_low(int) const;
double axis_high(int) const;
- PermString axis_type(int a) const { return _axis_types[a]; }
- PermString axis_label(int a) const { return _axis_labels[a]; }
+ PermString axis_type(int a) const { return _axis_types[a]; }
+ PermString axis_label(int a) const { return _axis_labels[a]; }
inline PermString axis_abbreviation(int a) const;
static PermString axis_abbreviation(PermString);
- const Type1Charstring &ndv() const { return _ndv; }
- const Type1Charstring &cdv() const { return _cdv; }
+ const Type1Charstring &ndv() const { return _ndv; }
+ const Type1Charstring &cdv() const { return _cdv; }
void set_master_positions(const Vector<NumVector> &);
void set_normalize(const Vector<NumVector> &, const Vector<NumVector> &);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1rw.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1rw.hh
index d59f4089742..03af2cfeeb8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1rw.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1rw.hh
@@ -19,9 +19,9 @@ class Type1Reader { public:
virtual void set_charstring_definer(PermString);
bool next_line(StringAccum &);
- bool was_charstring() const { return _charstring_len > 0; }
- int charstring_start() const { return _charstring_start; }
- int charstring_length() const { return _charstring_len; }
+ bool was_charstring() const { return _charstring_len > 0; }
+ int charstring_start() const { return _charstring_start; }
+ int charstring_length() const { return _charstring_len; }
private:
@@ -114,7 +114,7 @@ class Type1Writer { public:
Type1Writer();
virtual ~Type1Writer();
- bool eexecing() const { return _eexec; }
+ bool eexecing() const { return _eexec; }
inline void print(int);
void print(const char *, int);
@@ -128,10 +128,10 @@ class Type1Writer { public:
virtual void switch_eexec(bool);
virtual void print0(const unsigned char *, int) = 0;
- PermString charstring_start() const { return _charstring_start; }
- int lenIV() const { return _lenIV; }
- void set_charstring_start(PermString p) { _charstring_start = p; }
- void set_lenIV(int l) { _lenIV = l; }
+ PermString charstring_start() const { return _charstring_start; }
+ int lenIV() const { return _lenIV; }
+ void set_charstring_start(PermString p) { _charstring_start = p; }
+ void set_lenIV(int l) { _lenIV = l; }
private:
@@ -194,7 +194,7 @@ class Type1PFBWriter: public Type1Writer {
inline void Type1Writer::print(int c)
{
if (_pos >= BufSize)
- local_flush();
+ local_flush();
_buf[_pos++] = c;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1unparser.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1unparser.hh
index 3a6e446e3c7..15e12fb79d1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/t1unparser.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/t1unparser.hh
@@ -10,9 +10,9 @@ class CharstringUnparser : public CharstringInterp { public:
CharstringUnparser();
CharstringUnparser(const CharstringUnparser &);
- const String &indent() const { return _indent; }
- void set_indent(const String &s) { _indent = s; }
- void set_one_command_per_line(bool b) { _one_command_per_line = b; }
+ const String &indent() const { return _indent; }
+ void set_indent(const String &s) { _indent = s; }
+ void set_one_command_per_line(bool b) { _one_command_per_line = b; }
void clear();
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfcs.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfcs.hh
index 96758435603..96758435603 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfcs.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfcs.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfhead.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfhead.hh
index 2611a405b1b..f5ab4cedff6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfhead.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfhead.hh
@@ -2,7 +2,7 @@
#ifndef EFONT_TTFHEAD_HH
#define EFONT_TTFHEAD_HH
#include <efont/otf.hh>
-#include <efont/otfdata.hh> // for ntohl()
+#include <efont/otfdata.hh> // for ntohl()
#include <lcdf/error.hh>
namespace Efont { namespace OpenType {
@@ -11,8 +11,8 @@ class Head { public:
Head(const String &, ErrorHandler * = 0);
// default destructor
- bool ok() const { return _error >= 0; }
- int error() const { return _error; }
+ bool ok() const { return _error >= 0; }
+ int error() const { return _error; }
unsigned units_per_em() const;
unsigned index_to_loc_format() const;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfkern.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfkern.hh
index 717a72b6912..ebe35331ce6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/ttfkern.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/efont/ttfkern.hh
@@ -9,7 +9,7 @@ class KernTable { public:
KernTable(const Data &, ErrorHandler * = 0) throw (Error);
// default destructor
- bool ok() const { return _error >= 0; }
+ bool ok() const { return _error >= 0; }
bool unparse_automatics(Vector<Positioning> &, ErrorHandler * = 0) const;
@@ -20,19 +20,19 @@ class KernTable { public:
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
+ 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);
+ return _version == 0 ? _d.u16(2) : _d.u32(4);
}
inline uint32_t first_offset() const {
- return _version == 0 ? 4 : 8;
+ return _version == 0 ? 4 : 8;
}
inline Data subtable(uint32_t &off) const throw (Error);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/bezier.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/bezier.hh
index ebb93ce9aea..ebb93ce9aea 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/bezier.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/bezier.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/clp.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/clp.h
index d766ccca60a..d766ccca60a 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/clp.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/clp.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/error.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/error.hh
index 2af4a77763d..2eb178c01bb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/error.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/error.hh
@@ -17,8 +17,10 @@
#endif
#if __GNUC__ <= 3
# define ERRH_SENTINEL
+# define ERRH_NORETURN
#else
# define ERRH_SENTINEL __attribute__((sentinel))
+# define ERRH_NORETURN __attribute__((noreturn))
#endif
/** @class ErrorHandler
@@ -191,9 +193,8 @@ class ErrorHandler { public:
/** @brief Print a fatal error message (level el_fatal).
* @return error_result
*
- * In many ErrorHandlers, calling fatal() will cause the process to
- * abort. */
- int fatal(const char *fmt, ...);
+ * Calling fatal() will cause the process to abort. */
+ void fatal(const char *fmt, ...) ERRH_NORETURN;
/** @brief Print a debug message with a landmark annotation. */
void ldebug(const String &landmark, const char *fmt, ...);
@@ -204,7 +205,7 @@ class ErrorHandler { public:
/** @brief Print an error message with a landmark annotation. */
int lerror(const String &landmark, const char *fmt, ...);
/** @brief Print a fatal error message with a landmark annotation. */
- int lfatal(const String &landmark, const char *fmt, ...);
+ void lfatal(const String &landmark, const char *fmt, ...) ERRH_NORETURN;
/** @brief Print an annotated error message.
@@ -427,13 +428,9 @@ class ErrorHandler { public:
* After calling emit() for the lines of an error message, ErrorHandler
* calls account(), passing the minimum (worst) error level of any message
* line (or 1000 if no line had a level). The default implementation
- * updates the nerrors() counter. Some other ErrorHandlers
- * add account() behavior that, for example, exits after printing messages
- * at el_fatal level or below. */
- virtual void account(int level) {
- if (level <= el_error)
- ++_nerrors;
- }
+ * updates the nerrors() counter, and exits the program if @a level is
+ * small enough. */
+ virtual void account(int level);
/** @brief Clear accumulated error state.
*
@@ -653,7 +650,6 @@ class FileErrorHandler : public ErrorHandler { public:
String vformat(const char *fmt, va_list val);
void *emit(const String &str, void *user_data, bool more);
- void account(int level);
private:
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/filename.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/filename.hh
index 9424a4c04fa..9424a4c04fa 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/filename.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/filename.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/globmatch.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/globmatch.hh
index 963035e0ead..963035e0ead 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/globmatch.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/globmatch.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashcode.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashcode.hh
index 53a0e428989..53a0e428989 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashcode.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashcode.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.cc
index 4851463c560..4851463c560 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.hh
index 3d4179e5b5f..3d4179e5b5f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/hashmap.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/hashmap.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/inttypes.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/inttypes.h
index b88e9e9faf0..b88e9e9faf0 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/inttypes.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/inttypes.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/landmark.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/landmark.hh
index 183ab936ee8..183ab936ee8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/landmark.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/landmark.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/md5.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/md5.h
index 7d7f8641d23..7d7f8641d23 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/md5.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/md5.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/permstr.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/permstr.hh
index 684878ed464..684878ed464 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/permstr.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/permstr.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/point.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/point.hh
index aad59b53ccf..aad59b53ccf 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/point.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/point.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/slurper.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/slurper.hh
index 2e400d3c3f2..2e400d3c3f2 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/slurper.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/slurper.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/straccum.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/straccum.hh
index f62c2984978..f62c2984978 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/straccum.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/straccum.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/string.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/string.hh
index 2aba859caa4..2aba859caa4 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/string.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/string.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/strtonum.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/strtonum.h
index ee8745a4a42..ee8745a4a42 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/strtonum.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/strtonum.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/transform.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/transform.hh
index 850a73c8004..850a73c8004 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/transform.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/transform.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.cc
index 8ad11c18810..8ad11c18810 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.hh
index 86e64e238ba..86e64e238ba 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/lcdf/vector.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/include/lcdf/vector.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/lcdf-typetools.spec b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/lcdf-typetools.spec
index 3a0b5f71573..24b75314d4d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/lcdf-typetools.spec
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/lcdf-typetools.spec
@@ -1,6 +1,6 @@
Summary: Programs to manipulate OpenType and multiple-master fonts
Name: lcdf-typetools
-Version: 2.104
+Version: 2.105
Copyright: GPL
Vendor: Little Cambridgeport Design Factory <http://www.lcdf.org/>
Group: Utilities/Printing
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.am
index a783e28e640..a783e28e640 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.in
index 018357a7935..48e13d4503e 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/Makefile.in
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = lcdf-typetools-2.104/libefont
+subdir = lcdf-typetools-2.105/libefont
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -382,9 +382,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/libefont/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/libefont/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/libefont/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/libefont/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afm.cc
new file mode 100644
index 00000000000..76b07fbcfbd
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afm.cc
@@ -0,0 +1,586 @@
+// -*- related-file-name: "../include/efont/afm.hh" -*-
+
+/* afm.{cc,hh} -- Adobe Font Metrics files
+ *
+ * Copyright (c) 1998-2012 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/afm.hh>
+#include <efont/afmparse.hh>
+#include <efont/t1cs.hh> /* for UNKDOUBLE */
+#include <lcdf/error.hh>
+#include <ctype.h>
+#include <assert.h>
+namespace Efont {
+
+AfmReader::AfmReader(AfmParser &parser, Metrics *afm, AfmMetricsXt *afm_xt,
+ ErrorHandler *errh)
+ : _afm(afm), _afm_xt(afm_xt), _l(parser),
+ _composite_warned(false), _metrics_sets_warned(false), _y_width_warned(0)
+{
+ _errh = errh ? errh : ErrorHandler::silent_handler();
+}
+
+Metrics *
+AfmReader::read(Slurper &slurp, ErrorHandler *errh)
+{
+ AfmParser p(slurp);
+ if (!p.ok())
+ return 0;
+
+ Metrics *afm = new Metrics;
+ AfmMetricsXt *afm_xt = new AfmMetricsXt;
+ afm->add_xt(afm_xt);
+ AfmReader reader(p, afm, afm_xt, errh);
+
+ if (!reader.read()) {
+ delete afm;
+ return 0;
+ } else
+ return afm;
+}
+
+Metrics *
+AfmReader::read(const Filename &fn, ErrorHandler *errh)
+{
+ Slurper slurpy(fn);
+ return read(slurpy, errh);
+}
+
+
+void
+AfmReader::lwarning(const char *format, ...) const
+{
+ va_list val;
+ va_start(val, format);
+ _errh->vxmessage(_l.landmark(), ErrorHandler::e_warning, format, val);
+ va_end(val);
+}
+
+void
+AfmReader::lerror(const char *format, ...) const
+{
+ va_list val;
+ va_start(val, format);
+ _errh->vxmessage(_l.landmark(), ErrorHandler::e_error, format, val);
+ va_end(val);
+}
+
+GlyphIndex
+AfmReader::find_err(PermString name, const char *) const
+{
+ GlyphIndex gi = _afm->find(name);
+ if (gi < 0)
+ lerror("character `%s' doesn't exist", name.c_str());
+ return gi;
+}
+
+void
+AfmReader::composite_warning() const
+{
+ if (!_composite_warned)
+ lwarning("composite fonts not supported");
+ _composite_warned = 1;
+}
+
+void
+AfmReader::metrics_sets_warning() const
+{
+ if (!_metrics_sets_warned)
+ lwarning("only metrics set 0 is supported");
+ _metrics_sets_warned = 1;
+}
+
+void
+AfmReader::y_width_warning() const
+{
+ if (_y_width_warned < 40) {
+ lwarning("character has a nonzero Y width");
+ _y_width_warned++;
+ if (_y_width_warned == 40)
+ lwarning("I won't warn you again.");
+ }
+}
+
+void
+AfmReader::no_match_warning(const char *context) const
+{
+ // keyword() will fail (and a warning won't get printed) only if the string
+ // is all whitespace, which the spec allows
+ PermString keyword = _l.keyword();
+ if (!keyword) return;
+ if (_l.key_matched()) {
+ lwarning(context ? "bad `%s' command in %s:"
+ : "bad `%s' command:", keyword.c_str(), context);
+ lwarning("field %d %s", _l.fail_field(), _l.message().c_str());
+ } else
+ lwarning(context ? "unknown command `%s' in %s"
+ : "unknown command `%s'", keyword.c_str(), context);
+ _l.clear_message();
+}
+
+
+bool
+AfmReader::read()
+{
+ AfmParser &l = _l;
+ assert(_afm && _afm_xt);
+
+ // First, read all opening comments into an array so we can print them out
+ // later.
+ PermString comment;
+ while (l.next_line()) {
+ if (l.isall("Comment %+s", &comment))
+ _afm_xt->opening_comments.push_back(comment);
+ else if (l.isall("StartFontMetrics %g", (double *)0))
+ ;
+ else {
+ l.save_line();
+ break;
+ }
+ }
+
+ _afm->set_scale(1000);
+ unsigned invalid_lines = 0;
+ PermString s;
+ bool isbasefont;
+ int metrics_sets;
+ int direction;
+
+ while (l.next_line())
+ switch (l.first()) {
+
+ case 'A':
+ if (l.isall("Ascender %g", &fd( fdAscender )))
+ break;
+ goto invalid;
+
+ case 'C':
+ if (l.isall("Characters %d", (int *)0))
+ break;
+ if (l.isall("CapHeight %g", &fd( fdCapHeight )))
+ break;
+ if (l.isall("CharacterSet %+s", (PermString *) 0))
+ break;
+ if (l.isall("CharWidth %g %g", (double *)0, (double *)0))
+ break;
+ if (l.isall("Comment %+s", (PermString *) 0))
+ break;
+ goto invalid;
+
+ case 'D':
+ if (l.isall("Descender %g", &fd( fdDescender )))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (l.isall("EncodingScheme %+s", &_afm_xt->encoding_scheme))
+ break;
+ if (l.isall("EndDirection"))
+ break;
+ if (l.isall("EndFontMetrics"))
+ goto done;
+ if (l.isall("EscChar %d", (int *)0)) {
+ composite_warning();
+ break;
+ }
+ goto invalid;
+
+ case 'F':
+ if (l.isall("FontName %+s", &s)) {
+ _afm->set_font_name(s);
+ break;
+ }
+ if (l.isall("FullName %+s", &s)) {
+ _afm->set_full_name(s);
+ break;
+ }
+ if (l.isall("FamilyName %+s", &s)) {
+ _afm->set_family(s);
+ break;
+ }
+ if (l.isall("FontBBox %g %g %g %g",
+ &fd( fdFontBBllx ), &fd( fdFontBBlly ),
+ &fd( fdFontBBurx ), &fd( fdFontBBury )))
+ break;
+ goto invalid;
+
+ case 'I':
+ if (l.isall("ItalicAngle %g", &fd( fdItalicAngle )))
+ break;
+ if (l.isall("IsBaseFont %b", &isbasefont)) {
+ if (isbasefont == 0)
+ composite_warning();
+ break;
+ }
+ if (l.isall("IsFixedV %b", (bool *)0)) {
+ metrics_sets_warning();
+ break;
+ }
+ if (l.isall("IsFixedPitch %b", (bool *)0))
+ break;
+ goto invalid;
+
+ case 'M':
+ if (l.isall("MappingScheme %d", (int *)0)) {
+ composite_warning();
+ break;
+ }
+ if (l.isall("MetricsSets %d", &metrics_sets)) {
+ if (metrics_sets != 0)
+ metrics_sets_warning();
+ break;
+ }
+ goto invalid;
+
+ case 'N':
+ if (l.isall("Notice %+s", &_afm_xt->notice))
+ break;
+ goto invalid;
+
+ case 'S':
+ if (l.isall("StartDirection %d", &direction)) {
+ if (direction != 0)
+ metrics_sets_warning();
+ break;
+ }
+ if (l.isall("StartCharMetrics %d", (int *)0)) {
+ read_char_metrics();
+ break;
+ }
+ if (l.isall("StartKernData")) {
+ read_kerns();
+ break;
+ }
+ if (l.isall("StartComposites %d", (int *)0)) {
+ read_composites();
+ break;
+ }
+ if (l.isall("StdHW %g", &fd( fdStdHW )))
+ break;
+ if (l.isall("StdVW %g", &fd( fdStdVW )))
+ break;
+ if (l.isall("StartFontMetrics %g", (double *)0))
+ break;
+ goto invalid;
+
+ case 'U':
+ if (l.isall("UnderlinePosition %g", &fd( fdUnderlinePosition )))
+ break;
+ if (l.isall("UnderlineThickness %g", &fd( fdUnderlineThickness )))
+ break;
+ goto invalid;
+
+ case 'V':
+ if (l.isall("Version %+s", &s)) {
+ _afm->set_version(s);
+ break;
+ }
+ if (l.isall("VVector %g %g", (double *)0, (double *)0)) {
+ metrics_sets_warning();
+ break;
+ }
+ goto invalid;
+
+ case 'W':
+ if (l.isall("Weight %+s", &s)) {
+ _afm->set_weight(s);
+ break;
+ }
+ goto invalid;
+
+ case 'X':
+ if (l.isall("XHeight %g", &fd( fdXHeight )))
+ break;
+ goto invalid;
+
+ default:
+ invalid:
+ invalid_lines++;
+ no_match_warning();
+
+ }
+
+ done:
+ if (invalid_lines >= l.lineno() - 10)
+ return false;
+ else
+ return true;
+}
+
+
+static Vector<PermString> ligature_left;
+static Vector<PermString> ligature_right;
+static Vector<PermString> ligature_result;
+
+void
+AfmReader::read_char_metric_data() const
+{
+ int c = -1;
+ double wx = UNKDOUBLE;
+ double bllx = UNKDOUBLE, blly = 0, burx = 0, bury = 0;
+ PermString n;
+ PermString ligright, ligresult;
+
+ AfmParser &l = _l;
+
+ l.is("C %d ; WX %g ; N %/s ; B %g %g %g %g ;",
+ &c, &wx, &n, &bllx, &blly, &burx, &bury);
+
+ while (l.left()) {
+
+ switch (l.first()) {
+
+ case 'B':
+ if (l.is("B %g %g %g %g", &bllx, &blly, &burx, &bury))
+ break;
+ goto invalid;
+
+ case 'C':
+ if (l.is("C %d", &c))
+ break;
+ if (l.is("CH <%x>", &c))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (l.isall("EndCharMetrics"))
+ return;
+ goto invalid;
+
+ case 'L':
+ if (l.is("L %/s %/s", &ligright, &ligresult)) {
+ if (!n)
+ lerror("ligature given, but character has no name");
+ else {
+ ligature_left.push_back(n);
+ ligature_right.push_back(ligright);
+ ligature_result.push_back(ligresult);
+ }
+ break;
+ }
+ goto invalid;
+
+ case 'N':
+ if (l.is("N %/s", &n))
+ break;
+ goto invalid;
+
+ case 'W':
+ if (l.is("WX %g", &wx) ||
+ l.is("W0X %g", &wx))
+ break;
+ if (l.is("W %g %g", &wx, (double *)0) ||
+ l.is("W0 %g %g", &wx, (double *)0) ||
+ l.is("W0Y %g", (double *)0)) {
+ y_width_warning();
+ break;
+ }
+ if (l.is("W1X %g", (double *)0) ||
+ l.is("W1Y %g", (double *)0) ||
+ l.is("W1 %g %g", (double *)0, (double *)0)) {
+ metrics_sets_warning();
+ break;
+ }
+ goto invalid;
+
+ default:
+ invalid:
+ // always warn about unknown directives here!
+ no_match_warning("character metrics");
+ l.skip_until(';');
+ break;
+
+ }
+
+ l.is(";"); // get rid of any possible semicolon
+ }
+
+ // create the character
+ if (!n)
+ lwarning("character without a name ignored");
+ else {
+ if (_afm->find(n) != -1)
+ lwarning("character %s defined twice", n.c_str());
+
+ GlyphIndex gi = _afm->add_glyph(n);
+
+ _afm->wd(gi) = wx;
+ _afm->lf(gi) = bllx;
+ _afm->rt(gi) = burx;
+ _afm->tp(gi) = bury;
+ _afm->bt(gi) = blly;
+
+ if (c != -1)
+ _afm->set_code(gi, c);
+ }
+}
+
+
+void
+AfmReader::read_char_metrics() const
+{
+ assert(!ligature_left.size());
+
+ while (_l.next_line())
+ // Grok the whole line. Are we on a character metric data line?
+ switch (_l.first()) {
+
+ case 'C':
+ if (isspace(_l[1]) || (_l[1] == 'H' && isspace(_l[2]))) {
+ read_char_metric_data();
+ break;
+ }
+ if (_l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndCharMetrics"))
+ goto end_char_metrics;
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+
+ }
+
+ end_char_metrics:
+
+ for (int i = 0; i < ligature_left.size(); i++) {
+ GlyphIndex leftgi = find_err(ligature_left[i], "ligature");
+ GlyphIndex rightgi = find_err(ligature_right[i], "ligature");
+ GlyphIndex resultgi = find_err(ligature_result[i], "ligature");
+ if (leftgi >= 0 && rightgi >= 0 && resultgi >= 0)
+ if (_afm->add_lig(leftgi, rightgi, resultgi))
+ lwarning("duplicate ligature; first ignored");
+ }
+ ligature_left.clear();
+ ligature_right.clear();
+ ligature_result.clear();
+}
+
+
+void
+AfmReader::read_kerns() const
+{
+ double kx;
+ PermString left, right;
+ GlyphIndex leftgi, rightgi;
+
+ AfmParser &l = _l;
+ // AFM files have reversed pair programs when read.
+ _afm->pair_program()->set_reversed(true);
+
+ while (l.next_line())
+ switch (l.first()) {
+
+ case 'C':
+ if (l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (l.isall("EndKernPairs"))
+ break;
+ if (l.isall("EndKernData"))
+ return;
+ if (l.isall("EndTrackKern"))
+ break;
+ goto invalid;
+
+ case 'K':
+ if (l.isall("KPX %/s %/s %g", &left, &right, &kx)) {
+ goto validkern;
+ }
+ if (l.isall("KP %/s %/s %g %g", &left, &right, &kx, (double *)0)) {
+ y_width_warning();
+ goto validkern;
+ }
+ if (l.isall("KPY %/s %/s %g", &left, &right, (double *)0)) {
+ y_width_warning();
+ break;
+ }
+ if (l.isall("KPH <%x> <%x> %g %g", (int *)0, (int *)0,
+ (double *)0, (double *)0)) {
+ lwarning("KPH not supported");
+ break;
+ }
+ goto invalid;
+
+ validkern:
+ leftgi = find_err(left, "kern");
+ rightgi = find_err(right, "kern");
+ if (leftgi >= 0 && rightgi >= 0)
+ // A kern with 0 amount is NOT useless!
+ // (Because of multiple masters.)
+ if (_afm->add_kern(leftgi, rightgi, _afm->add_kv(kx)))
+ lwarning("duplicate kern; first pair ignored");
+ break;
+
+ case 'S':
+ if (l.isall("StartKernPairs %d", (int *)0) ||
+ l.isall("StartKernPairs0 %d", (int *)0))
+ break;
+ if (l.isall("StartKernPairs1 %d", (int *)0)) {
+ metrics_sets_warning();
+ break;
+ }
+ if (l.isall("StartTrackKern %d", (int *)0))
+ break;
+ goto invalid;
+
+ case 'T':
+ if (l.isall("TrackKern %g %g %g %g %g", (double *)0, (double *)0,
+ (double *)0, (double *)0, (double *)0))
+ break; // FIXME: implement TrackKern
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+ break;
+
+ }
+}
+
+
+void
+AfmReader::read_composites() const
+{
+ while (_l.next_line())
+ switch (_l.first()) {
+
+ case 'C':
+ if (_l.is("Comment"))
+ break;
+ if (_l.is("CC"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndComposites"))
+ return;
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+ break;
+
+ }
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmparse.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmparse.cc
new file mode 100644
index 00000000000..27cb2365173
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmparse.cc
@@ -0,0 +1,365 @@
+// -*- related-file-name: "../include/efont/afmparse.hh" -*-
+
+/* afmparse.{cc,hh} -- Adobe Font Metrics parsing
+ *
+ * Copyright (c) 1998-2012 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/afmparse.hh>
+#include <efont/t1cs.hh>
+#include <efont/metrics.hh>
+#include <lcdf/strtonum.h>
+#include <string.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <stdlib.h>
+#if HAVE_BROKEN_STRTOD
+# define strtod good_strtod
+#endif
+namespace Efont {
+
+static bool name_enders[256];
+static char xvalue[256];
+
+
+AfmParser::AfmParser(Slurper &slurp)
+ : _slurper(slurp),
+ _line(0), _pos(0), _length(0)
+{
+ static_initialize();
+}
+
+
+void
+AfmParser::trim_end()
+{
+ int l = _length - 1;
+ while (l >= 0 && isspace(_line[l])) {
+ _line[l] = 0;
+ l--;
+ }
+ _length = l + 1;
+}
+
+
+void
+AfmParser::static_initialize()
+{
+ if (name_enders[(uint8_t)'('])
+ return;
+ name_enders[(uint8_t)' '] = name_enders[(uint8_t)'\t']
+ = name_enders[(uint8_t)'\r'] = name_enders[(uint8_t)'\f']
+ = name_enders[(uint8_t)'\v'] = name_enders[(uint8_t)'\n']
+ = name_enders[(uint8_t)'\0'] = name_enders[(uint8_t)'[']
+ = name_enders[(uint8_t)']'] = name_enders[(uint8_t)'/']
+ = name_enders[(uint8_t)'('] = name_enders[(uint8_t)')']
+ = name_enders[(uint8_t)';'] = true;
+
+ xvalue[(uint8_t)'0'] = 0;
+ xvalue[(uint8_t)'1'] = 1;
+ xvalue[(uint8_t)'2'] = 2;
+ xvalue[(uint8_t)'3'] = 3;
+ xvalue[(uint8_t)'4'] = 4;
+ xvalue[(uint8_t)'5'] = 5;
+ xvalue[(uint8_t)'6'] = 6;
+ xvalue[(uint8_t)'7'] = 7;
+ xvalue[(uint8_t)'8'] = 8;
+ xvalue[(uint8_t)'9'] = 9;
+ xvalue[(uint8_t)'a'] = 10;
+ xvalue[(uint8_t)'b'] = 11;
+ xvalue[(uint8_t)'c'] = 12;
+ xvalue[(uint8_t)'d'] = 13;
+ xvalue[(uint8_t)'e'] = 14;
+ xvalue[(uint8_t)'f'] = 15;
+ xvalue[(uint8_t)'A'] = 10;
+ xvalue[(uint8_t)'B'] = 11;
+ xvalue[(uint8_t)'C'] = 12;
+ xvalue[(uint8_t)'D'] = 13;
+ xvalue[(uint8_t)'E'] = 14;
+ xvalue[(uint8_t)'F'] = 15;
+}
+
+
+// isall == is total == is all of the string
+
+// %s whitespace-terminated PermString - non-zero-length
+// %/s name-terminated PermString - non-zero-length
+// %+s rest of line PermString
+// %= rest of line/until next `=' PermString; beginning & ending spaces
+// elided
+// %d integer
+// %g number
+// %x hex integer
+// %b boolean
+// %c character
+// %< hex string; argument is String *stored
+// %. any non-alphanumeric
+// ???????????? EOS vs. don't-skip-to-EOS ???????????
+
+
+#define FAIL(s) do { _message = s; return 0; } while (0)
+
+unsigned char *
+AfmParser::vis(const char *formatsigned, va_list valist)
+{
+ const unsigned char *format = (const unsigned char *)formatsigned;
+ unsigned char *str = _pos;
+
+ // Oftentimes, we'll get a keyword first. So handle that simple case
+ // with a tight loop for (possibly) better performance and slightly different
+ // semantics. (A keyword that comes first in the format must be followed
+ // by a nonalphanumeric in the input to match.)
+ if (isalpha(*format)) {
+ bool ok = true;
+ for (; *format && *format != ' ' && ok; format++, str++) {
+ assert(isalnum(*format));
+ if (*format != *str) ok = false;
+ }
+ if (!ok || isalnum(*str)) {
+ if (_message) return 0;
+ _fail_field = -1;
+ FAIL("keyword mismatch");
+ }
+ }
+
+ int fplus, fslash;
+ _fail_field = 0;
+ _message = PermString();
+
+ while (1) {
+
+ switch (*format) {
+
+ /* - - - - - - - - percent specifications - - - - - - - */
+ case '%':
+ fplus = fslash = 0;
+ _fail_field++;
+
+ percentspec:
+ switch (*++format) {
+
+ // FLAGS
+ case '+':
+ fplus++;
+ goto percentspec;
+ case '/':
+ fslash++;
+ goto percentspec;
+
+ case '%':
+ goto matchchar;
+
+ case 'b':
+ case 's': {
+ int len;
+
+ if (fplus)
+ len = strlen((char *)str);
+ else if (fslash) {
+ for (len = 0; !name_enders[ str[len] ]; len++)
+ ;
+ if (len == 0)
+ FAIL("should be a string");
+ } else {
+ for (len = 0; !isspace(str[len]) && str[len]; len++)
+ ;
+ if (len == 0)
+ FAIL("should be a string");
+ }
+
+ PermString s = PermString((char *)str, len);
+ str += len;
+
+ // Now we have the string. What to do with it? Depends on format.
+ if (*format == 'b') {
+
+ bool *bstore = va_arg(valist, bool *);
+ if (s == "true") {
+ if (bstore) *bstore = 1;
+ } else if (s == "false") {
+ if (bstore) *bstore = 0;
+ } else
+ FAIL("should be `true' or `false'");
+
+ } else {
+ PermString *sstore = va_arg(valist, PermString *);
+ if (sstore) *sstore = s;
+ }
+ break;
+ }
+
+ case '(': {
+ if (*str++ != '(') FAIL("should be a parenthesized string");
+ unsigned char *last = str;
+ int paren_level = 0;
+ while (*last && paren_level >= 0) {
+ if (*last == '(') paren_level++;
+ if (*last == ')') paren_level--;
+ last++;
+ }
+ if (paren_level >= 0) FAIL("had unbalanced parentheses");
+
+ PermString *sstore = va_arg(valist, PermString *);
+ if (sstore) *sstore = PermString((char *)str, last - str - 1);
+ str = last;
+ break;
+ }
+
+ case 'd':
+ case 'i': {
+ union { unsigned char *uc; char *c; } new_str;
+ int v = strtol((char *)str, &new_str.c, 10);
+ if (new_str.uc == str) FAIL("should be an integer");
+
+ str = new_str.uc;
+ int *istore = va_arg(valist, int *);
+ if (istore) *istore = v;
+ break;
+ }
+
+ case 'x': {
+ union { unsigned char *uc; char *c; } new_str;
+ int v = strtol((char *)str, &new_str.c, 16);
+ if (new_str.uc == str) FAIL("should be a hex integer");
+
+ str = new_str.uc;
+ int *istore = va_arg(valist, int *);
+ if (istore) *istore = v;
+ break;
+ }
+
+ case 'e':
+ case 'f':
+ case 'g': {
+ union { unsigned char *uc; char *c; } new_str;
+ double v = strtonumber((char *)str, &new_str.c);
+ if (v < MIN_KNOWN_DOUBLE) v = MIN_KNOWN_DOUBLE;
+ if (new_str.uc == str) FAIL("should be a real number");
+
+ str = new_str.uc;
+ double *dstore = va_arg(valist, double *);
+ if (dstore) *dstore = v;
+ break;
+ }
+
+ case '<': {
+ unsigned char *endbrack =
+ (unsigned char *)strchr((char *)str, '>');
+ int n = (endbrack ? endbrack - (str + 1) : 0);
+ if (!endbrack || n % 2 != 0)
+ FAIL("should be hex values in <angle brackets>");
+ String s = String::make_uninitialized(n/2);
+ unsigned char *data = s.mutable_udata();
+
+ str++;
+ while (*str != '>') {
+ if (isxdigit(str[0]) && isxdigit(str[1])) {
+ *data++ = xvalue[str[0]] * 16 + xvalue[str[1]];
+ str += 2;
+ } else
+ FAIL("had non-hex digits in the angle brackets");
+ }
+ str++;
+
+ if (String *datastore = va_arg(valist, String *))
+ *datastore = s;
+ break;
+ }
+
+ default:
+ assert(0 /* internal error: bad % */);
+ FAIL("");
+
+ }
+ break;
+ /* - - - - - - - - end percent specifications - - - - - - - */
+
+ case ' ':
+ if (!isspace(*str))
+ FAIL("should be followed by whitespace");
+ /* FALLTHRU */
+
+ case '-':
+ while (isspace(*str)) str++;
+ break;
+
+ case 0:
+ // always eat space at end of format
+ while (isspace(*str)) str++;
+ return str;
+
+ default:
+ matchchar:
+ if (*str++ != *format)
+ FAIL(permprintf("- expected `%c'", *format));
+ break;
+
+ }
+
+ format++;
+ }
+}
+
+
+bool
+AfmParser::isall(const char *format, ...)
+{
+ va_list valist;
+ va_start(valist, format);
+ unsigned char *new_pos = vis(format, valist);
+ va_end(valist);
+ if (new_pos && *new_pos == 0) {
+ _pos = new_pos;
+ return 1;
+ } else
+ return 0;
+}
+
+
+bool
+AfmParser::is(const char *format, ...)
+{
+ va_list valist;
+ va_start(valist, format);
+ unsigned char *new_pos = vis(format, valist);
+ va_end(valist);
+ if (new_pos) {
+ _pos = new_pos;
+ return 1;
+ } else
+ return 0;
+}
+
+
+PermString
+AfmParser::keyword() const
+{
+ const char *f = (const char *)_pos;
+ while (isspace((unsigned char) *f))
+ f++;
+ const char *l = f;
+ while (isalnum((unsigned char) *l) || *l == '_')
+ l++;
+ return PermString(f, l - f);
+}
+
+
+void
+AfmParser::skip_until(unsigned char c)
+{
+ while (*_pos && *_pos != c)
+ _pos++;
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmw.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmw.cc
index 20840be1332..29dfd072dc4 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/afmw.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/afmw.cc
@@ -17,7 +17,7 @@
# include <config.h>
#endif
#include <efont/afmw.hh>
-#include <efont/t1cs.hh> /* for KNOWN() */
+#include <efont/t1cs.hh> /* for KNOWN() */
namespace Efont {
AfmWriter::AfmWriter(Metrics *m, FILE *f)
@@ -41,8 +41,8 @@ AfmWriter::write()
fprintf(_f, "StartFontMetrics 4.1\n");
if (_afm_xt)
- for (int i = 0; i < _afm_xt->opening_comments.size(); i++)
- fprintf(_f, "Comment %s\n", _afm_xt->opening_comments[i].c_str());
+ for (int i = 0; i < _afm_xt->opening_comments.size(); i++)
+ fprintf(_f, "Comment %s\n", _afm_xt->opening_comments[i].c_str());
write_prologue();
@@ -50,11 +50,11 @@ AfmWriter::write()
GlyphIndex gi;
for (int i = 0; i < 256; i++) //FIXME
- if ((gi = _m->find_code(i)) >= 0)
- write_char_metric_data(gi, i);
+ if ((gi = _m->find_code(i)) >= 0)
+ write_char_metric_data(gi, i);
for (gi = 0; gi < _m->nglyphs(); gi++)
- if (_m->code(gi) == -1)
- write_char_metric_data(gi, -1);
+ if (_m->code(gi) == -1)
+ write_char_metric_data(gi, -1);
fprintf(_f, "EndCharMetrics\n");
@@ -68,49 +68,49 @@ void
AfmWriter::write_prologue() const
{
if (_m->font_name())
- fprintf(_f, "FontName %s\n", _m->font_name().c_str());
+ fprintf(_f, "FontName %s\n", _m->font_name().c_str());
else
- fprintf(_f, "FontName No-Font-Name-Given\n");
+ fprintf(_f, "FontName No-Font-Name-Given\n");
if (_m->full_name())
- fprintf(_f, "FullName %s\n", _m->full_name().c_str());
+ fprintf(_f, "FullName %s\n", _m->full_name().c_str());
if (_m->family())
- fprintf(_f, "FamilyName %s\n", _m->family().c_str());
+ fprintf(_f, "FamilyName %s\n", _m->family().c_str());
if (_m->weight())
- fprintf(_f, "Weight %s\n", _m->weight().c_str());
+ fprintf(_f, "Weight %s\n", _m->weight().c_str());
if (KNOWN(fd( fdItalicAngle )))
- fprintf(_f, "ItalicAngle %.8g\n", fd( fdItalicAngle ));
+ fprintf(_f, "ItalicAngle %.8g\n", fd( fdItalicAngle ));
fprintf(_f, "FontBBox %.8g %.8g %.8g %.8g\n",
- fd( fdFontBBllx ), fd( fdFontBBlly ),
- fd( fdFontBBurx ), fd( fdFontBBury ));
+ fd( fdFontBBllx ), fd( fdFontBBlly ),
+ fd( fdFontBBurx ), fd( fdFontBBury ));
if (KNOWN(fd( fdUnderlinePosition )))
- fprintf(_f, "UnderlinePosition %.8g\n", fd( fdUnderlinePosition ));
+ fprintf(_f, "UnderlinePosition %.8g\n", fd( fdUnderlinePosition ));
if (KNOWN(fd( fdUnderlineThickness )))
- fprintf(_f, "UnderlineThickness %.8g\n", fd( fdUnderlineThickness ));
+ fprintf(_f, "UnderlineThickness %.8g\n", fd( fdUnderlineThickness ));
if (_m->version())
- fprintf(_f, "Version %s\n", _m->version().c_str());
+ fprintf(_f, "Version %s\n", _m->version().c_str());
if (_afm_xt && _afm_xt->notice)
- fprintf(_f, "Notice %s\n", _afm_xt->notice.c_str());
+ fprintf(_f, "Notice %s\n", _afm_xt->notice.c_str());
if (_afm_xt && _afm_xt->encoding_scheme)
- fprintf(_f, "EncodingScheme %s\n", _afm_xt->encoding_scheme.c_str());
+ fprintf(_f, "EncodingScheme %s\n", _afm_xt->encoding_scheme.c_str());
if (KNOWN(fd( fdCapHeight )))
- fprintf(_f, "CapHeight %.8g\n", fd( fdCapHeight ));
+ fprintf(_f, "CapHeight %.8g\n", fd( fdCapHeight ));
if (KNOWN(fd( fdXHeight )))
- fprintf(_f, "XHeight %.8g\n", fd( fdXHeight ));
+ fprintf(_f, "XHeight %.8g\n", fd( fdXHeight ));
if (KNOWN(fd( fdAscender )))
- fprintf(_f, "Ascender %.8g\n", fd( fdAscender ));
+ fprintf(_f, "Ascender %.8g\n", fd( fdAscender ));
if (KNOWN(fd( fdDescender )))
- fprintf(_f, "Descender %.8g\n", fd( fdDescender ));
+ fprintf(_f, "Descender %.8g\n", fd( fdDescender ));
if (KNOWN(fd( fdStdHW )))
- fprintf(_f, "StdHW %.8g\n", fd( fdStdHW ));
+ fprintf(_f, "StdHW %.8g\n", fd( fdStdHW ));
if (KNOWN(fd( fdStdVW )))
- fprintf(_f, "StdVW %.8g\n", fd( fdStdVW ));
+ fprintf(_f, "StdVW %.8g\n", fd( fdStdVW ));
}
@@ -118,36 +118,36 @@ void
AfmWriter::write_char_metric_data(GlyphIndex gi, int e) const
{
if (e >= -1 && e < 256)
- fprintf(_f, "C %d ;", e);
+ fprintf(_f, "C %d ;", e);
else
- fprintf(_f, "CH <%04X> ;", e);
+ fprintf(_f, "CH <%04X> ;", e);
double w = _m->wd(gi);
if (KNOWN(w))
- fprintf(_f, " WX %.8g ;", w);
+ fprintf(_f, " WX %.8g ;", w);
else
- w = 0;
+ w = 0;
fprintf(_f, " N %s ;", _m->name(gi).c_str());
if (KNOWN(_m->lf(gi)))
- fprintf(_f, " B %.8g %.8g %.8g %.8g ;",
- _m->lf(gi), _m->bt(gi), _m->rt(gi), _m->tp(gi));
+ fprintf(_f, " B %.8g %.8g %.8g %.8g ;",
+ _m->lf(gi), _m->bt(gi), _m->rt(gi), _m->tp(gi));
// Run through the ligature/kern program to find ligatures.
PairProgram &pairp = *_m->pair_program();
PairOpIndex opi = pairp.find_left(gi);
while (opi >= 0) {
- const PairOp &op = pairp.op(opi);
- if (op.is_lig()) {
- if (op.lig_kind() == opLigSimple)
- fprintf(_f, " L %s %s ;",
- _m->name( op.right() ).c_str(),
- _m->name( op.result() ).c_str());
- //else
- //warning("strange ligature combination not supported by AFM");
- }
- opi = op.next_left();
+ const PairOp &op = pairp.op(opi);
+ if (op.is_lig()) {
+ if (op.lig_kind() == opLigSimple)
+ fprintf(_f, " L %s %s ;",
+ _m->name( op.right() ).c_str(),
+ _m->name( op.result() ).c_str());
+ //else
+ //warning("strange ligature combination not supported by AFM");
+ }
+ opi = op.next_left();
}
fputc('\n', _f);
@@ -162,9 +162,9 @@ AfmWriter::write_kerns() const
// Damn. First we have to count how many kerning pairs there are.
int numkerns = 0;
for (PairOpIndex opi = 0; opi < pairp.op_count(); opi++) {
- const PairOp &op = pairp.op(opi);
- if (op.is_kern() && _m->kv( op.value() ))
- numkerns++;
+ const PairOp &op = pairp.op(opi);
+ if (op.is_kern() && _m->kv( op.value() ))
+ numkerns++;
}
if (numkerns == 0) return;
@@ -172,16 +172,16 @@ AfmWriter::write_kerns() const
fprintf(_f, "StartKernData\n");
fprintf(_f, "StartKernPairs %d\n", numkerns);
for (GlyphIndex gi = 0; gi < _m->nglyphs(); gi++) {
- PairOpIndex opi = pairp.find_left(gi);
- while (opi >= 0) {
- const PairOp &op = pairp.op(opi);
- if (op.is_kern() && _m->kv( op.value() ))
- fprintf(_f, "KPX %s %s %.8g\n",
- _m->name( gi ).c_str(),
- _m->name( op.right() ).c_str(),
- _m->kv( op.value() ));
- opi = op.next_left();
- }
+ PairOpIndex opi = pairp.find_left(gi);
+ while (opi >= 0) {
+ const PairOp &op = pairp.op(opi);
+ if (op.is_kern() && _m->kv( op.value() ))
+ fprintf(_f, "KPX %s %s %.8g\n",
+ _m->name( gi ).c_str(),
+ _m->name( op.right() ).c_str(),
+ _m->kv( op.value() ));
+ opi = op.next_left();
+ }
}
fprintf(_f, "EndKernPairs\n");
fprintf(_f, "EndKernData\n");
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/amfm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/amfm.cc
new file mode 100644
index 00000000000..a3fd8232b7d
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/amfm.cc
@@ -0,0 +1,850 @@
+// -*- related-file-name: "../include/efont/amfm.hh" -*-
+
+/* amfm.{cc,hh} -- Adobe Multiple-Master Font Metrics
+ *
+ * Copyright (c) 1998-2012 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/amfm.hh>
+#include <efont/afm.hh>
+#include <efont/afmparse.hh>
+#include <lcdf/error.hh>
+#include <efont/findmet.hh>
+#include <efont/t1cs.hh>
+#include <lcdf/straccum.hh>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <string.h>
+namespace Efont {
+
+AmfmMetrics::AmfmMetrics(MetricsFinder *finder)
+ : _finder(finder),
+ _fdv(fdLast, UNKDOUBLE),
+ _nmasters(-1), _naxes(-1), _masters(0), _mmspace(0),
+ _primary_fonts(0), _sanity_afm(0), _uses(0)
+{
+}
+
+AmfmMetrics::~AmfmMetrics()
+{
+ assert(_uses == 0);
+ for (int m = 0; m < _nmasters; m++)
+ if (_masters[m].afm)
+ _masters[m].afm->unuse();
+ delete[] _masters;
+ delete _mmspace;
+ while (_primary_fonts) {
+ AmfmPrimaryFont *pf = _primary_fonts;
+ _primary_fonts = _primary_fonts->next;
+ delete pf;
+ }
+}
+
+
+bool
+AmfmMetrics::sanity(ErrorHandler *errh) const
+{
+ if (!_mmspace) {
+ errh->error("AMFM sanity: no multiple master interpolation information");
+ return false;
+ }
+
+ bool ok = true;
+ for (int m = 0; m < _nmasters; m++)
+ if (!_masters[m].font_name
+ || _masters[m].weight_vector.size() != _nmasters) {
+ errh->error("AMFM sanity: no information for master %d", m);
+ ok = false;
+ }
+
+ if (!_mmspace->check(errh))
+ ok = false;
+
+ return ok;
+}
+
+
+int
+AmfmMetrics::primary_label_value(int ax, PermString label) const
+{
+ assert(ax >= 0 && ax < _naxes);
+ for (AmfmPrimaryFont *pf = _primary_fonts; pf; pf = pf->next) {
+ if (pf->labels[ax] == label)
+ return pf->design_vector[ax];
+ }
+ return -1;
+}
+
+
+inline static bool
+strcompat(PermString a, PermString b)
+{
+ return !a || !b || a == b;
+}
+
+Metrics *
+AmfmMetrics::master(int m, ErrorHandler *errh)
+{
+ AmfmMaster &master = _masters[m];
+
+ if (!master.loaded) {
+ master.loaded = true;
+ DirectoryMetricsFinder directory_finder(_directory);
+ _finder->add_finder(&directory_finder);
+ Metrics *afm = _finder->find_metrics(master.font_name);
+
+ if (!afm) {
+ if (errh)
+ errh->error("%s: can't find AFM file for master `%s'",
+ _font_name.c_str(), master.font_name.c_str());
+
+ } else if (!strcompat(afm->font_name(), master.font_name)
+ || !strcompat(afm->family(), master.family)
+ || !strcompat(afm->full_name(), master.full_name)
+ || !strcompat(afm->version(), master.version)) {
+ if (errh)
+ errh->error("%s: AFM for master `%s' doesn't match AMFM",
+ _font_name.c_str(), master.font_name.c_str());
+
+ } else if (!_sanity_afm) {
+ master.afm = afm;
+ _sanity_afm = afm;
+ afm->use();
+
+ } else {
+ PairProgram *sanity_pairp = _sanity_afm->pair_program();
+ PairProgram *pairp = afm->pair_program();
+ char buf[1024];
+ buf[0] = 0;
+
+ if (afm->nglyphs() != _sanity_afm->nglyphs())
+ sprintf(buf, "glyph count (%d vs. %d)", afm->nglyphs(), _sanity_afm->nglyphs());
+ if (afm->nfd() != _sanity_afm->nfd())
+ sprintf(buf, "fd count (%d vs. %d)", afm->nfd(), _sanity_afm->nfd());
+ if (afm->nkv() != _sanity_afm->nkv())
+ sprintf(buf, "kv count (%d vs. %d)", afm->nkv(), _sanity_afm->nkv());
+ if (pairp->op_count() != sanity_pairp->op_count())
+ sprintf(buf, "pair op count (%d vs. %d)", pairp->op_count(), sanity_pairp->op_count());
+
+ if (!buf[0]) {
+ master.afm = afm;
+ afm->use();
+ } else if (errh)
+ errh->error("%s: AFM for master `%s' failed sanity checks (%s)", _font_name.c_str(), master.font_name.c_str(), buf);
+ }
+ }
+
+ return master.afm;
+}
+
+
+AmfmPrimaryFont *
+AmfmMetrics::find_primary_font(const Vector<double> &design_vector) const
+{
+ assert(design_vector.size() == _naxes);
+ for (AmfmPrimaryFont *pf = _primary_fonts; pf; pf = pf->next) {
+
+ for (int a = 0; a < _naxes; a++)
+ if ((int)design_vector[a] != pf->design_vector[a])
+ goto loser;
+ return pf;
+
+ loser: ;
+ }
+ return 0;
+}
+
+
+Metrics *
+AmfmMetrics::interpolate(const Vector<double> &design_vector,
+ const Vector<double> &weight_vector,
+ ErrorHandler *errh)
+{
+ assert(design_vector.size() == _naxes);
+ assert(weight_vector.size() == _nmasters);
+
+ // FIXME: check masters for correspondence.
+
+ /* 0.
+ * Make sure all necessary AFMs have been loaded. */
+ int m;
+ for (m = 0; m < _nmasters; m++)
+ if (weight_vector[m])
+ if (!master(m, errh))
+ return 0;
+
+ /* 1.
+ * Use the design vector to generate new FontName and FullName. */
+
+ AmfmPrimaryFont *pf = find_primary_font(design_vector);
+ // The primary font is useless to us if it doesn't have axis labels.
+ if (pf && !pf->labels.size())
+ pf = 0;
+
+ StringAccum font_name_sa, full_name_sa;
+ font_name_sa << _font_name;
+ full_name_sa << _full_name;
+ for (int a = 0; a < _naxes; a++) {
+ double dv = design_vector[a];
+ font_name_sa << '_' << dv;
+ full_name_sa << (a == 0 ? '_' : ' ') << dv;
+
+ PermString label;
+ if (pf)
+ label = pf->labels[a];
+ if (!label)
+ label = _mmspace->axis_abbreviation(a);
+ if (label)
+ full_name_sa << ' ' << label;
+ }
+ // Multiple master fonts require an underscore AFTER the font name too
+ font_name_sa << '_';
+
+ /* 2.
+ * Set up the new AFM with the special constructor. */
+
+ // Find the first master with a non-zero component.
+ for (m = 0; m < _nmasters && weight_vector[m] == 0; m++)
+ ;
+ Metrics *afm = new Metrics(font_name_sa.c_str(), full_name_sa.c_str(), *_masters[m].afm);
+ if (MetricsXt *xt = _masters[m].afm->find_xt("AFM")) {
+ AfmMetricsXt *new_xt = new AfmMetricsXt((AfmMetricsXt &)*xt);
+ afm->add_xt(new_xt);
+ }
+
+ /* 2.
+ * Interpolate the old AFM data into the new. */
+
+ afm->interpolate_dimens(*_masters[m].afm, weight_vector[m], false);
+
+ for (m++; m < _nmasters; m++)
+ if (weight_vector[m])
+ afm->interpolate_dimens(*_masters[m].afm, weight_vector[m], true);
+
+ return afm;
+}
+
+
+/*****
+ * AmfmReader
+ **/
+
+AmfmReader::AmfmReader(AfmParser &afmp, AmfmMetrics *amfm, ErrorHandler *errh)
+ : _amfm(amfm), _finder(amfm->_finder), _l(afmp),
+ _mmspace(amfm->_mmspace)
+{
+ _errh = errh ? errh : ErrorHandler::silent_handler();
+}
+
+AmfmMetrics *
+AmfmReader::read(Slurper &slurper, MetricsFinder *finder, ErrorHandler *errh)
+{
+ AfmParser parser(slurper);
+ if (!parser.ok()) return 0;
+ AmfmMetrics *amfm = new AmfmMetrics(finder);
+ AmfmReader reader(parser, amfm, errh);
+ if (!reader.read()) {
+ delete amfm;
+ return 0;
+ } else
+ return amfm;
+}
+
+AmfmMetrics *
+AmfmReader::read(const Filename &fn, MetricsFinder *finder, ErrorHandler *errh)
+{
+ Slurper slurper(fn);
+ return read(slurper, finder, errh);
+}
+
+void
+AmfmReader::add_amcp_file(Slurper &slurper, AmfmMetrics *amfm, ErrorHandler *errh)
+{
+ AfmParser parser(slurper);
+ if (!parser.ok()) return;
+ AmfmReader reader(parser, amfm, errh);
+ reader.read_amcp_file();
+}
+
+
+void
+AmfmReader::lwarning(const char *format, ...) const
+{
+ va_list val;
+ va_start(val, format);
+ _errh->vxmessage(_l.landmark(), ErrorHandler::e_warning, format, val);
+ va_end(val);
+}
+
+void
+AmfmReader::lerror(const char *format, ...) const
+{
+ va_list val;
+ va_start(val, format);
+ _errh->vxmessage(_l.landmark(), ErrorHandler::e_error, format, val);
+ va_end(val);
+}
+
+void
+AmfmReader::no_match_warning(const char *context) const
+{
+ // keyword() will fail (and a warning won't get printed) only if the string
+ // is all whitespace, which the spec allows
+ PermString keyword = _l.keyword();
+ if (!keyword) return;
+ if (_l.key_matched()) {
+ lwarning(context ? "bad `%s' command in %s:"
+ : "bad `%s' command:", keyword.c_str(), context);
+ lwarning("field %d %s", _l.fail_field(), _l.message().c_str());
+ } else
+ lwarning(context ? "unknown command `%s' in %s"
+ : "unknown command `%s'", keyword.c_str(), context);
+ _l.clear_message();
+}
+
+
+void
+AmfmReader::check_mmspace()
+{
+ if (!_mmspace && _amfm->_naxes >= 0 && _amfm->_nmasters >= 0
+ && _amfm->_font_name) {
+ _mmspace = _amfm->_mmspace =
+ new MultipleMasterSpace(_amfm->_font_name, _amfm->_naxes, _amfm->_nmasters);
+ }
+}
+
+
+bool
+AmfmReader::read()
+{
+ assert(_amfm != 0);
+ _mmspace = _amfm->_mmspace;
+
+ AfmParser &l = _l;
+ _amfm->_directory = l.filename().directory();
+
+ // First, read all opening comments into an array so we can print them out
+ // later.
+ PermString comment;
+ while (l.next_line()) {
+ if (l.isall("Comment %+s", &comment))
+ _amfm->_opening_comments.push_back(comment);
+ else if (l.isall("StartMasterFontMetrics %g", (double *)0))
+ ;
+ else {
+ l.save_line();
+ break;
+ }
+ }
+
+ int master = 0, axis = 0;
+
+ while (l.next_line())
+ switch (l[0]) {
+
+ case 'A':
+ if (l.isall("Ascender %g", &fd( fdAscender )))
+ break;
+ if (l.isall("Axes %d", &_amfm->_naxes)) {
+ check_mmspace();
+ break;
+ }
+ goto invalid;
+
+ case 'B':
+ if (l.is("BlendDesignPositions")) {
+ read_positions();
+ break;
+ }
+ if (l.is("BlendDesignMap")) {
+ read_normalize();
+ break;
+ }
+ if (l.is("BlendAxisTypes")) {
+ read_axis_types();
+ break;
+ }
+ goto invalid;
+
+ case 'C':
+ if (l.isall("CapHeight %g", &fd( fdCapHeight )))
+ break;
+ if (l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'D':
+ if (l.isall("Descender %g", &fd( fdDescender )))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (l.isall("EncodingScheme %+s", &_amfm->_encoding_scheme))
+ break;
+ if (l.isall("EndMasterFontMetrics"))
+ goto done;
+ goto invalid;
+
+ case 'F':
+ if (l.isall("FontName %+s", &_amfm->_font_name)) {
+ check_mmspace();
+ break;
+ }
+ if (l.isall("FullName %+s", &_amfm->_full_name))
+ break;
+ if (l.isall("FamilyName %+s", &_amfm->_family))
+ break;
+ if (l.isall("FontBBox %g %g %g %g",
+ &fd( fdFontBBllx ), &fd( fdFontBBlly ),
+ &fd( fdFontBBurx ), &fd( fdFontBBury )))
+ break;
+ goto invalid;
+
+ case 'I':
+ if (l.isall("IsFixedPitch %b", (bool *)0))
+ break;
+ if (l.isall("ItalicAngle %g", &fd( fdItalicAngle )))
+ break;
+ goto invalid;
+
+ case 'M':
+ if (l.isall("Masters %d", &_amfm->_nmasters)) {
+ check_mmspace();
+ break;
+ }
+ goto invalid;
+
+ case 'N':
+ if (l.isall("Notice %+s", &_amfm->_notice))
+ break;
+ goto invalid;
+
+ case 'S':
+ if (l.isall("StartAxis")) {
+ read_axis(axis++);
+ break;
+ }
+ if (l.isall("StartMaster")) {
+ read_master(master++);
+ break;
+ }
+ if (l.isall("StartPrimaryFonts %d", (int *)0)) {
+ read_primary_fonts();
+ break;
+ }
+ if (l.isall("StartConversionPrograms %d %d", (int *)0, (int *)0)) {
+ read_conversion_programs();
+ break;
+ }
+ if (l.isall("StartMasterFontMetrics %g", (double *)0))
+ break;
+ goto invalid;
+
+ case 'U':
+ if (l.isall("UnderlinePosition %g", &fd( fdUnderlinePosition )))
+ break;
+ else if (l.isall("UnderlineThickness %g", &fd( fdUnderlineThickness )))
+ break;
+ goto invalid;
+
+ case 'V':
+ if (l.isall("Version %+s", &_amfm->_version))
+ break;
+ goto invalid;
+
+ case 'W':
+ if (l.isall("Weight %+s", &_amfm->_weight))
+ break;
+ if (l.is("WeightVector")) {
+ Vector<double> wv;
+ if (!read_simple_array(wv) || !_mmspace)
+ lerror("bad WeightVector");
+ else
+ _mmspace->set_weight_vector(wv);
+ break;
+ }
+ goto invalid;
+
+ case 'X':
+ if (l.isall("XHeight %g", &fd( fdXHeight )))
+ break;
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+
+ }
+
+ done:
+ if (!_mmspace) {
+ _errh->error("`%s' is not an AMFM file", String(_l.landmark().file()).c_str());
+ return false;
+ }
+
+ LandmarkErrorHandler pin_errh(_errh, _l.landmark());
+ if (!_amfm->sanity(&pin_errh)) {
+ _errh->lerror(_l.landmark().whole_file(),
+ "bad AMFM file (missing or inconsistent information)");
+ return false;
+ }
+
+ if (!_mmspace->check_intermediate() && _l.filename().directory()) {
+ String name = l.filename().base() + ".amcp";
+ Slurper slurp(_l.filename().from_directory(name));
+ add_amcp_file(slurp, _amfm, _errh);
+ }
+
+ return true;
+}
+
+
+void
+AmfmReader::read_amcp_file()
+{
+ int lines_read = 0;
+
+ while (_l.next_line()) {
+ lines_read++;
+ switch (_l[0]) {
+
+ case 'C':
+ if (_l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'S':
+ if (_l.isall("StartConversionPrograms %d %d", (int *)0, (int *)0)) {
+ read_conversion_programs();
+ break;
+ }
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning("AMCP file");
+
+ }
+ }
+
+ if (_mmspace && !_mmspace->ndv() && !_mmspace->cdv() && lines_read)
+ lwarning("no conversion programs in .amcp file");
+}
+
+
+bool
+AmfmReader::read_simple_array(Vector<double> &vec) const
+{
+ if (!_l.is("[")) return false;
+
+ vec.clear();
+ double d;
+ while (_l.is("%g", &d))
+ vec.push_back(d);
+
+ return _l.is("]");
+}
+
+
+void
+AmfmReader::read_positions() const
+{
+ if (nmasters() < 2 || naxes() < 1) return;
+ Vector<NumVector> positions;
+ if (!_l.is("[") || !_mmspace) goto error;
+
+ for (int i = 0; i < nmasters(); i++) {
+ positions.push_back(NumVector());
+ if (!read_simple_array(positions.back()))
+ goto error;
+ }
+
+ if (!_l.is("]")) goto error;
+ _mmspace->set_master_positions(positions);
+ return;
+
+ error:
+ lerror("bad BlendDesignPositions");
+}
+
+
+void
+AmfmReader::read_normalize() const
+{
+ if (naxes() < 1) return;
+ Vector<NumVector> normalize_in, normalize_out;
+ if (!_l.is("[") || !_mmspace) goto error;
+
+ for (int a = 0; a < naxes(); a++) {
+ if (!_l.is("[")) goto error;
+ normalize_in.push_back(NumVector());
+ normalize_out.push_back(NumVector());
+ double v1, v2;
+ while (_l.is("[-%g %g-]", &v1, &v2)) {
+ normalize_in[a].push_back(v1);
+ normalize_out[a].push_back(v2);
+ }
+ if (!_l.is("]")) goto error;
+ }
+
+ if (!_l.is("]")) goto error;
+ _mmspace->set_normalize(normalize_in, normalize_out);
+ return;
+
+ error:
+ lerror("bad BlendDesignPositions");
+}
+
+
+void
+AmfmReader::read_axis_types() const
+{
+ PermString s;
+ int ax = 0;
+ Vector<PermString> types;
+ if (naxes() < 1) return;
+ if (!_l.is("[") || !_mmspace) goto error;
+ _mmspace->check();
+
+ while (_l.is("/%/s", &s))
+ _mmspace->set_axis_type(ax++, s);
+
+ if (!_l.is("]")) goto error;
+ return;
+
+ error:
+ lerror("bad BlendAxisTypes");
+}
+
+
+void
+AmfmReader::read_axis(int ax) const
+{
+ bool ok = _mmspace && ax < naxes();
+ if (!ok)
+ lerror("bad axis number %d", ax);
+ else
+ _mmspace->check();
+
+ PermString s;
+ while (_l.next_line())
+ switch (_l[0]) {
+
+ case 'A':
+ if (_l.is("AxisType %+s", &s)) {
+ if (ok)
+ _mmspace->set_axis_type(ax, s);
+ break;
+ }
+ if (_l.is("AxisLabel %+s", &s)) {
+ if (ok)
+ _mmspace->set_axis_label(ax, s);
+ break;
+ }
+ goto invalid;
+
+ case 'C':
+ if (_l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndAxis"))
+ goto endaxis;
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+
+ }
+
+ endaxis: ;
+}
+
+
+void
+AmfmReader::read_master(int m) const
+{
+ AmfmMaster *amfmm;
+ AmfmMaster dummy;
+ if (m >= nmasters()) {
+ lerror("too many masters");
+ amfmm = &dummy;
+ } else {
+ if (!_amfm->_masters)
+ _amfm->_masters = new AmfmMaster[ nmasters() ];
+ amfmm = &_amfm->_masters[m];
+ }
+
+ while (_l.next_line())
+ // Grok the whole line. Are we on a character metric data line?
+ switch (_l[0]) {
+
+ case 'C':
+ if (_l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndMaster"))
+ goto endmaster;
+ goto invalid;
+
+ case 'F':
+ if (_l.isall("FontName %+s", &amfmm->font_name))
+ break;
+ if (_l.isall("FullName %+s", &amfmm->full_name))
+ break;
+ if (_l.isall("FamilyName %+s", &amfmm->family))
+ break;
+ goto invalid;
+
+ case 'V':
+ if (_l.isall("Version %+s", &amfmm->version))
+ break;
+ goto invalid;
+
+ case 'W':
+ if (_l.is("WeightVector")) {
+ if (!(read_simple_array(amfmm->weight_vector) &&
+ amfmm->weight_vector.size() == nmasters())) {
+ lerror("bad WeightVector");
+ amfmm->weight_vector.clear();
+ }
+ break;
+ }
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+
+ }
+
+ endmaster: ;
+}
+
+
+void
+AmfmReader::read_one_primary_font() const
+{
+ AmfmPrimaryFont *pf = new AmfmPrimaryFont;
+ pf->design_vector.resize(naxes());
+ pf->labels.resize(naxes());
+
+ while (_l.left()) {
+
+ if (_l.is("PC")) {
+ for (int a = 0; a < naxes(); a++)
+ if (!_l.is("%d", &pf->design_vector[a]))
+ goto error;
+ } else if (_l.is("PL")) {
+ for (int a = 0; a < naxes(); a++)
+ if (!_l.is("(-%/s-)", &pf->labels[a]))
+ goto error;
+ } else if (_l.is("PN %(", &pf->name))
+ ;
+ else
+ no_match_warning("primary font");
+
+ _l.is(";"); // get rid of any possible semicolon
+ }
+
+ pf->next = _amfm->_primary_fonts;
+ _amfm->_primary_fonts = pf;
+ return;
+
+ error:
+ delete pf;
+}
+
+
+void
+AmfmReader::read_primary_fonts() const
+{
+ while (_l.next_line())
+ switch (_l[0]) {
+
+ case 'C':
+ if (_l.is("Comment"))
+ break;
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndPrimaryFonts"))
+ goto end_primary_fonts;
+ goto invalid;
+
+ case 'P':
+ if (_l[1] == 'C' && isspace(_l[2])) {
+ read_one_primary_font();
+ break;
+ }
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+
+ }
+
+ end_primary_fonts: ;
+}
+
+
+void
+AmfmReader::read_conversion_programs() const
+{
+ String ndv, cdv, s;
+
+ while (_l.next_line())
+ switch (_l[0]) {
+
+ case 'C':
+ if (_l.isall("CDV %<", &s)) {
+ cdv += s;
+ break;
+ }
+ goto invalid;
+
+ case 'E':
+ if (_l.isall("EndConversionPrograms"))
+ goto end_conversion_programs;
+ goto invalid;
+
+ case 'N':
+ if (_l.isall("NDV %<", &s)) {
+ ndv += s;
+ break;
+ }
+ goto invalid;
+
+ default:
+ invalid:
+ no_match_warning();
+ break;
+
+ }
+
+ end_conversion_programs:
+ if (_mmspace) {
+ _mmspace->set_ndv(Type1Charstring(ndv));
+ _mmspace->set_cdv(Type1Charstring(cdv));
+ }
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/cff.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/cff.cc
index 9244afc9f3c..c0eadaa9ae6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/cff.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/cff.cc
@@ -55,24 +55,24 @@ const char * const Cff::operator_names[] = {
};
const int Cff::operator_types[] = {
- tSID, tSID, tSID, tSID, // version, Notice, FullName, FamilyName
+ tSID, tSID, tSID, tSID, // version, Notice, FullName, FamilyName
tSID, tArray4, tP+tArray, tP+tArray, // Weight, FontBBox, BlueValues, OtherBlues
tP+tArray, tP+tArray, tP+tNumber, tP+tNumber, // FamBlues, FamOthBlues, StdHW, StdVW
tNone, tNumber, tArray, tOffset, // escape, UniqueID, XUID, charset
tOffset, tOffset, tPrivateType, tP+tLocalOffset, // Encoding, CharStrings, Private, Subrs
tP+tNumber, tP+tNumber, tNone, tNone, // defaultWX, nominalWX, 22, 23
- tNone, tNone, tNone, tNone, // 24, 25, 26, 27
- tNone, tNone, tNone, tNone, // 28, 29, 30, 31
+ tNone, tNone, tNone, tNone, // 24, 25, 26, 27
+ tNone, tNone, tNone, tNone, // 28, 29, 30, 31
tSID, tBoolean, tNumber, tNumber, // Copyright, isFixedPitch, ItalicAngle, UnderlinePosition
- tNumber, tNumber, tNumber, tArray6, // UnderlineThickness, PaintType, CharstringType, FontMatrix
+ tNumber, tNumber, tNumber, tArray6, // UnderlineThickness, PaintType, CharstringType, FontMatrix
tNumber, tP+tNumber, tP+tNumber, tP+tNumber, // StrokeWidth, BlueScale, BlueShift, BlueFuzz
tP+tArray, tP+tArray, tP+tBoolean, tNone, // StemSnapH, StemSnapV, ForceBold, 12 15
tNone, tP+tNumber, tP+tNumber, tP+tNumber, // 12 16, LanguageGroup, ExpansionFactor, initialRandomSeed
tNumber, tSID, tSID, tArray, // SyntheticBase, PostScript, BaseFontName, BaseFontBlend
- tNone, tNone, tNone, tNone, // 12 24, 12 25, 12 26, 12 27
+ tNone, tNone, tNone, tNone, // 12 24, 12 25, 12 26, 12 27
tNone, tNone, tArray, tNumber, // 12 28, 12 29, ROS, CIDFontVersion
- tNumber, tNumber, tNumber, tNumber, // CIDFontRevision, CIDFontType, CIDCount, UIDBase
- tOffset, tOffset, tSID // FDArray, FDSelect, FontName
+ tNumber, tNumber, tNumber, tNumber, // CIDFontRevision, CIDFontType, CIDCount, UIDBase
+ tOffset, tOffset, tSID // FDArray, FDSelect, FontName
};
static PermString::Initializer initializer;
@@ -278,46 +278,46 @@ static const int expert_subset_charset[] = {
static const uint8_t default_dict_cff_data[] = {
// CFF header
- 1, 0, // format major and minor version
- 4, // header size
- 4, // absolute offset size
+ 1, 0, // format major and minor version
+ 4, // header size
+ 4, // absolute offset size
// Name INDEX
- 0, 1, // one element in index
- 1, // offset size
- 1, 14, // offset array
+ 0, 1, // one element in index
+ 1, // offset size
+ 1, 14, // offset array
'%', 'D', 'E', 'F', 'A', 'U', 'L', 'T', 'D', 'I', 'C', 'T', '%',
// Top DICT INDEX
- 0, 1, // one element in index
- 1, // offset size
- 1, 92, // offset array
+ 0, 1, // one element in index
+ 1, // offset size
+ 1, 92, // offset array
// and the DICT
- 139, 12, 1, // isFixedPitch false
- 139, 12, 2, // ItalicAngle 0
- 39, 12, 3, // UnderlinePosition -100
- 189, 12, 4, // UnderlineThickness 50
- 139, 12, 5, // PaintType 0
- 141, 12, 6, // CharstringType 2
+ 139, 12, 1, // isFixedPitch false
+ 139, 12, 2, // ItalicAngle 0
+ 39, 12, 3, // UnderlinePosition -100
+ 189, 12, 4, // UnderlineThickness 50
+ 139, 12, 5, // PaintType 0
+ 141, 12, 6, // CharstringType 2
30, 0x0A, 0x00, 0x1F, 139, 139, 30, 0x0A, 0x00, 0x1F, 139, 139, 12, 7,
- // FontMatrix 0.001 0 0 0.001 0 0
- 139, 139, 139, 139, 5, // FontBBox 0 0 0 0
- 139, 12, 8, // StrokeWidth 0
- 139, 15, // charset 0
- 139, 16, // Encoding 0
- 139, 12, 31, // CIDFontVersion 0
- 139, 12, 32, // CIDFontRevision 0
- 139, 12, 33, // CIDFontType 0
- 28, 34, 16, 12, 34, // CIDCount 8720
- 30, 0x0A, 0x03, 0x96, 0x25, 0xFF, 12, 9, // BlueScale 0.039625
- 146, 12, 10, // BlueShift 7
- 140, 12, 11, // BlueFuzz 1
- 139, 12, 14, // ForceBold false
- 139, 12, 17, // LanguageGroup 0
- 30, 0x0A, 0x06, 0xFF, 12, 18, // ExpansionFactor 0.06
- 139, 12, 19, // initialRandomSeed 0
- 139, 20, // defaultWidthX 0
- 139, 21, // nominalWidthX 0
+ // FontMatrix 0.001 0 0 0.001 0 0
+ 139, 139, 139, 139, 5, // FontBBox 0 0 0 0
+ 139, 12, 8, // StrokeWidth 0
+ 139, 15, // charset 0
+ 139, 16, // Encoding 0
+ 139, 12, 31, // CIDFontVersion 0
+ 139, 12, 32, // CIDFontRevision 0
+ 139, 12, 33, // CIDFontType 0
+ 28, 34, 16, 12, 34, // CIDCount 8720
+ 30, 0x0A, 0x03, 0x96, 0x25, 0xFF, 12, 9, // BlueScale 0.039625
+ 146, 12, 10, // BlueShift 7
+ 140, 12, 11, // BlueFuzz 1
+ 139, 12, 14, // ForceBold false
+ 139, 12, 17, // LanguageGroup 0
+ 30, 0x0A, 0x06, 0xFF, 12, 18, // ExpansionFactor 0.06
+ 139, 12, 19, // initialRandomSeed 0
+ 139, 20, // defaultWidthX 0
+ 139, 21, // nominalWidthX 0
// String INDEX
0, 0,
@@ -332,15 +332,15 @@ default_dict()
static Cff *cff;
static Cff::Font *cfffont;
if (!cfffont) {
- cff = new Cff(String::make_stable((const char *) default_dict_cff_data, sizeof(default_dict_cff_data)),
+ cff = new Cff(String::make_stable((const char *) default_dict_cff_data, sizeof(default_dict_cff_data)),
0, ErrorHandler::default_handler());
- cfffont = (Cff::Font *) cff->font();
+ cfffont = (Cff::Font *) cff->font();
}
return cfffont->top_dict();
}
-#define POS_GT(pos1, pos2) ((unsigned)(pos1) > (unsigned)(pos2))
+#define POS_GT(pos1, pos2) ((unsigned)(pos1) > (unsigned)(pos2))
Cff::Cff(const String& s, unsigned units_per_em, ErrorHandler* errh)
@@ -359,7 +359,7 @@ Cff::Cff(const String& s, unsigned units_per_em, ErrorHandler* errh)
Cff::~Cff()
{
for (int i = 0; i < _gsubrs_cs.size(); i++)
- delete _gsubrs_cs[i];
+ delete _gsubrs_cs[i];
}
/*
@@ -370,56 +370,56 @@ int
Cff::parse_header(ErrorHandler *errh)
{
if (_gsubrs_index.error() >= 0) // already done
- return 0;
+ return 0;
// parse header
if (_len == 0)
- return errh->error("not a PostScript-flavored OpenType font"), -EFAULT;
+ return errh->error("not a PostScript-flavored OpenType font"), -EFAULT;
if (_len < HEADER_SIZE)
- return errh->error("CFF file corrupted (too small)"), -EFAULT;
- if (_data[0] != 1) // major version number
- return errh->error("bad major version number %d", _data[0]), -ERANGE;
+ return errh->error("CFF file corrupted (too small)"), -EFAULT;
+ if (_data[0] != 1) // major version number
+ return errh->error("bad major version number %d", _data[0]), -ERANGE;
int hdrSize = _data[2], offSize = _data[3];
if (hdrSize < 4 || hdrSize > _len || offSize < 1 || offSize > 4)
- return errh->error("corrupted file header"), -EINVAL;
+ return errh->error("corrupted file header"), -EINVAL;
int name_index_pos = hdrSize;
// parse name INDEX
IndexIterator niter(_data, name_index_pos, _len, errh, "Name INDEX");
if (niter.error() < 0)
- return niter.error();
+ return niter.error();
_name_index.clear();
for (; niter; niter++) {
- const uint8_t *d0 = niter[0];
- const uint8_t *d1 = niter[1];
- if (d0 == d1 || d0[0] == 0)
- _name_index.push_back(PermString());
- else
- _name_index.push_back(PermString(reinterpret_cast<const char *>(d0), d1 - d0));
+ const uint8_t *d0 = niter[0];
+ const uint8_t *d1 = niter[1];
+ if (d0 == d1 || d0[0] == 0)
+ _name_index.push_back(PermString());
+ else
+ _name_index.push_back(PermString(reinterpret_cast<const char *>(d0), d1 - d0));
}
int top_dict_index_pos = niter.index_end() - _data;
// check top DICT INDEX
_top_dict_index = IndexIterator(_data, top_dict_index_pos, _len, errh, "Top DICT INDEX");
if (_top_dict_index.error() < 0)
- return _top_dict_index.error();
+ return _top_dict_index.error();
else if (_top_dict_index.nitems() != nfonts())
- return errh->error("invalid font: Top DICT INDEX has %d elements, but there are %d fonts", _top_dict_index.nitems(), nfonts()), -EINVAL;
+ return errh->error("invalid font: Top DICT INDEX has %d elements, but there are %d fonts", _top_dict_index.nitems(), nfonts()), -EINVAL;
int string_index_pos = _top_dict_index.index_end() - _data;
// check strings INDEX
_strings_index = IndexIterator(_data, string_index_pos, _len, errh, "Strings INDEX");
if (_strings_index.error() < 0)
- return _strings_index.error();
+ return _strings_index.error();
else if (NSTANDARD_STRINGS + _strings_index.nitems() - 1 > MAX_SID)
- return errh->error("too many strings defined in font"), -EINVAL;
+ return errh->error("too many strings defined in font"), -EINVAL;
_strings.assign(_strings_index.nitems(), PermString());
int global_subr_index_pos = _strings_index.index_end() - _data;
// check gsubr INDEX
_gsubrs_index = IndexIterator(_data, global_subr_index_pos, _len, errh, "Gsubrs INDEX");
if (_gsubrs_index.error() < 0)
- return _gsubrs_index.error();
+ return _gsubrs_index.error();
_gsubrs_cs.assign(ngsubrs(), 0);
return 0;
@@ -428,31 +428,31 @@ Cff::parse_header(ErrorHandler *errh)
int
Cff::sid(PermString s)
{
- if (!s) // XXX?
- return -1;
+ if (!s) // XXX?
+ return -1;
// check standard strings
if (standard_permstrings_map["a"] < 0)
- for (int i = 0; i < NSTANDARD_STRINGS; i++) {
- if (!standard_permstrings[i])
- standard_permstrings[i] = PermString(standard_strings[i]);
- standard_permstrings_map.insert(standard_permstrings[i], i);
- }
+ for (int i = 0; i < NSTANDARD_STRINGS; i++) {
+ if (!standard_permstrings[i])
+ standard_permstrings[i] = PermString(standard_strings[i]);
+ standard_permstrings_map.insert(standard_permstrings[i], i);
+ }
int sid = standard_permstrings_map[s];
if (sid >= 0)
- return sid;
+ return sid;
// check user strings
sid = _strings_map[s];
if (sid >= -1)
- return sid;
+ return sid;
for (int i = 0; i < _strings.size(); i++)
- if (!_strings[i] && s.length() == _strings_index[i+1] - _strings_index[i] && memcmp(s.c_str(), _strings_index[i], s.length()) == 0) {
- _strings[i] = s;
- _strings_map.insert(s, i + NSTANDARD_STRINGS);
- return i + NSTANDARD_STRINGS;
- }
+ if (!_strings[i] && s.length() == _strings_index[i+1] - _strings_index[i] && memcmp(s.c_str(), _strings_index[i], s.length()) == 0) {
+ _strings[i] = s;
+ _strings_map.insert(s, i + NSTANDARD_STRINGS);
+ return i + NSTANDARD_STRINGS;
+ }
_strings_map.insert(s, -1);
return -1;
@@ -462,17 +462,17 @@ String
Cff::sid_string(int sid) const
{
if (sid < 0)
- return String();
+ return String();
else if (sid < NSTANDARD_STRINGS)
- return String(sid_permstring(sid));
+ return String(sid_permstring(sid));
else {
- sid -= NSTANDARD_STRINGS;
- if (sid >= _strings.size())
- return String();
- else if (_strings[sid])
- return String(_strings[sid]);
- else
- return String(reinterpret_cast<const char *>(_strings_index[sid]), _strings_index[sid + 1] - _strings_index[sid]);
+ sid -= NSTANDARD_STRINGS;
+ if (sid >= _strings.size())
+ return String();
+ else if (_strings[sid])
+ return String(_strings[sid]);
+ else
+ return String(reinterpret_cast<const char *>(_strings_index[sid]), _strings_index[sid + 1] - _strings_index[sid]);
}
}
@@ -480,23 +480,23 @@ PermString
Cff::sid_permstring(int sid) const
{
if (sid < 0)
- return PermString();
+ return PermString();
else if (sid < NSTANDARD_STRINGS) {
- if (!standard_permstrings[sid])
- standard_permstrings[sid] = PermString(standard_strings[sid]);
- return standard_permstrings[sid];
+ if (!standard_permstrings[sid])
+ standard_permstrings[sid] = PermString(standard_strings[sid]);
+ return standard_permstrings[sid];
} else {
- sid -= NSTANDARD_STRINGS;
- if (sid >= _strings.size())
- return PermString();
- else if (_strings[sid])
- return _strings[sid];
- else {
- PermString s = PermString(reinterpret_cast<const char *>(_strings_index[sid]), _strings_index[sid + 1] - _strings_index[sid]);
- _strings[sid] = s;
- _strings_map.insert(s, sid + NSTANDARD_STRINGS);
- return s;
- }
+ sid -= NSTANDARD_STRINGS;
+ if (sid >= _strings.size())
+ return PermString();
+ else if (_strings[sid])
+ return _strings[sid];
+ else {
+ PermString s = PermString(reinterpret_cast<const char *>(_strings_index[sid]), _strings_index[sid + 1] - _strings_index[sid]);
+ _strings[sid] = s;
+ _strings_map.insert(s, sid + NSTANDARD_STRINGS);
+ return s;
+ }
}
}
@@ -504,7 +504,7 @@ int
Cff::font_offset(int findex, int &offset, int &length) const
{
if (findex < 0 || findex >= nfonts())
- return -ENOENT;
+ return -ENOENT;
offset = _top_dict_index[findex] - _data;
length = _top_dict_index[findex + 1] - _top_dict_index[findex];
return 0;
@@ -514,8 +514,8 @@ int
Cff::font_offset(PermString name, int &offset, int &length) const
{
for (int i = 0; i < _name_index.size(); i++)
- if (_name_index[i] == name && name)
- return font_offset(i, offset, length);
+ if (_name_index[i] == name && name)
+ return font_offset(i, offset, length);
return -ENOENT;
}
@@ -523,29 +523,29 @@ Cff::FontParent *
Cff::font(PermString font_name, ErrorHandler *errh)
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
if (!ok())
- return errh->error("invalid CFF"), (FontParent *) 0;
+ return errh->error("invalid CFF"), (FontParent *) 0;
// search for a font named 'font_name'
for (int i = 0; i < _name_index.size(); i++)
- if (_name_index[i] && (!font_name || font_name == _name_index[i])) {
- int td_offset = _top_dict_index[i] - _data;
- int td_length = _top_dict_index[i + 1] - _top_dict_index[i];
- Dict top_dict(this, td_offset, td_length, errh, "Top DICT");
- if (!top_dict.ok())
- return 0;
- else if (top_dict.has_first(oROS))
- return new Cff::CIDFont(this, _name_index[i], top_dict, errh);
- else
- return new Cff::Font(this, _name_index[i], top_dict, errh);
- }
+ if (_name_index[i] && (!font_name || font_name == _name_index[i])) {
+ int td_offset = _top_dict_index[i] - _data;
+ int td_length = _top_dict_index[i + 1] - _top_dict_index[i];
+ Dict top_dict(this, td_offset, td_length, errh, "Top DICT");
+ if (!top_dict.ok())
+ return 0;
+ else if (top_dict.has_first(oROS))
+ return new Cff::CIDFont(this, _name_index[i], top_dict, errh);
+ else
+ return new Cff::Font(this, _name_index[i], top_dict, errh);
+ }
if (!font_name)
- errh->error("no fonts in CFF");
+ errh->error("no fonts in CFF");
else
- errh->error("font %<%s%> not found", font_name.c_str());
+ errh->error("font %<%s%> not found", font_name.c_str());
return 0;
}
@@ -553,13 +553,13 @@ static inline int
subr_bias(int charstring_type, int nsubrs)
{
if (charstring_type == 1)
- return 0;
+ return 0;
else if (nsubrs < 1240)
- return 107;
+ return 107;
else if (nsubrs < 33900)
- return 1131;
+ return 1131;
else
- return 32768;
+ return 32768;
}
Charstring *
@@ -567,15 +567,15 @@ Cff::gsubr(int i)
{
i += subr_bias(2, ngsubrs());
if (i < 0 || i >= ngsubrs())
- return 0;
+ return 0;
if (!_gsubrs_cs[i]) {
- const uint8_t *s1 = _gsubrs_index[i];
- int slen = _gsubrs_index[i + 1] - s1;
- String cs = data_string().substring(s1 - data(), slen);
- if (slen == 0)
- return 0;
- else
- _gsubrs_cs[i] = new Type2Charstring(cs);
+ const uint8_t *s1 = _gsubrs_index[i];
+ int slen = _gsubrs_index[i + 1] - s1;
+ String cs = data_string().substring(s1 - data(), slen);
+ if (slen == 0)
+ return 0;
+ else
+ _gsubrs_cs[i] = new Type2Charstring(cs);
}
return _gsubrs_cs[i];
}
@@ -594,34 +594,34 @@ void
Cff::Charset::assign(const Cff *cff, int pos, int nglyphs, int max_sid, ErrorHandler *errh)
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
_sids.reserve(nglyphs);
if (pos == 0)
- assign(iso_adobe_charset, sizeof(iso_adobe_charset) / sizeof(int), nglyphs);
+ assign(iso_adobe_charset, sizeof(iso_adobe_charset) / sizeof(int), nglyphs);
else if (pos == 1)
- assign(expert_charset, sizeof(expert_charset) / sizeof(int), nglyphs);
+ assign(expert_charset, sizeof(expert_charset) / sizeof(int), nglyphs);
else if (pos == 2)
- assign(expert_subset_charset, sizeof(expert_subset_charset) / sizeof(int), nglyphs);
+ assign(expert_subset_charset, sizeof(expert_subset_charset) / sizeof(int), nglyphs);
else
- _error = parse(cff, pos, nglyphs, max_sid, errh);
+ _error = parse(cff, pos, nglyphs, max_sid, errh);
if (_error >= 0)
- for (int g = 0; g < _sids.size(); g++) {
- if (_gids[_sids[g]] >= 0) {
- errh->error("glyph %<%s%> in charset twice", cff->sid_permstring(_sids[g]).c_str());
- _error = -EEXIST;
- }
- _gids[_sids[g]] = g;
- }
+ for (int g = 0; g < _sids.size(); g++) {
+ if (_gids[_sids[g]] >= 0) {
+ errh->error("glyph %<%s%> in charset twice", cff->sid_permstring(_sids[g]).c_str());
+ _error = -EEXIST;
+ }
+ _gids[_sids[g]] = g;
+ }
}
void
Cff::Charset::assign(const int *data, int size, int nglyphs)
{
if (size < nglyphs)
- size = nglyphs;
+ size = nglyphs;
_sids.resize(size);
memcpy(&_sids[0], data, sizeof(const int) * size);
_gids.resize(data[size-1] + 1, -1);
@@ -635,54 +635,54 @@ Cff::Charset::parse(const Cff *cff, int pos, int nglyphs, int max_sid, ErrorHand
int len = cff->length();
if (pos + 1 > len)
- return errh->error("charset position out of range"), -EFAULT;
+ return errh->error("charset position out of range"), -EFAULT;
_sids.push_back(0);
int actual_max_sid = 0;
int format = data[pos];
if (format == 0) {
- if (pos + 1 + (nglyphs - 1) * 2 > len)
- return errh->error("charset [format 0] out of range"), -EFAULT;
- const uint8_t *p = data + pos + 1;
- for (; _sids.size() < nglyphs; p += 2) {
- int sid = (p[0] << 8) | p[1];
- if (sid > actual_max_sid)
- actual_max_sid = sid;
- _sids.push_back(sid);
- }
+ if (pos + 1 + (nglyphs - 1) * 2 > len)
+ return errh->error("charset [format 0] out of range"), -EFAULT;
+ const uint8_t *p = data + pos + 1;
+ for (; _sids.size() < nglyphs; p += 2) {
+ int sid = (p[0] << 8) | p[1];
+ if (sid > actual_max_sid)
+ actual_max_sid = sid;
+ _sids.push_back(sid);
+ }
} else if (format == 1) {
- const uint8_t *p = data + pos + 1;
- for (; _sids.size() < nglyphs; p += 3) {
- if (p + 3 > data + len)
- return errh->error("charset [format 1] out of range"), -EFAULT;
- int sid = (p[0] << 8) | p[1];
- int n = p[2];
- if (sid + n > actual_max_sid)
- actual_max_sid = sid + n;
- for (int i = 0; i <= n; i++)
- _sids.push_back(sid + i);
- }
+ const uint8_t *p = data + pos + 1;
+ for (; _sids.size() < nglyphs; p += 3) {
+ if (p + 3 > data + len)
+ return errh->error("charset [format 1] out of range"), -EFAULT;
+ int sid = (p[0] << 8) | p[1];
+ int n = p[2];
+ if (sid + n > actual_max_sid)
+ actual_max_sid = sid + n;
+ for (int i = 0; i <= n; i++)
+ _sids.push_back(sid + i);
+ }
} else if (format == 2) {
- const uint8_t *p = data + pos + 1;
- for (; _sids.size() < nglyphs; p += 4) {
- if (p + 4 > data + len)
- return errh->error("charset [format 2] out of range"), -EFAULT;
- int sid = (p[0] << 8) | p[1];
- int n = (p[2] << 8) | p[3];
- if (sid + n > actual_max_sid)
- actual_max_sid = sid + n;
- for (int i = 0; i <= n; i++)
- _sids.push_back(sid + i);
- }
+ const uint8_t *p = data + pos + 1;
+ for (; _sids.size() < nglyphs; p += 4) {
+ if (p + 4 > data + len)
+ return errh->error("charset [format 2] out of range"), -EFAULT;
+ int sid = (p[0] << 8) | p[1];
+ int n = (p[2] << 8) | p[3];
+ if (sid + n > actual_max_sid)
+ actual_max_sid = sid + n;
+ for (int i = 0; i <= n; i++)
+ _sids.push_back(sid + i);
+ }
} else
- return errh->error("unknown charset format %d", format), -EINVAL;
+ return errh->error("unknown charset format %d", format), -EINVAL;
if (max_sid >= 0 && actual_max_sid > max_sid)
- return errh->error("charset [format %d] uses bad SID %d", format, actual_max_sid), -EINVAL;
+ return errh->error("charset [format %d] uses bad SID %d", format, actual_max_sid), -EINVAL;
_sids.resize(nglyphs);
_gids.resize(actual_max_sid + 1, -1);
return 0;
@@ -697,9 +697,9 @@ void
Cff::FDSelect::assign(const Cff *cff, int pos, int nglyphs, ErrorHandler *errh)
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
if (_my_fds)
- delete[] _fds;
+ delete[] _fds;
_fds = 0;
_my_fds = false;
_nglyphs = nglyphs;
@@ -709,7 +709,7 @@ Cff::FDSelect::assign(const Cff *cff, int pos, int nglyphs, ErrorHandler *errh)
Cff::FDSelect::~FDSelect()
{
if (_my_fds)
- delete[] _fds;
+ delete[] _fds;
}
int
@@ -719,40 +719,40 @@ Cff::FDSelect::parse(const Cff *cff, int pos, int nglyphs, ErrorHandler *errh)
int len = cff->length();
if (pos + 1 > len)
- return errh->error("FDSelect position out of range"), -EFAULT;
+ return errh->error("FDSelect position out of range"), -EFAULT;
int format = data[pos];
if (format == 0) {
- if (pos + 1 + nglyphs > len)
- return errh->error("FDSelect [format 0] out of range"), -EFAULT;
- _fds = data + pos + 1;
- _my_fds = false;
- return 0;
+ if (pos + 1 + nglyphs > len)
+ return errh->error("FDSelect [format 0] out of range"), -EFAULT;
+ _fds = data + pos + 1;
+ _my_fds = false;
+ return 0;
} else if (format == 3) {
- int nranges = (data[pos+1] << 8) | data[pos+2];
- if (pos + 3 + 3*nranges + 2 > len)
- return errh->error("FDSelect [format 3] out of range"), -EFAULT;
-
- const uint8_t *p = data + pos + 3;
- int last_glyph = (p[3*nranges] << 8) | p[3*nranges + 1];
- if (p[0] || p[1] || last_glyph != nglyphs)
- return errh->error("FDSelect [format 3] bad values"), -EINVAL;
-
- _fds = new uint8_t[nglyphs];
- _my_fds = true;
- int curglyph = 0;
- for (; curglyph < nglyphs; p += 3) {
- int nextglyph = (p[3] << 8) | p[4];
- if (nextglyph > nglyphs || nextglyph < curglyph)
- return errh->error("FDSelect [format 3] sorting error"), -EINVAL;
- memset(const_cast<uint8_t *>(_fds + curglyph), p[2], nextglyph - curglyph);
- curglyph = nextglyph;
- }
- return 0;
+ int nranges = (data[pos+1] << 8) | data[pos+2];
+ if (pos + 3 + 3*nranges + 2 > len)
+ return errh->error("FDSelect [format 3] out of range"), -EFAULT;
+
+ const uint8_t *p = data + pos + 3;
+ int last_glyph = (p[3*nranges] << 8) | p[3*nranges + 1];
+ if (p[0] || p[1] || last_glyph != nglyphs)
+ return errh->error("FDSelect [format 3] bad values"), -EINVAL;
+
+ _fds = new uint8_t[nglyphs];
+ _my_fds = true;
+ int curglyph = 0;
+ for (; curglyph < nglyphs; p += 3) {
+ int nextglyph = (p[3] << 8) | p[4];
+ if (nextglyph > nglyphs || nextglyph < curglyph)
+ return errh->error("FDSelect [format 3] sorting error"), -EINVAL;
+ memset(const_cast<uint8_t *>(_fds + curglyph), p[2], nextglyph - curglyph);
+ curglyph = nextglyph;
+ }
+ return 0;
} else
- return errh->error("unknown charset format %d", format), -EINVAL;
+ return errh->error("unknown charset format %d", format), -EINVAL;
}
@@ -764,47 +764,47 @@ Cff::IndexIterator::IndexIterator(const uint8_t *data, int pos, int len, ErrorHa
: _contents(0), _offset(0), _last_offset(0)
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
// check header
int nitems = 0;
if (POS_GT(pos + 2, len)) {
- errh->error("%s: position out of range", index_name);
- _offsize = -EFAULT;
+ errh->error("%s: position out of range", index_name);
+ _offsize = -EFAULT;
} else if (data[pos] == 0 && data[pos + 1] == 0) {
- _contents = data + pos + 2;
- _offsize = 0;
+ _contents = data + pos + 2;
+ _offsize = 0;
} else if (POS_GT(pos + 3, len)) {
- errh->error("%s: position out of range", index_name);
- _offsize = -EFAULT;
+ errh->error("%s: position out of range", index_name);
+ _offsize = -EFAULT;
} else if ((_offsize = data[pos + 2]), (_offsize < 1 || _offsize > 4)) {
- errh->error("%s: offset size %d out of range", index_name, _offsize);
- _offsize = -EINVAL;
+ errh->error("%s: offset size %d out of range", index_name, _offsize);
+ _offsize = -EINVAL;
} else {
- nitems = (data[pos] << 8) | data[pos + 1];
- if (POS_GT(pos + 3 + (nitems + 1) * _offsize, len)) {
- errh->error("%s: data out of range", index_name);
- _offsize = -EFAULT;
- } else {
- _offset = data + pos + 3;
- _last_offset = _offset + nitems * _offsize;
- _contents = _last_offset + _offsize - 1;
- }
+ nitems = (data[pos] << 8) | data[pos + 1];
+ if (POS_GT(pos + 3 + (nitems + 1) * _offsize, len)) {
+ errh->error("%s: data out of range", index_name);
+ _offsize = -EFAULT;
+ } else {
+ _offset = data + pos + 3;
+ _last_offset = _offset + nitems * _offsize;
+ _contents = _last_offset + _offsize - 1;
+ }
}
// check items in offset array
uint32_t max_doff_allowed = len - (pos + 2 + (nitems + 1) * _offsize);
uint32_t last_doff = 1;
for (const uint8_t *o = _offset; o <= _last_offset && _offsize > 0; o += _offsize) {
- uint32_t doff = offset_at(o);
- if (doff > max_doff_allowed) {
- errh->error("%s: element out of range", index_name);
- _offsize = -EFAULT;
- } else if (doff < last_doff) {
- errh->error("%s: garbled elements", index_name);
- break;
- }
- last_doff = doff;
+ uint32_t doff = offset_at(o);
+ if (doff > max_doff_allowed) {
+ errh->error("%s: element out of range", index_name);
+ _offsize = -EFAULT;
+ } else if (doff < last_doff) {
+ errh->error("%s: garbled elements", index_name);
+ break;
+ }
+ last_doff = doff;
}
}
@@ -812,18 +812,18 @@ const uint8_t *
Cff::IndexIterator::index_end() const
{
if (_offsize <= 0)
- return _contents;
+ return _contents;
else
- return _contents + offset_at(_last_offset);
+ return _contents + offset_at(_last_offset);
}
int
Cff::IndexIterator::nitems() const
{
if (_offsize <= 0)
- return 0;
+ return 0;
else
- return (_last_offset - _offset) / _offsize;
+ return (_last_offset - _offset) / _offsize;
}
@@ -852,131 +852,131 @@ Cff::Dict::assign(Cff *cff, int pos, int dict_len, ErrorHandler *errh, const cha
_operands.clear();
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
const uint8_t *data = cff->data() + pos;
const uint8_t *end_data = data + dict_len;
_pointers.push_back(0);
while (data < end_data)
- switch (data[0]) {
-
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- case 8: case 9: case 10: case 11: case 13: case 14: case 15:
- case 16: case 17: case 18: case 19: case 20: case 21:
- _operators.push_back(data[0]);
- _pointers.push_back(_operands.size());
- data++;
- break;
-
- case 22: case 23: case 24: case 25: case 26: case 27: case 31:
- case 255: // reserved
- errh->error("%s: reserved operator %d", dict_name, data[0]);
- return (_error = -ERANGE);
-
- case 12:
- if (data + 1 >= end_data)
- goto runoff;
- _operators.push_back(32 + data[1]);
- _pointers.push_back(_operands.size());
- data += 2;
- break;
-
- case 28: {
- if (data + 2 >= end_data)
- goto runoff;
- int16_t val = (data[1] << 8) | data[2];
- _operands.push_back(val);
- data += 3;
- break;
- }
-
- case 29: {
- if (data + 4 >= end_data)
- goto runoff;
- int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
- _operands.push_back(val);
- data += 5;
- break;
- }
-
- case 30: {
- char buf[1024];
- int pos = 0;
- if (data + 1 >= end_data)
- goto runoff;
- for (data++; data < end_data && pos < 1020; data++) {
- int d = *data;
- for (int i = 0; i < 2; i++, d <<= 4) {
- int digit = (d >> 4) & 0xF;
- switch (digit) {
- case 10:
- buf[pos++] = '.';
- break;
- case 11:
- buf[pos++] = 'E';
- break;
- case 12:
- buf[pos++] = 'E';
- buf[pos++] = '-';
- break;
- case 13:
- errh->error("%s: bad digit in real number", dict_name);
- goto invalid;
- case 14:
- buf[pos++] = '-';
- break;
- case 15:
- goto found;
- default:
- buf[pos++] = digit + '0';
- break;
- }
- }
- }
- // number not found
- goto runoff;
- found:
- char *endptr;
- buf[pos] = '\0';
- _operands.push_back(strtod(buf, &endptr));
- if (*endptr) {
- errh->error("%s: real number syntax error", dict_name);
- goto invalid;
- }
- data++;
- break;
- }
-
- case 247: case 248: case 249: case 250: {
- if (data + 1 >= end_data)
- goto runoff;
- int val = ((data[0] - 247) << 8) + data[1] + 108;
- _operands.push_back(val);
- data += 2;
- break;
- }
-
- case 251: case 252: case 253: case 254: {
- if (data + 1 >= end_data)
- goto runoff;
- int val = -((data[0] - 251) << 8) - data[1] - 108;
- _operands.push_back(val);
- data += 2;
- break;
- }
-
- default:
- _operands.push_back(data[0] - 139);
- data++;
- break;
-
- }
+ switch (data[0]) {
+
+ case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
+ case 8: case 9: case 10: case 11: case 13: case 14: case 15:
+ case 16: case 17: case 18: case 19: case 20: case 21:
+ _operators.push_back(data[0]);
+ _pointers.push_back(_operands.size());
+ data++;
+ break;
+
+ case 22: case 23: case 24: case 25: case 26: case 27: case 31:
+ case 255: // reserved
+ errh->error("%s: reserved operator %d", dict_name, data[0]);
+ return (_error = -ERANGE);
+
+ case 12:
+ if (data + 1 >= end_data)
+ goto runoff;
+ _operators.push_back(32 + data[1]);
+ _pointers.push_back(_operands.size());
+ data += 2;
+ break;
+
+ case 28: {
+ if (data + 2 >= end_data)
+ goto runoff;
+ int16_t val = (data[1] << 8) | data[2];
+ _operands.push_back(val);
+ data += 3;
+ break;
+ }
+
+ case 29: {
+ if (data + 4 >= end_data)
+ goto runoff;
+ int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
+ _operands.push_back(val);
+ data += 5;
+ break;
+ }
+
+ case 30: {
+ char buf[1024];
+ int pos = 0;
+ if (data + 1 >= end_data)
+ goto runoff;
+ for (data++; data < end_data && pos < 1020; data++) {
+ int d = *data;
+ for (int i = 0; i < 2; i++, d <<= 4) {
+ int digit = (d >> 4) & 0xF;
+ switch (digit) {
+ case 10:
+ buf[pos++] = '.';
+ break;
+ case 11:
+ buf[pos++] = 'E';
+ break;
+ case 12:
+ buf[pos++] = 'E';
+ buf[pos++] = '-';
+ break;
+ case 13:
+ errh->error("%s: bad digit in real number", dict_name);
+ goto invalid;
+ case 14:
+ buf[pos++] = '-';
+ break;
+ case 15:
+ goto found;
+ default:
+ buf[pos++] = digit + '0';
+ break;
+ }
+ }
+ }
+ // number not found
+ goto runoff;
+ found:
+ char *endptr;
+ buf[pos] = '\0';
+ _operands.push_back(strtod(buf, &endptr));
+ if (*endptr) {
+ errh->error("%s: real number syntax error", dict_name);
+ goto invalid;
+ }
+ data++;
+ break;
+ }
+
+ case 247: case 248: case 249: case 250: {
+ if (data + 1 >= end_data)
+ goto runoff;
+ int val = ((data[0] - 247) << 8) + data[1] + 108;
+ _operands.push_back(val);
+ data += 2;
+ break;
+ }
+
+ case 251: case 252: case 253: case 254: {
+ if (data + 1 >= end_data)
+ goto runoff;
+ int val = -((data[0] - 251) << 8) - data[1] - 108;
+ _operands.push_back(val);
+ data += 2;
+ break;
+ }
+
+ default:
+ _operands.push_back(data[0] - 139);
+ data++;
+ break;
+
+ }
// not closed by an operator?
if (_pointers.back() != _operands.size()) {
- errh->error("%s: not closed by an operator", dict_name);
- goto invalid;
+ errh->error("%s: not closed by an operator", dict_name);
+ goto invalid;
}
return (_error = 0);
@@ -993,96 +993,96 @@ int
Cff::Dict::check(bool is_private, ErrorHandler *errh, const char *dict_name) const
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
int before_nerrors = errh->nerrors();
// keep track of operator reuse
Vector<int> operators_used;
for (int i = 0; i < _operators.size(); i++) {
- int arity = _pointers[i+1] - _pointers[i];
- double num = (arity == 0 ? 0 : _operands[_pointers[i]]);
- double truncnum = floor(num);
- int op = _operators[i];
- int type = (op > oLastOperator ? tNone : operator_types[op]);
-
- // check reuse
- if (op >= operators_used.size())
- operators_used.resize(op + 1, 0);
- if (operators_used[op] && (type & tTypeMask) != tNone)
- errh->error("%s: operator %<%s%> specified twice", dict_name, operator_names[op]);
- operators_used[op]++;
-
- // check data
- switch (type & tTypeMask) {
-
- case tNone:
- if (op >= 32)
- errh->warning("%s: unknown operator %<12 %d%>", dict_name, op - 32);
- else
- errh->warning("%s: unknown operator %<%d%>", dict_name, op);
- continue;
-
- case tSID:
- if (arity != 1 || num != truncnum || num < 0 || num > _cff->max_sid())
- goto bad_data;
- break;
-
- case tFontNumber:
- if (arity != 1 || num != truncnum || num < 0 || num >= _cff->nfonts())
- goto bad_data;
- break;
-
- case tBoolean:
- if (arity != 1)
- goto bad_data;
- else if (num != 0 && num != 1)
- errh->warning("%s: data for Boolean operator %<%s%> not 0 or 1", dict_name, operator_names[op]);
- break;
-
- case tNumber:
- if (arity != 1)
- goto bad_data;
- break;
-
- case tOffset:
- if (arity != 1 || num != truncnum || num < 0 || num >= _cff->length())
- goto bad_data;
- break;
-
- case tLocalOffset:
- if (arity != 1 || num != truncnum || _pos + num < 0 || _pos + num >= _cff->length())
- goto bad_data;
- break;
-
- case tPrivateType: {
- if (arity != 2 || num != truncnum || num < 0)
- goto bad_data;
- double off = _operands[_pointers[i] + 1];
- if (off < 0 || off + num > _cff->length())
- goto bad_data;
- break;
- }
-
- case tArray2: case tArray3: case tArray4:
- case tArray5: case tArray6:
- if (arity != (type & tTypeMask) - tArray2 + 2)
- goto bad_data;
- break;
-
- case tArray:
- break;
-
- }
-
- // check dict location
- if (((type & tPrivate) != 0) != is_private)
- errh->warning("%s: operator %<%s%> in wrong DICT", dict_name, operator_names[op]);
-
- continue;
+ int arity = _pointers[i+1] - _pointers[i];
+ double num = (arity == 0 ? 0 : _operands[_pointers[i]]);
+ double truncnum = floor(num);
+ int op = _operators[i];
+ int type = (op > oLastOperator ? tNone : operator_types[op]);
+
+ // check reuse
+ if (op >= operators_used.size())
+ operators_used.resize(op + 1, 0);
+ if (operators_used[op] && (type & tTypeMask) != tNone)
+ errh->error("%s: operator %<%s%> specified twice", dict_name, operator_names[op]);
+ operators_used[op]++;
+
+ // check data
+ switch (type & tTypeMask) {
+
+ case tNone:
+ if (op >= 32)
+ errh->warning("%s: unknown operator %<12 %d%>", dict_name, op - 32);
+ else
+ errh->warning("%s: unknown operator %<%d%>", dict_name, op);
+ continue;
+
+ case tSID:
+ if (arity != 1 || num != truncnum || num < 0 || num > _cff->max_sid())
+ goto bad_data;
+ break;
+
+ case tFontNumber:
+ if (arity != 1 || num != truncnum || num < 0 || num >= _cff->nfonts())
+ goto bad_data;
+ break;
+
+ case tBoolean:
+ if (arity != 1)
+ goto bad_data;
+ else if (num != 0 && num != 1)
+ errh->warning("%s: data for Boolean operator %<%s%> not 0 or 1", dict_name, operator_names[op]);
+ break;
+
+ case tNumber:
+ if (arity != 1)
+ goto bad_data;
+ break;
+
+ case tOffset:
+ if (arity != 1 || num != truncnum || num < 0 || num >= _cff->length())
+ goto bad_data;
+ break;
+
+ case tLocalOffset:
+ if (arity != 1 || num != truncnum || _pos + num < 0 || _pos + num >= _cff->length())
+ goto bad_data;
+ break;
+
+ case tPrivateType: {
+ if (arity != 2 || num != truncnum || num < 0)
+ goto bad_data;
+ double off = _operands[_pointers[i] + 1];
+ if (off < 0 || off + num > _cff->length())
+ goto bad_data;
+ break;
+ }
+
+ case tArray2: case tArray3: case tArray4:
+ case tArray5: case tArray6:
+ if (arity != (type & tTypeMask) - tArray2 + 2)
+ goto bad_data;
+ break;
+
+ case tArray:
+ break;
+
+ }
+
+ // check dict location
+ if (((type & tPrivate) != 0) != is_private)
+ errh->warning("%s: operator %<%s%> in wrong DICT", dict_name, operator_names[op]);
+
+ continue;
bad_data:
- errh->error("%s: bad data for operator %<%s%>", dict_name, operator_names[op]);
+ errh->error("%s: bad data for operator %<%s%>", dict_name, operator_names[op]);
}
return (errh->nerrors() != before_nerrors ? -1 : 0);
@@ -1092,8 +1092,8 @@ bool
Cff::Dict::has(DictOperator op) const
{
for (int i = 0; i < _operators.size(); i++)
- if (_operators[i] == op)
- return true;
+ if (_operators[i] == op)
+ return true;
return false;
}
@@ -1102,11 +1102,11 @@ Cff::Dict::xvalue(DictOperator op, Vector<double> &out) const
{
out.clear();
for (int i = 0; i < _operators.size(); i++)
- if (_operators[i] == op) {
- for (int j = _pointers[i]; j < _pointers[i+1]; j++)
- out.push_back(_operands[j]);
- return true;
- }
+ if (_operators[i] == op) {
+ for (int j = _pointers[i]; j < _pointers[i+1]; j++)
+ out.push_back(_operands[j]);
+ return true;
+ }
return false;
}
@@ -1114,10 +1114,10 @@ bool
Cff::Dict::xvalue(DictOperator op, int *val) const
{
for (int i = 0; i < _operators.size(); i++)
- if (_operators[i] == op && _pointers[i] + 1 == _pointers[i+1]) {
- *val = (int) _operands[_pointers[i]];
- return true;
- }
+ if (_operators[i] == op && _pointers[i] + 1 == _pointers[i+1]) {
+ *val = (int) _operands[_pointers[i]];
+ return true;
+ }
return false;
}
@@ -1125,10 +1125,10 @@ bool
Cff::Dict::xvalue(DictOperator op, double *val) const
{
for (int i = 0; i < _operators.size(); i++)
- if (_operators[i] == op && _pointers[i] + 1 == _pointers[i+1]) {
- *val = _operands[_pointers[i]];
- return true;
- }
+ if (_operators[i] == op && _pointers[i] + 1 == _pointers[i+1]) {
+ *val = _operands[_pointers[i]];
+ return true;
+ }
return false;
}
@@ -1155,17 +1155,17 @@ Cff::Dict::unparse(ErrorHandler *errh, const char *dict_name) const
{
StringAccum sa;
for (int i = 0; i < _operators.size(); i++) {
- sa.clear();
- if (_pointers[i] + 1 == _pointers[i+1])
- sa << _operands[_pointers[i]];
- else {
- sa << "[";
- for (int j = _pointers[i]; j < _pointers[i+1]; j++)
- sa << _operands[j] << ' ';
- sa.pop_back();
- sa << "]";
- }
- errh->message("%s: %s %s", dict_name, operator_names[_operators[i]], sa.c_str());
+ sa.clear();
+ if (_pointers[i] + 1 == _pointers[i+1])
+ sa << _operands[_pointers[i]];
+ else {
+ sa << "[";
+ for (int j = _pointers[i]; j < _pointers[i+1]; j++)
+ sa << _operands[j] << ' ';
+ sa.pop_back();
+ sa << "]";
+ }
+ errh->message("%s: %s %s", dict_name, operator_names[_operators[i]], sa.c_str());
}
}
@@ -1176,28 +1176,28 @@ Cff::Dict::unparse(ErrorHandler *errh, const char *dict_name) const
static int
handle_private(Cff *cff, const Cff::Dict &top_dict, Cff::Dict &private_dict,
- double &default_width_x, double &nominal_width_x,
- Cff::IndexIterator &subrs_index, Vector<Charstring *> &subrs_cs,
- ErrorHandler *errh)
+ double &default_width_x, double &nominal_width_x,
+ Cff::IndexIterator &subrs_index, Vector<Charstring *> &subrs_cs,
+ ErrorHandler *errh)
{
Vector<double> private_info;
top_dict.value(Cff::oPrivate, private_info);
int private_offset = (int) private_info[1];
private_dict.assign(cff, private_offset, (int) private_info[0], errh, "Private DICT");
if (private_dict.error() < 0)
- return private_dict.error();
+ return private_dict.error();
else if (private_dict.check(true, errh, "Private DICT") < 0)
- return -EINVAL;
+ return -EINVAL;
//private_dict.unparse(errh, "Private DICT");
private_dict.value(Cff::oDefaultWidthX, &default_width_x);
private_dict.value(Cff::oNominalWidthX, &nominal_width_x);
if (private_dict.has(Cff::oSubrs)) {
- int subrs_offset = 0;
- private_dict.value(Cff::oSubrs, &subrs_offset);
- subrs_index = Cff::IndexIterator(cff->data(), private_offset + subrs_offset, cff->length(), errh, "Subrs INDEX");
- if (subrs_index.error() < 0)
- return subrs_index.error();
+ int subrs_offset = 0;
+ private_dict.value(Cff::oSubrs, &subrs_offset);
+ subrs_index = Cff::IndexIterator(cff->data(), private_offset + subrs_offset, cff->length(), errh, "Subrs INDEX");
+ if (subrs_index.error() < 0)
+ return subrs_index.error();
}
subrs_cs.assign(subrs_index.nitems(), 0);
return 0;
@@ -1216,11 +1216,11 @@ Cff::FontParent::charstring(const IndexIterator &iiter, int which) const
int slen = iiter[which + 1] - s1;
String cs = _cff->data_string().substring(s1 - _cff->data(), slen);
if (slen == 0)
- return 0;
+ return 0;
else if (_charstring_type == 1)
- return new Type1Charstring(cs);
+ return new Type1Charstring(cs);
else
- return new Type2Charstring(cs);
+ return new Type2Charstring(cs);
}
Charstring *
@@ -1246,7 +1246,7 @@ Cff::Font::Font(Cff *cff, PermString font_name, const Dict &top_dict, ErrorHandl
{
assert(!_top_dict.has_first(oROS));
if (_error < 0)
- return;
+ return;
// extract CharStrings
// must use xvalue because we could be creating the default dict!
@@ -1254,8 +1254,8 @@ Cff::Font::Font(Cff *cff, PermString font_name, const Dict &top_dict, ErrorHandl
_top_dict.xvalue(oCharStrings, &charstrings_offset);
_charstrings_index = Cff::IndexIterator(cff->data(), charstrings_offset, cff->length(), errh, "CharStrings INDEX");
if (_charstrings_index.error() < 0) {
- _error = _charstrings_index.error();
- return;
+ _error = _charstrings_index.error();
+ return;
}
_charstrings_cs.assign(_charstrings_index.nitems(), 0);
@@ -1263,14 +1263,14 @@ Cff::Font::Font(Cff *cff, PermString font_name, const Dict &top_dict, ErrorHandl
_top_dict.xvalue(oCharset, &charset);
_charset.assign(cff, charset, _charstrings_index.nitems(), cff->max_sid(), errh);
if (_charset.error() < 0) {
- _error = _charset.error();
- return;
+ _error = _charset.error();
+ return;
}
int Encoding = 0;
_top_dict.xvalue(oEncoding, &Encoding);
if (parse_encoding(Encoding, errh) < 0)
- return;
+ return;
// success!
_error = 0;
@@ -1279,7 +1279,7 @@ Cff::Font::Font(Cff *cff, PermString font_name, const Dict &top_dict, ErrorHandl
Cff::Font::~Font()
{
for (int i = 0; i < _charstrings_cs.size(); i++)
- delete _charstrings_cs[i];
+ delete _charstrings_cs[i];
delete _t1encoding;
}
@@ -1288,75 +1288,75 @@ Cff::Font::parse_encoding(int pos, ErrorHandler *errh)
{
_encoding_pos = pos;
for (int i = 0; i < 256; i++)
- _encoding[i] = 0;
+ _encoding[i] = 0;
// check for standard encodings
if (pos == 0)
- return assign_standard_encoding(standard_encoding);
+ return assign_standard_encoding(standard_encoding);
else if (pos == 1)
- return assign_standard_encoding(expert_encoding);
+ return assign_standard_encoding(expert_encoding);
// otherwise, a custom encoding
const uint8_t *data = _cff->data();
int len = _cff->length();
if (pos + 1 > len)
- return errh->error("Encoding position out of range"), -EFAULT;
+ return errh->error("Encoding position out of range"), -EFAULT;
bool supplemented = (data[pos] & 0x80) != 0;
int format = (data[pos] & 0x7F);
int retval = 0;
int endpos, g = 1;
if (format == 0) {
- endpos = pos + 2 + data[pos + 1];
- if (endpos > len)
- return errh->error("Encoding[0] out of range"), -EFAULT;
- const uint8_t *p = data + pos + 2;
- int n = data[pos + 1];
- for (; g <= n; g++, p++) {
- int e = p[0];
- if (_encoding[e])
- retval = 1;
- _encoding[e] = g;
- }
+ endpos = pos + 2 + data[pos + 1];
+ if (endpos > len)
+ return errh->error("Encoding[0] out of range"), -EFAULT;
+ const uint8_t *p = data + pos + 2;
+ int n = data[pos + 1];
+ for (; g <= n; g++, p++) {
+ int e = p[0];
+ if (_encoding[e])
+ retval = 1;
+ _encoding[e] = g;
+ }
} else if (format == 1) {
- endpos = pos + 2 + data[pos + 1] * 2;
- if (endpos > len)
- return errh->error("Encoding[1] out of range"), -EFAULT;
- const uint8_t *p = data + pos + 2;
- int n = data[pos + 1];
- for (int i = 0; i < n; i++, p += 2) {
- int first = p[0];
- int nLeft = p[1];
- for (int e = first; e <= first + nLeft; e++) {
- if (_encoding[e])
- retval = 1;
- _encoding[e] = g++;
- }
- }
+ endpos = pos + 2 + data[pos + 1] * 2;
+ if (endpos > len)
+ return errh->error("Encoding[1] out of range"), -EFAULT;
+ const uint8_t *p = data + pos + 2;
+ int n = data[pos + 1];
+ for (int i = 0; i < n; i++, p += 2) {
+ int first = p[0];
+ int nLeft = p[1];
+ for (int e = first; e <= first + nLeft; e++) {
+ if (_encoding[e])
+ retval = 1;
+ _encoding[e] = g++;
+ }
+ }
} else
- return errh->error("unknown Encoding format %d", format), -EINVAL;
+ return errh->error("unknown Encoding format %d", format), -EINVAL;
if (g > _charset.nglyphs())
- return errh->error("Encoding glyph %d out of range", g), -EINVAL;
+ return errh->error("Encoding glyph %d out of range", g), -EINVAL;
// check supplements
if (supplemented) {
- if (endpos + data[endpos] * 3 > len)
- return -EINVAL;
- const uint8_t *p = data + endpos + 1;
- int n = data[endpos];
- for (int i = 0; i < n; i++, p += 3) {
- int e = p[0];
- int s = (p[1] << 8) | p[2];
- int g = _charset.sid_to_gid(s);
- if (_encoding[e])
- retval = 1;
- if (g < 0 || g >= _charset.nglyphs())
- return errh->error("Encoding glyph %d out of range", g), -EINVAL;
- _encoding[e] = g;
- }
+ if (endpos + data[endpos] * 3 > len)
+ return -EINVAL;
+ const uint8_t *p = data + endpos + 1;
+ int n = data[endpos];
+ for (int i = 0; i < n; i++, p += 3) {
+ int e = p[0];
+ int s = (p[1] << 8) | p[2];
+ int g = _charset.sid_to_gid(s);
+ if (_encoding[e])
+ retval = 1;
+ if (g < 0 || g >= _charset.nglyphs())
+ return errh->error("Encoding glyph %d out of range", g), -EINVAL;
+ _encoding[e] = g;
+ }
}
// successfully done
@@ -1367,7 +1367,7 @@ int
Cff::Font::assign_standard_encoding(const int *standard_encoding)
{
for (int i = 0; i < 256; i++)
- _encoding[i] = _charset.sid_to_gid(standard_encoding[i]);
+ _encoding[i] = _charset.sid_to_gid(standard_encoding[i]);
return 0;
}
@@ -1376,10 +1376,10 @@ Cff::Font::font_matrix(double matrix[6]) const
{
Vector<double> t1d_matrix;
if (dict_value(oFontMatrix, t1d_matrix) && t1d_matrix.size() == 6)
- memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
+ memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
else {
- matrix[0] = matrix[3] = 0.001;
- matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
+ matrix[0] = matrix[3] = 0.001;
+ matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
}
}
@@ -1387,9 +1387,9 @@ PermString
Cff::Font::glyph_name(int gid) const
{
if (gid >= 0 && gid < nglyphs())
- return _cff->sid_permstring(_charset.gid_to_sid(gid));
+ return _cff->sid_permstring(_charset.gid_to_sid(gid));
else
- return PermString();
+ return PermString();
}
void
@@ -1397,16 +1397,16 @@ Cff::Font::glyph_names(Vector<PermString> &gnames) const
{
gnames.resize(nglyphs());
for (int i = 0; i < nglyphs(); i++)
- gnames[i] = _cff->sid_permstring(_charset.gid_to_sid(i));
+ gnames[i] = _cff->sid_permstring(_charset.gid_to_sid(i));
}
Charstring *
Cff::Font::glyph(int gid) const
{
if (gid < 0 || gid >= nglyphs())
- return 0;
+ return 0;
if (!_charstrings_cs[gid])
- _charstrings_cs[gid] = charstring(_charstrings_index, gid);
+ _charstrings_cs[gid] = charstring(_charstrings_index, gid);
return _charstrings_cs[gid];
}
@@ -1415,9 +1415,9 @@ Cff::Font::glyph(PermString name) const
{
int gid = _charset.sid_to_gid(_cff->sid(name));
if (gid < 0)
- return 0;
+ return 0;
if (!_charstrings_cs[gid])
- _charstrings_cs[gid] = charstring(_charstrings_index, gid);
+ _charstrings_cs[gid] = charstring(_charstrings_index, gid);
return _charstrings_cs[gid];
}
@@ -1431,9 +1431,9 @@ Type1Encoding *
Cff::Font::type1_encoding() const
{
if (_encoding_pos == 0)
- return Type1Encoding::standard_encoding();
+ return Type1Encoding::standard_encoding();
if (!_t1encoding)
- _t1encoding = type1_encoding_copy();
+ _t1encoding = type1_encoding_copy();
return _t1encoding;
}
@@ -1441,11 +1441,11 @@ Type1Encoding *
Cff::Font::type1_encoding_copy() const
{
if (_encoding_pos == 0)
- return Type1Encoding::standard_encoding();
+ return Type1Encoding::standard_encoding();
Type1Encoding *e = new Type1Encoding;
for (int i = 0; i < 256; i++)
- if (_encoding[i])
- e->put(i, _cff->sid_permstring(_charset.gid_to_sid(_encoding[i])));
+ if (_encoding[i])
+ e->put(i, _cff->sid_permstring(_charset.gid_to_sid(_encoding[i])));
return e;
}
@@ -1461,9 +1461,9 @@ Cff::Font::dict_string(DictOperator op) const
Vector<double> vec;
dict_of(op).value(op, vec);
if (vec.size() == 1 && vec[0] >= 0 && vec[0] <= _cff->max_sid())
- return _cff->sid_string((int) vec[0]);
+ return _cff->sid_string((int) vec[0]);
else
- return String();
+ return String();
}
@@ -1479,26 +1479,26 @@ Cff::CIDFont::CIDFont(Cff *cff, PermString font_name, const Dict &top_dict, Erro
// parse top DICT
_error = -EINVAL;
if (_top_dict.check(false, errh, "Top DICT") < 0)
- return;
+ return;
else if (!_top_dict.has(oCharStrings)) {
- errh->error("font has no CharStrings dictionary");
- return;
+ errh->error("font has no CharStrings dictionary");
+ return;
}
//_top_dict.unparse(errh, "Top DICT");
// extract offsets and information from TOP DICT
_top_dict.value(oCharstringType, &_charstring_type);
if (_charstring_type != 1 && _charstring_type != 2) {
- errh->error("unknown CharString type %d", _charstring_type);
- return;
+ errh->error("unknown CharString type %d", _charstring_type);
+ return;
}
int charstrings_offset = 0;
_top_dict.value(oCharStrings, &charstrings_offset);
_charstrings_index = Cff::IndexIterator(cff->data(), charstrings_offset, cff->length(), errh, "CharStrings INDEX");
if (_charstrings_index.error() < 0) {
- _error = _charstrings_index.error();
- return;
+ _error = _charstrings_index.error();
+ return;
}
_charstrings_cs.assign(_charstrings_index.nitems(), 0);
@@ -1506,36 +1506,36 @@ Cff::CIDFont::CIDFont(Cff *cff, PermString font_name, const Dict &top_dict, Erro
_top_dict.value(oCharset, &charset);
_charset.assign(cff, charset, _charstrings_index.nitems(), -1, errh);
if (_charset.error() < 0) {
- _error = _charset.error();
- return;
+ _error = _charset.error();
+ return;
}
// extract information about child fonts
int fdarray_offset = 0;
if (!_top_dict.value(oFDArray, &fdarray_offset)) {
- errh->error("CID-keyed font missing FDArray");
- return;
+ errh->error("CID-keyed font missing FDArray");
+ return;
}
IndexIterator fdarray_index(cff->data(), fdarray_offset, cff->length(), errh, "FDArray INDEX");
for (; fdarray_index; fdarray_index++) {
- Dict d(cff, fdarray_index[0] - cff->data(), fdarray_index[1] - fdarray_index[0], errh, "Top DICT");
- if (!d.ok() || d.check(false, errh, "Top DICT") < 0) {
- _error = d.error();
- return;
- }
- _child_fonts.push_back(new ChildFont(cff, this, _charstring_type, d, errh));
- if (!_child_fonts.back()->ok())
- return;
+ Dict d(cff, fdarray_index[0] - cff->data(), fdarray_index[1] - fdarray_index[0], errh, "Top DICT");
+ if (!d.ok() || d.check(false, errh, "Top DICT") < 0) {
+ _error = d.error();
+ return;
+ }
+ _child_fonts.push_back(new ChildFont(cff, this, _charstring_type, d, errh));
+ if (!_child_fonts.back()->ok())
+ return;
}
int fdselect_offset = 0;
if (!_top_dict.value(oFDSelect, &fdselect_offset)) {
- errh->error("CID-keyed font missing FDSelect");
- return;
+ errh->error("CID-keyed font missing FDSelect");
+ return;
}
_fdselect.assign(cff, fdselect_offset, _charstrings_cs.size(), errh);
if (_fdselect.error() < 0)
- return;
+ return;
// success!
_error = 0;
@@ -1545,9 +1545,9 @@ Cff::CIDFont::CIDFont(Cff *cff, PermString font_name, const Dict &top_dict, Erro
Cff::CIDFont::~CIDFont()
{
for (int i = 0; i < _charstrings_cs.size(); i++)
- delete _charstrings_cs[i];
+ delete _charstrings_cs[i];
for (int i = 0; i < _child_fonts.size(); i++)
- delete _child_fonts[i];
+ delete _child_fonts[i];
}
void
@@ -1563,18 +1563,18 @@ Cff::CIDFont::child_program(int gid) const
{
int fd = _fdselect.gid_to_fd(gid);
if (fd >= 0 && fd < _child_fonts.size())
- return _child_fonts.at_u(fd);
+ return _child_fonts.at_u(fd);
else
- return 0;
+ return 0;
}
PermString
Cff::CIDFont::glyph_name(int gid) const
{
if (gid >= 0 && gid < nglyphs())
- return permprintf("#%d", _charset.gid_to_sid(gid));
+ return permprintf("#%d", _charset.gid_to_sid(gid));
else
- return PermString();
+ return PermString();
}
void
@@ -1582,16 +1582,16 @@ Cff::CIDFont::glyph_names(Vector<PermString> &gnames) const
{
gnames.resize(nglyphs());
for (int i = 0; i < nglyphs(); i++)
- gnames[i] = permprintf("#%d", _charset.gid_to_sid(i));
+ gnames[i] = permprintf("#%d", _charset.gid_to_sid(i));
}
Charstring *
Cff::CIDFont::glyph(int gid) const
{
if (gid < 0 || gid >= nglyphs())
- return 0;
+ return 0;
if (!_charstrings_cs[gid])
- _charstrings_cs[gid] = charstring(_charstrings_index, gid);
+ _charstrings_cs[gid] = charstring(_charstrings_index, gid);
return _charstrings_cs[gid];
}
@@ -1599,11 +1599,11 @@ int
Cff::CIDFont::glyphid(PermString name) const
{
if (name.length() <= 1 || name[0] != '#' || !isdigit((unsigned char) name[1]))
- return -1;
+ return -1;
char *endptr;
long cid = strtol(name.c_str() + 1, &endptr, 10);
if (*endptr != 0)
- return -1;
+ return -1;
return _charset.sid_to_gid(cid);
}
@@ -1622,26 +1622,26 @@ Cff::ChildFont::ChildFont(Cff *cff, Cff::CIDFont *parent, int charstring_type, c
: FontParent(cff), _parent(parent), _top_dict(top_dict)
{
if (!errh)
- errh = ErrorHandler::silent_handler();
+ errh = ErrorHandler::silent_handler();
if (!cff->ok() || !_top_dict.ok()) {
- errh->error("invalid CFF");
- _error = -EINVAL;
- return;
+ errh->error("invalid CFF");
+ _error = -EINVAL;
+ return;
}
// extract offsets and information from TOP DICT
_charstring_type = charstring_type;
_top_dict.value(oCharstringType, &_charstring_type);
if (_charstring_type != 1 && _charstring_type != 2) {
- errh->error("unknown CharString type %d", _charstring_type);
- return;
+ errh->error("unknown CharString type %d", _charstring_type);
+ return;
}
// extract information from Private DICT
if (_top_dict.has(oPrivate)
- && (_error = handle_private(cff, _top_dict, _private_dict, _default_width_x, _nominal_width_x, _subrs_index, _subrs_cs, errh)) < 0)
- return;
+ && (_error = handle_private(cff, _top_dict, _private_dict, _default_width_x, _nominal_width_x, _subrs_index, _subrs_cs, errh)) < 0)
+ return;
// success!
_error = 0;
@@ -1650,7 +1650,7 @@ Cff::ChildFont::ChildFont(Cff *cff, Cff::CIDFont *parent, int charstring_type, c
Cff::ChildFont::~ChildFont()
{
for (int i = 0; i < _subrs_cs.size(); i++)
- delete _subrs_cs[i];
+ delete _subrs_cs[i];
}
Charstring *
@@ -1660,11 +1660,11 @@ Cff::ChildFont::charstring(const IndexIterator &iiter, int which) const
int slen = iiter[which + 1] - s1;
String cs = _cff->data_string().substring(s1 - _cff->data(), slen);
if (slen == 0)
- return 0;
+ return 0;
else if (_charstring_type == 1)
- return new Type1Charstring(cs);
+ return new Type1Charstring(cs);
else
- return new Type2Charstring(cs);
+ return new Type2Charstring(cs);
}
Charstring *
@@ -1672,9 +1672,9 @@ Cff::ChildFont::subr(int i) const
{
i += Efont::subr_bias(_charstring_type, nsubrs_x());
if (i < 0 || i >= nsubrs_x())
- return 0;
+ return 0;
if (!_subrs_cs[i])
- _subrs_cs[i] = charstring(_subrs_index, i);
+ _subrs_cs[i] = charstring(_subrs_index, i);
return _subrs_cs[i];
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/encoding.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/encoding.cc
index a55ecc4db25..a55ecc4db25 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/encoding.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/encoding.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/findmet.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/findmet.cc
index aa5b8167156..69a8805c45e 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/findmet.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/findmet.cc
@@ -28,20 +28,20 @@ namespace Efont {
MetricsFinder::~MetricsFinder()
{
if (_next)
- _next->_prev = _prev;
+ _next->_prev = _prev;
if (_prev)
- _prev->_next = _next;
+ _prev->_next = _next;
}
void
MetricsFinder::add_finder(MetricsFinder *new_finder)
{
if (_next)
- _next->add_finder(new_finder);
+ _next->add_finder(new_finder);
else {
- assert(!new_finder->_prev);
- new_finder->_prev = this;
- _next = new_finder;
+ assert(!new_finder->_prev);
+ new_finder->_prev = this;
+ _next = new_finder;
}
}
@@ -50,9 +50,9 @@ MetricsFinder::find_metrics(PermString name, ErrorHandler *errh)
{
MetricsFinder *f = this;
while (f) {
- Metrics *m = f->find_metrics_x(name, this, errh);
- if (m) return m;
- f = f->_next;
+ Metrics *m = f->find_metrics_x(name, this, errh);
+ if (m) return m;
+ f = f->_next;
}
return 0;
}
@@ -62,9 +62,9 @@ MetricsFinder::find_amfm(PermString name, ErrorHandler *errh)
{
MetricsFinder *f = this;
while (f) {
- AmfmMetrics *m = f->find_amfm_x(name, this, errh);
- if (m) return m;
- f = f->_next;
+ AmfmMetrics *m = f->find_amfm_x(name, this, errh);
+ if (m) return m;
+ f = f->_next;
}
return 0;
}
@@ -101,26 +101,26 @@ MetricsFinder::find_amfm_x(PermString, MetricsFinder *, ErrorHandler *)
Metrics *
MetricsFinder::try_metrics_file(const Filename &fn, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
if (fn.readable()) {
- Metrics *afm = AfmReader::read(fn, errh);
- if (afm) finder->record(afm);
- return afm;
+ Metrics *afm = AfmReader::read(fn, errh);
+ if (afm) finder->record(afm);
+ return afm;
} else
- return 0;
+ return 0;
}
AmfmMetrics *
MetricsFinder::try_amfm_file(const Filename &fn, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
if (fn.readable()) {
- AmfmMetrics *amfm = AmfmReader::read(fn, finder, errh);
- if (amfm) finder->record(amfm);
- return amfm;
+ AmfmMetrics *amfm = AmfmReader::read(fn, finder, errh);
+ if (amfm) finder->record(amfm);
+ return amfm;
} else
- return 0;
+ return 0;
}
@@ -140,7 +140,7 @@ CacheMetricsFinder::~CacheMetricsFinder()
Metrics *
CacheMetricsFinder::find_metrics_x(PermString name, MetricsFinder *,
- ErrorHandler *)
+ ErrorHandler *)
{
int index = _metrics_map[name];
return index >= 0 ? _metrics[index] : 0;
@@ -148,7 +148,7 @@ CacheMetricsFinder::find_metrics_x(PermString name, MetricsFinder *,
AmfmMetrics *
CacheMetricsFinder::find_amfm_x(PermString name, MetricsFinder *,
- ErrorHandler*)
+ ErrorHandler*)
{
int index = _amfm_map[name];
return index >= 0 ? _amfm[index] : 0;
@@ -179,9 +179,9 @@ void
CacheMetricsFinder::clear()
{
for (int i = 0; i < _metrics.size(); i++)
- _metrics[i]->unuse();
+ _metrics[i]->unuse();
for (int i = 0; i < _amfm.size(); i++)
- _amfm[i]->unuse();
+ _amfm[i]->unuse();
_metrics.clear();
_amfm.clear();
_metrics_map.clear();
@@ -200,62 +200,62 @@ InstanceMetricsFinder::InstanceMetricsFinder(bool call_mmpfb)
Metrics *
InstanceMetricsFinder::find_metrics_instance(PermString name,
- MetricsFinder *finder, ErrorHandler *errh)
+ MetricsFinder *finder, ErrorHandler *errh)
{
const char *underscore = strchr(name.c_str(), '_');
PermString amfm_name =
- PermString(name.c_str(), underscore - name.c_str());
+ PermString(name.c_str(), underscore - name.c_str());
AmfmMetrics *amfm = finder->find_amfm(amfm_name, errh);
if (!amfm) return 0;
MultipleMasterSpace *mmspace = amfm->mmspace();
if (!mmspace->check_intermediate() && _call_mmpfb) {
- char *buf = new char[amfm->font_name().length() + 30];
- sprintf(buf, "mmpfb -q --amcp-info '%s'", amfm->font_name().c_str());
-
- FILE *f = popen(buf, "r");
- if (f) {
- Filename fake("<mmpfb output>");
- Slurper slurpy(fake, f);
- AmfmReader::add_amcp_file(slurpy, amfm, errh);
- pclose(f);
- }
-
- delete[] buf;
+ char *buf = new char[amfm->font_name().length() + 30];
+ sprintf(buf, "mmpfb -q --amcp-info '%s'", amfm->font_name().c_str());
+
+ FILE *f = popen(buf, "r");
+ if (f) {
+ Filename fake("<mmpfb output>");
+ Slurper slurpy(fake, f);
+ AmfmReader::add_amcp_file(slurpy, amfm, errh);
+ pclose(f);
+ }
+
+ delete[] buf;
}
Vector<double> design = mmspace->default_design_vector();
int i = 0;
while (underscore[0] == '_' && underscore[1]) {
- double x = strtod(underscore + 1, const_cast<char **>(&underscore));
- mmspace->set_design(design, i, x, errh);
- i++;
+ double x = strtod(underscore + 1, const_cast<char **>(&underscore));
+ mmspace->set_design(design, i, x, errh);
+ i++;
}
Vector<double> weight;
if (!mmspace->design_to_weight(design, weight, errh))
- return 0;
+ return 0;
Metrics *new_afm = amfm->interpolate(design, weight, errh);
if (new_afm) {
- finder->record(new_afm);
- // What if the dimensions changed because the user specified out-of-range
- // dimens? We don't want to reinterpolate each time, so record the new
- // AFM under that name as well.
- if (new_afm->font_name() != name)
- finder->record(new_afm, name);
+ finder->record(new_afm);
+ // What if the dimensions changed because the user specified out-of-range
+ // dimens? We don't want to reinterpolate each time, so record the new
+ // AFM under that name as well.
+ if (new_afm->font_name() != name)
+ finder->record(new_afm, name);
}
return new_afm;
}
Metrics *
InstanceMetricsFinder::find_metrics_x(PermString name, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
if (strchr(name.c_str(), '_'))
- return find_metrics_instance(name, finder, errh);
+ return find_metrics_instance(name, finder, errh);
else
- return 0;
+ return 0;
}
@@ -270,18 +270,18 @@ PsresMetricsFinder::PsresMetricsFinder(PsresDatabase *psres)
Metrics *
PsresMetricsFinder::find_metrics_x(PermString name, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
return try_metrics_file
- (_psres->filename_value("FontAFM", name), finder, errh);
+ (_psres->filename_value("FontAFM", name), finder, errh);
}
AmfmMetrics *
PsresMetricsFinder::find_amfm_x(PermString name, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
return try_amfm_file
- (_psres->filename_value("FontAMFM", name), finder, errh);
+ (_psres->filename_value("FontAMFM", name), finder, errh);
}
@@ -296,25 +296,25 @@ DirectoryMetricsFinder::DirectoryMetricsFinder(PermString d)
Metrics *
DirectoryMetricsFinder::find_metrics_x(PermString name, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
Metrics *afm = try_metrics_file
- (Filename(_directory, permcat(name, ".afm")), finder, errh);
+ (Filename(_directory, permcat(name, ".afm")), finder, errh);
if (!afm)
- afm = try_metrics_file
- (Filename(_directory, permcat(name, ".AFM")), finder, errh);
+ afm = try_metrics_file
+ (Filename(_directory, permcat(name, ".AFM")), finder, errh);
return afm;
}
AmfmMetrics *
DirectoryMetricsFinder::find_amfm_x(PermString name, MetricsFinder *finder,
- ErrorHandler *errh)
+ ErrorHandler *errh)
{
AmfmMetrics *amfm = try_amfm_file
- (Filename(_directory, permcat(name, ".amfm")), finder, errh);
+ (Filename(_directory, permcat(name, ".amfm")), finder, errh);
if (!amfm)
- amfm = try_amfm_file
- (Filename(_directory, permcat(name, ".AMFM")), finder, errh);
+ amfm = try_amfm_file
+ (Filename(_directory, permcat(name, ".AMFM")), finder, errh);
return amfm;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/metrics.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/metrics.cc
index 0dd308056e2..461c100a629 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/metrics.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/metrics.cc
@@ -17,7 +17,7 @@
# include <config.h>
#endif
#include <efont/metrics.hh>
-#include <efont/t1cs.hh> /* for UNKDOUBLE */
+#include <efont/t1cs.hh> /* for UNKDOUBLE */
namespace Efont {
Metrics::Metrics()
@@ -91,7 +91,7 @@ Metrics::add_glyph(PermString n)
static void
set_dimen(Vector<double> &dest, const Vector<double> &src, double scale,
- bool increment)
+ bool increment)
{
int c = src.size();
if (increment)
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otf.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otf.cc
new file mode 100644
index 00000000000..daaf8efb5b8
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otf.cc
@@ -0,0 +1,1491 @@
+// -*- related-file-name: "../include/efont/otf.hh" -*-
+
+/* otf.{cc,hh} -- OpenType font basics
+ *
+ * Copyright (c) 2002-2012 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/otf.hh>
+#include <lcdf/error.hh>
+#include <lcdf/straccum.hh>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <algorithm>
+#include <efont/otfdata.hh> // for ntohl()
+#include <efont/otfname.hh>
+#include <efont/ttfhead.hh>
+
+namespace Efont { namespace OpenType {
+
+Vector<PermString> debug_glyph_names;
+
+Font::Font(const String& s, ErrorHandler* errh)
+ : _str(s), _units_per_em(0) {
+ _str.align(4);
+ _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
+}
+
+int
+Font::parse_header(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // Fixed sfnt version
+ // USHORT numTables
+ // USHORT searchRange
+ // USHORT entrySelector
+ // USHORT rangeShift
+ int len = length();
+ const uint8_t *data = this->data();
+ if (HEADER_SIZE > len)
+ return errh->error("OTF file corrupted (too small)"), -EFAULT;
+ if ((data[0] != 'O' || data[1] != 'T' || data[2] != 'T' || data[3] != 'O')
+ && (data[0] != '\000' || data[1] != '\001'))
+ return errh->error("not an OpenType font (bad magic number)"), -ERANGE;
+ int ntables = Data::u16_aligned(data + 4);
+ if (ntables == 0)
+ return errh->error("OTF contains no tables"), -EINVAL;
+ if (HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * ntables > len)
+ return errh->error("OTF table directory out of range"), -EFAULT;
+
+ // TABLE DIRECTORY ENTRY FORMAT:
+ // ULONG tag
+ // ULONG checksum
+ // ULONG offset
+ // ULONG length
+ uint32_t last_tag = 0U;
+ for (int i = 0; i < ntables; i++) {
+ int loc = HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
+ uint32_t tag = Data::u32_aligned(data + loc);
+ uint32_t offset = Data::u32_aligned(data + loc + 8);
+ uint32_t length = Data::u32_aligned(data + loc + 12);
+ if (tag <= last_tag)
+ return errh->error("tags out of order"), -EINVAL;
+ if (offset + length > (uint32_t) len)
+ return errh->error("OTF data for %<%s%> out of range", Tag(tag).text().c_str()), -EFAULT;
+ if (Tag::head_tag() == tag) {
+ Head head(_str.substring(offset, length));
+ _units_per_em = head.units_per_em();
+ }
+ last_tag = tag;
+ }
+
+ return 0;
+}
+
+bool
+Font::check_checksums(ErrorHandler *errh) const
+{
+ if (error() < 0)
+ return false;
+ int nt = ntables();
+ bool ok = true;
+ for (int i = 0; i < nt; i++) {
+ const uint8_t *entry = data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
+ String tbl = _str.substring(Data::u32_aligned(entry + 8),
+ Data::u32_aligned(entry + 12));
+ uint32_t sum = checksum(tbl);
+ if (Data::u32_aligned(entry) == 0x68656164 // 'head'
+ && tbl.length() >= 12)
+ sum -= Data::u32_aligned(tbl.udata() + 8);
+ if (sum != Data::u32_aligned(entry + 4)) {
+ if (errh)
+ errh->error("table %<%s%> checksum error: %x vs. %x", Tag(Data::u32_aligned(entry)).text().c_str(), sum, Data::u32_aligned(entry + 4));
+ ok = false;
+ }
+ }
+ return ok;
+}
+
+int
+Font::ntables() const
+{
+ if (error() < 0)
+ return 0;
+ else
+ return Data::u16_aligned(data() + 4);
+}
+
+String
+Font::table(Tag tag) const
+{
+ if (error() < 0)
+ return String();
+ const uint8_t *entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
+ if (entry)
+ return _str.substring(Data::u32_aligned(entry + 8), Data::u32_aligned(entry + 12));
+ else
+ return String();
+}
+
+bool
+Font::has_table(Tag tag) const
+{
+ const uint8_t *entry = 0;
+ if (error() >= 0)
+ entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
+ return entry != 0;
+}
+
+uint32_t
+Font::table_checksum(Tag tag) const
+{
+ if (error() < 0)
+ return 0;
+ const uint8_t *entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE);
+ if (entry)
+ return Data::u32_aligned(entry + 4);
+ else
+ return 0;
+}
+
+Tag
+Font::table_tag(int i) const
+{
+ if (error() < 0 || i < 0 || i >= ntables())
+ return Tag();
+ else
+ return Tag(Data::u32_aligned(data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i));
+}
+
+uint32_t
+Font::checksum(const uint8_t *begin, const uint8_t *end)
+{
+ uint32_t sum = 0;
+ if (reinterpret_cast<uintptr_t>(begin) % 4)
+ for (; begin + 3 < end; begin += 4)
+ sum += Data::u32(begin);
+ else
+ for (; begin + 3 < end; begin += 4)
+ sum += Data::u32_aligned(begin);
+ uint32_t leftover = 0;
+ for (int i = 0; i < 4; i++)
+ leftover = (leftover << 8) + (begin < end ? *begin++ : 0);
+ return sum + leftover;
+}
+
+uint32_t
+Font::checksum(const String &s)
+{
+ return checksum(reinterpret_cast<const uint8_t *>(s.begin()), reinterpret_cast<const uint8_t *>(s.end()));
+}
+
+namespace {
+class TagCompar { public:
+ TagCompar(const Vector<Tag> &tags) : _tags(tags) { }
+ bool operator()(int a, int b) { return _tags[a] < _tags[b]; }
+ const Vector<Tag> &_tags;
+};
+}
+
+Font
+Font::make(bool truetype, const Vector<Tag>& tags, const Vector<String>& data)
+{
+ StringAccum sa;
+
+ // create offset table
+ {
+ union {
+ uint8_t c[HEADER_SIZE];
+ uint16_t s[HEADER_SIZE / 2];
+ uint32_t l[HEADER_SIZE / 4];
+ } hdr;
+ hdr.l[0] = (truetype ? htonl(0x00010000) : htonl(0x4F54544F));
+ hdr.s[2] = htons(tags.size());
+ int entrySelector;
+ for (entrySelector = 0; (2 << entrySelector) <= tags.size(); entrySelector++)
+ /* nada */;
+ hdr.s[3] = htons((1 << entrySelector) * 16);
+ hdr.s[4] = htons(entrySelector);
+ hdr.s[5] = htons((tags.size() - (1 << entrySelector)) * 16);
+ sa.append(&hdr.c[0], HEADER_SIZE);
+ }
+
+ // sort tags
+ Vector<int> permut;
+ for (int i = 0; i < tags.size(); i++)
+ permut.push_back(i);
+ std::sort(permut.begin(), permut.end(), TagCompar(tags));
+
+ // table listing
+ uint32_t offset = HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * tags.size();
+ for (int *tp = permut.begin(); tp < permut.end(); tp++) {
+ union {
+ uint8_t c[TABLE_DIR_ENTRY_SIZE];
+ uint32_t l[TABLE_DIR_ENTRY_SIZE / 4];
+ } tdir;
+ tdir.l[0] = htonl(tags[*tp].value());
+
+ // discount current checksum adjustment in head table
+ uint32_t sum = checksum(data[*tp]);
+ if (tags[*tp] == Tag("head") && data[*tp].length() >= 12)
+ sum -= Data::u32(data[*tp].udata() + 8);
+ tdir.l[1] = htonl(sum);
+
+ tdir.l[2] = htonl(offset);
+ tdir.l[3] = htonl(data[*tp].length());
+ sa.append(&tdir.c[0], TABLE_DIR_ENTRY_SIZE);
+ offset += (data[*tp].length() + 3) & ~3;
+ }
+
+ // actual tables
+ for (int *tp = permut.begin(); tp < permut.end(); tp++) {
+ sa << data[*tp];
+ while (sa.length() % 4)
+ sa << '\0';
+ }
+
+ // fix 'head' table
+ for (int i = 0; i < tags.size(); i++) {
+ unsigned char *thdr = sa.udata() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i;
+ if (Data::u32(thdr) == 0x68656164 && Data::u32(thdr + 12) >= 12) {
+ uint32_t offset = Data::u32(thdr + 8);
+ char *head = sa.data() + offset;
+ memset(head + 8, '\0', 4);
+ uint32_t allsum = checksum(reinterpret_cast<uint8_t *>(sa.data()), reinterpret_cast<uint8_t *>(sa.data() + sa.length()));
+ uint32_t *adj = reinterpret_cast<uint32_t *>(head + 8);
+ *adj = htonl(0xB1B0AFBA - allsum);
+ }
+ }
+
+ return Font(sa.take_string());
+}
+
+
+/**************************
+ * Tag *
+ * *
+ **************************/
+
+Tag::Tag(const char *s)
+ : _tag(0)
+{
+ if (!s)
+ s = "";
+ for (int i = 0; i < 4; i++)
+ if (*s == 0)
+ _tag = (_tag << 8) | 0x20;
+ else if (*s < 32 || *s > 126) { // don't care if s is signed
+ _tag = 0;
+ return;
+ } else
+ _tag = (_tag << 8) | *s++;
+ if (*s)
+ _tag = 0;
+}
+
+Tag::Tag(const String &s)
+ : _tag(0)
+{
+ if (s.length() <= 4) {
+ const char *ss = s.data();
+ for (int i = 0; i < s.length(); i++, ss++)
+ if (*ss < 32 || *ss > 126) {
+ _tag = 0;
+ return;
+ } else
+ _tag = (_tag << 8) | *ss;
+ for (int i = s.length(); i < 4; i++)
+ _tag = (_tag << 8) | 0x20;
+ }
+}
+
+bool
+Tag::valid() const
+{
+ uint32_t tag = _tag;
+ for (int i = 0; i < 4; i++, tag >>= 8)
+ if ((tag & 255) < 32 || (tag & 255) > 126)
+ return false;
+ return true;
+}
+
+String
+Tag::text() const
+{
+ StringAccum sa;
+ uint32_t tag = _tag;
+ for (int i = 0; i < 4; i++, tag = (tag << 8) | 0x20)
+ if (tag != 0x20202020) {
+ uint8_t c = (tag >> 24) & 255;
+ if (c < 32 || c > 126)
+ sa.snprintf(6, "\\%03o", c);
+ else
+ sa << c;
+ }
+ return sa.take_string();
+}
+
+String
+Tag::langsys_text(Tag script, Tag langsys)
+{
+ if (!langsys.null())
+ return script.text() + "." + langsys.text();
+ else
+ return script.text();
+}
+
+const uint8_t *
+Tag::table_entry(const uint8_t *table, int n, int entry_size) const
+{
+ assert(((uintptr_t)table & 1) == 0);
+ int l = 0, r = n;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ const uint8_t *entry = table + m * entry_size;
+ uint32_t m_tag = Data::u32_aligned16(entry);
+ if (_tag < m_tag)
+ r = m;
+ else if (_tag == m_tag)
+ return entry;
+ else
+ l = m + 1;
+ }
+ return 0;
+}
+
+
+
+/**************************
+ * ScriptList *
+ * *
+ **************************/
+
+int
+ScriptList::assign(const String &str, ErrorHandler *errh)
+{
+ _str = str;
+ _str.align(4);
+ int result = check_header(errh ? errh : ErrorHandler::silent_handler());
+ if (result < 0)
+ _str = String();
+ return result;
+}
+
+int
+ScriptList::check_header(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // USHORT scriptCount
+ // 6bytes scriptRecord[]
+ int scriptCount;
+ if (_str.length() < SCRIPTLIST_HEADERSIZE
+ || (scriptCount = Data::u16_aligned(_str.udata()),
+ _str.length() < SCRIPTLIST_HEADERSIZE + scriptCount*SCRIPT_RECSIZE))
+ return errh->error("OTF ScriptList too short");
+
+ // XXX check that scripts are sorted
+
+ return 0;
+}
+
+int
+ScriptList::script_offset(Tag script) const
+{
+ if (_str.length() == 0)
+ return -1;
+ const uint8_t *data = _str.udata();
+ if (const uint8_t *entry = script.table_entry(data + SCRIPTLIST_HEADERSIZE, Data::u16_aligned(data), SCRIPT_RECSIZE))
+ return Data::u16_aligned(entry + 4);
+ else
+ return 0;
+}
+
+int
+ScriptList::check_script(Tag tag, int script_off, ErrorHandler *errh) const
+{
+ const uint8_t *data = _str.udata();
+ int langSysCount;
+ if (_str.length() < script_off + SCRIPT_HEADERSIZE
+ || (langSysCount = Data::u16_aligned(data + script_off + 2),
+ (_str.length() < script_off + SCRIPT_HEADERSIZE + langSysCount*LANGSYS_RECSIZE)))
+ return (errh ? errh->error("OTF Script table for %<%s%> out of range", tag.text().c_str()) : -1);
+ // XXX check that langsys are sorted
+ return 0;
+}
+
+int
+ScriptList::langsys_offset(Tag script, Tag langsys, ErrorHandler *errh) const
+{
+ int script_off = script_offset(script);
+ if (script_off == 0) {
+ script = Tag("DFLT");
+ script_off = script_offset(script);
+ }
+ if (script_off <= 0)
+ return script_off;
+
+ // check script bounds
+ if (check_script(script, script_off, errh) < 0)
+ return -1;
+
+ // search script table
+ const uint8_t *data = _str.udata();
+ int langSysCount = Data::u16_aligned(data + script_off + 2);
+ if (const uint8_t *entry = langsys.table_entry(data + script_off + SCRIPT_HEADERSIZE, langSysCount, LANGSYS_RECSIZE))
+ return script_off + Data::u16_aligned(entry + 4);
+
+ // return default
+ int defaultLangSys = Data::u16_aligned(data + script_off);
+ if (defaultLangSys != 0)
+ return script_off + defaultLangSys;
+ else
+ return 0;
+}
+
+int
+ScriptList::language_systems(Vector<Tag> &script, Vector<Tag> &langsys, ErrorHandler *errh) const
+{
+ script.clear();
+ langsys.clear();
+
+ const uint8_t *data = _str.udata();
+ int nscripts = Data::u16_aligned(data);
+ for (int i = 0; i < nscripts; i++) {
+ Tag script_tag(Data::u32_aligned16(data + SCRIPTLIST_HEADERSIZE + i*SCRIPT_RECSIZE));
+ int script_off = Data::u16_aligned(data + SCRIPTLIST_HEADERSIZE + i*SCRIPT_RECSIZE + 4);
+ if (check_script(script_tag, script_off, errh) < 0)
+ return -1;
+ const uint8_t *script_table = data + script_off;
+ if (Data::u16_aligned(script_table) != 0) // default LangSys
+ script.push_back(script_tag), langsys.push_back(Tag());
+ int nlangsys = Data::u16_aligned(script_table + 2);
+ for (int j = 0; j < nlangsys; j++) {
+ Tag langsys_tag(Data::u32_aligned16(script_table + SCRIPT_HEADERSIZE + j*LANGSYS_RECSIZE));
+ script.push_back(script_tag), langsys.push_back(langsys_tag);
+ }
+ }
+
+ return 0;
+}
+
+int
+ScriptList::features(Tag script, Tag langsys, int &required_fid, Vector<int> &fids, ErrorHandler *errh, bool clear_fids) const
+{
+ required_fid = -1;
+ if (clear_fids)
+ fids.clear();
+
+ int offset = langsys_offset(script, langsys);
+ if (offset <= 0)
+ return offset;
+
+ // check langsys bounds
+ const uint8_t *data = _str.udata();
+ int featureCount;
+ if (_str.length() < offset + LANGSYS_HEADERSIZE
+ || (featureCount = Data::u16_aligned(data + offset + 4),
+ (_str.length() < offset + LANGSYS_HEADERSIZE + featureCount*FEATURE_RECSIZE)))
+ return (errh ? errh->error("OTF LangSys table for %<%s/%s%> out of range", script.text().c_str(), langsys.text().c_str()) : -1);
+
+ // search langsys table
+ int f = Data::u16_aligned(data + offset + 2);
+ if (f != 0xFFFF)
+ required_fid = f;
+ data += offset + 6;
+ for (int i = 0; i < featureCount; i++, data += FEATURE_RECSIZE)
+ fids.push_back(Data::u16_aligned(data));
+
+ return 0;
+}
+
+
+
+/**************************
+ * FeatureList *
+ * *
+ **************************/
+
+int
+FeatureList::assign(const String &str, ErrorHandler *errh)
+{
+ _str = str;
+ _str.align(2);
+ int result = check_header(errh ? errh : ErrorHandler::silent_handler());
+ if (result < 0)
+ _str = String();
+ return result;
+}
+
+int
+FeatureList::check_header(ErrorHandler *errh)
+{
+ int featureCount;
+ if (_str.length() < FEATURELIST_HEADERSIZE
+ || (featureCount = Data::u16_aligned(_str.udata()),
+ _str.length() < FEATURELIST_HEADERSIZE + featureCount*FEATURE_RECSIZE))
+ return errh->error("OTF FeatureList too short");
+ return 0;
+}
+
+Tag
+FeatureList::tag(int fid) const
+{
+ if (_str.length() == 0)
+ return Tag();
+ const uint8_t *data = _str.udata();
+ int nfeatures = Data::u16_aligned(data);
+ if (fid >= 0 && fid < nfeatures)
+ return Tag(Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE));
+ else
+ return Tag();
+}
+
+String
+FeatureList::params(int fid, int length, ErrorHandler *errh, bool old_style_offset) const
+{
+ if (_str.length() == 0 || length < 0)
+ return String();
+ if (errh == 0)
+ errh = ErrorHandler::silent_handler();
+
+ const uint8_t *data = _str.udata();
+ int len = _str.length();
+ int nfeatures = Data::u16_aligned(data);
+ if (fid < 0 || fid >= nfeatures)
+ return errh->error("OTF feature ID %<%d%> out of range", fid), String();
+ int foff = Data::u16_aligned(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE + 4);
+ if (len < foff + FEATURE_HEADERSIZE)
+ return errh->error("OTF LookupList for feature ID %<%d%> too short", fid), String();
+ int poff = Data::u16_aligned(data + foff);
+ if (poff == 0)
+ return String();
+ if (!old_style_offset)
+ poff += foff;
+ if (len < poff + length)
+ return errh->error("OTF feature parameters for feature ID %<%d%> out of range", fid), String();
+ else
+ return _str.substring(poff, length);
+}
+
+String
+FeatureList::size_params(int fid, const Name &name, ErrorHandler *errh) const
+{
+ // implement 'size' checks from Read Roberts
+ for (int i = 0; i < 2; i++) {
+ String s = params(fid, 10, errh, i != 0);
+ const uint8_t *data = s.udata();
+ // errh->message("trying %d %d %d %d %d\n", Data::u16_aligned(data), Data::u16_aligned(data + 2), Data::u16_aligned(data + 4), Data::u16_aligned(data + 6), Data::u16_aligned(data + 8));
+ if (Data::u16_aligned(data) == 0) // design size == 0
+ continue;
+ if (Data::u16_aligned(data + 2) == 0 // subfamily ID == 0
+ && Data::u16_aligned(data + 6) == 0 // range start == 0
+ && Data::u16_aligned(data + 8) == 0 // range end == 0
+ && Data::u16_aligned(data + 4) == 0) // menu name ID == 0
+ return s;
+ if (Data::u16_aligned(data + 6) >= Data::u16_aligned(data + 8) // range start >= range end
+ || Data::u16_aligned(data + 4) < 256 // menu name ID < 256
+ || Data::u16_aligned(data + 4) > 32767 // menu name ID > 32767
+ || !name.english_name(Data::u16_aligned(data + 4))) // menu name ID is a name ID defined by the font
+ continue;
+ if (Data::u16_aligned(data) + 1 >= Data::u16_aligned(data + 6) // design size >= range start (with 1 dp grace)
+ && Data::u16_aligned(data) <= Data::u16_aligned(data + 8) + 1) // design size <= range end (with 1 dp grace)
+ return s;
+ else if (i == 1 // old-style feature
+ && Data::u16_aligned(data + 8) <= 1440 // range end <= 144 point
+ && Data::u16_aligned(data) <= 1440) { // design size <= 144 point
+ // some old fonts define a bogus feature with design size
+ // not in range (John Owens, Read Roberts)
+ if (errh)
+ errh->warning("invalid 'size' feature: design size not in range");
+ return s;
+ }
+ }
+ if (errh)
+ errh->error("no valid 'size' feature data in the 'size' feature");
+ return String();
+}
+
+int
+FeatureList::find(Tag tag, const Vector<int> &fids) const
+{
+ if (fids.size() == 0 || _str.length() == 0)
+ return -1;
+
+ const uint8_t *data = _str.udata();
+ int nfeatures = Data::u16_aligned(data);
+ for (const int *fidp = fids.begin(); fidp != fids.end(); fidp++)
+ if (*fidp >= 0 && *fidp < nfeatures) {
+ uint32_t ftag = Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + (*fidp)*FEATURE_RECSIZE);
+ if (ftag == tag.value())
+ return *fidp;
+ }
+
+ return -1;
+}
+
+void
+FeatureList::filter(Vector<int> &fids, const Vector<Tag> &sorted_ftags) const
+{
+ if (_str.length() == 0)
+ fids.clear();
+ else {
+ std::sort(fids.begin(), fids.end()); // sort fids
+
+ int i = 0, j = 0;
+ while (i < fids.size() && fids[i] < 0)
+ fids[i++] = 0x7FFFFFFF;
+
+ // XXX check that feature list is in alphabetical order
+
+ const uint8_t *data = _str.udata();
+ int nfeatures = Data::u16_aligned(data);
+ while (i < fids.size() && j < sorted_ftags.size() && fids[i] < nfeatures) {
+ uint32_t ftag = Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + fids[i]*FEATURE_RECSIZE);
+ if (ftag < sorted_ftags[j].value()) { // not an interesting feature
+ // replace featureID with a large number, remove later
+ fids[i] = 0x7FFFFFFF;
+ i++;
+ } else if (ftag == sorted_ftags[j].value()) // interesting feature
+ i++;
+ else // an interesting feature is not available
+ j++;
+ }
+
+ fids.resize(i); // remove remaining uninteresting features
+ std::sort(fids.begin(), fids.end()); // resort, to move bad ones last
+ while (fids.size() && fids.back() == 0x7FFFFFFF)
+ fids.pop_back();
+ }
+}
+
+int
+FeatureList::lookups(int fid, Vector<int> &results, ErrorHandler *errh, bool clear_results) const
+{
+ if (clear_results)
+ results.clear();
+ if (_str.length() == 0)
+ return -1;
+ if (errh == 0)
+ errh = ErrorHandler::silent_handler();
+
+ const uint8_t *data = _str.udata();
+ int len = _str.length();
+ int nfeatures = Data::u16_aligned(data);
+ if (fid < 0 || fid >= nfeatures)
+ return errh->error("OTF feature ID %<%d%> out of range", fid);
+ int foff = Data::u16_aligned(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE + 4);
+ int lookupCount;
+ if (len < foff + FEATURE_HEADERSIZE
+ || (lookupCount = Data::u16_aligned(data + foff + 2),
+ len < foff + FEATURE_HEADERSIZE + lookupCount*LOOKUPLIST_RECSIZE))
+ return errh->error("OTF LookupList for feature ID %<%d%> too short", fid);
+ const uint8_t *ldata = data + foff + FEATURE_HEADERSIZE;
+ for (int j = 0; j < lookupCount; j++, ldata += LOOKUPLIST_RECSIZE)
+ results.push_back(Data::u16_aligned(ldata));
+
+ return 0;
+}
+
+int
+FeatureList::lookups(const Vector<int> &fids, Vector<int> &results, ErrorHandler *errh) const
+{
+ results.clear();
+ if (_str.length() == 0)
+ return -1;
+
+ for (int i = 0; i < fids.size(); i++)
+ if (lookups(fids[i], results, errh, false) < 0)
+ return -1;
+
+ // sort results and remove duplicates
+ std::sort(results.begin(), results.end());
+ int *unique_result = std::unique(results.begin(), results.end());
+ results.resize(unique_result - results.begin());
+ return 0;
+}
+
+int
+FeatureList::lookups(const Vector<int> &required_fids, const Vector<int> &fids, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
+{
+ Vector<int> fidsx(fids);
+ filter(fidsx, sorted_ftags);
+ for (int i = 0; i < required_fids.size(); i++)
+ fidsx.push_back(required_fids[i]);
+ return lookups(fidsx, results, errh);
+}
+
+int
+FeatureList::lookups(int required_fid, const Vector<int> &fids, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
+{
+ Vector<int> fidsx(fids);
+ filter(fidsx, sorted_ftags);
+ if (required_fid >= 0)
+ fidsx.push_back(required_fid);
+ return lookups(fidsx, results, errh);
+}
+
+int
+FeatureList::lookups(const ScriptList &script_list, Tag script, Tag langsys, const Vector<Tag> &sorted_ftags, Vector<int> &results, ErrorHandler *errh) const
+{
+ int required_fid;
+ Vector<int> fids;
+ int result = script_list.features(script, langsys, required_fid, fids, errh);
+ if (result >= 0) {
+ filter(fids, sorted_ftags);
+ if (required_fid >= 0)
+ fids.push_back(required_fid);
+ result = lookups(fids, results, errh);
+ }
+ return result;
+}
+
+
+/**************************
+ * Coverage *
+ * *
+ **************************/
+
+Coverage::Coverage() throw ()
+{
+}
+
+Coverage::Coverage(Glyph first, Glyph last) throw ()
+{
+ if (first <= last) {
+ _str = String("\000\002\000\001\000\000\000\000\000\000", 10);
+ uint8_t *data = _str.mutable_udata();
+ data[4] = first >> 8;
+ data[5] = first & 255;
+ data[6] = last >> 8;
+ data[7] = last & 255;
+ _str.align(2);
+ }
+}
+
+Coverage::Coverage(const Vector<bool> &gmap) throw ()
+{
+ int end = gmap.size();
+ while (end > 0 && !gmap[end - 1])
+ --end;
+ if (end > 0) {
+ _str = String::make_uninitialized(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)
+{
+ _str.align(2);
+ if (do_check) {
+ if (check(errh ? errh : ErrorHandler::silent_handler()) < 0)
+ _str = String();
+ } else { // check()'s shorten-string side effect
+ const uint8_t *data = _str.udata();
+ int count = Data::u16_aligned(data + 2);
+ if (data[1] == T_LIST)
+ _str = _str.substring(0, HEADERSIZE + count*LIST_RECSIZE);
+ else
+ _str = _str.substring(0, HEADERSIZE + count*RANGES_RECSIZE);
+ }
+}
+
+int
+Coverage::check(ErrorHandler *errh)
+ // side effect: shorten string to cover coverage
+{
+ // HEADER FORMAT:
+ // USHORT coverageFormat
+ // USHORT glyphCount
+ const uint8_t *data = _str.udata();
+ if (_str.length() < HEADERSIZE)
+ return errh->error("OTF coverage table too small");
+ int coverageFormat = Data::u16_aligned(data);
+ int count = Data::u16_aligned(data + 2);
+
+ int len;
+ switch (coverageFormat) {
+ case T_LIST:
+ len = HEADERSIZE + count*LIST_RECSIZE;
+ if (_str.length() < len)
+ return errh->error("OTF coverage table too short (format 1)");
+ // XXX don't check sorting
+ break;
+ case T_RANGES:
+ len = HEADERSIZE + count*RANGES_RECSIZE;
+ if (_str.length() < len)
+ return errh->error("OTF coverage table too short (format 2)");
+ // XXX don't check sorting
+ // XXX don't check startCoverageIndexes
+ break;
+ default:
+ return errh->error("OTF coverage table has unknown format %d", coverageFormat);
+ }
+
+ _str = _str.substring(0, len);
+ return 0;
+}
+
+int
+Coverage::size() const throw ()
+{
+ if (_str.length() == 0)
+ return -1;
+ const uint8_t *data = _str.udata();
+ if (data[1] == T_LIST)
+ return (_str.length() - HEADERSIZE) / LIST_RECSIZE;
+ else if (data[1] == T_RANGES) {
+ data += _str.length() - RANGES_RECSIZE;
+ return Data::u16_aligned(data + 4) + Data::u16_aligned(data + 2) - Data::u16_aligned(data) + 1;
+ } else if (data[1] == T_X_BYTEMAP)
+ return Data::u32_aligned(data + 4);
+ else
+ return -1;
+}
+
+int
+Coverage::coverage_index(Glyph g) const throw ()
+{
+ if (_str.length() == 0)
+ return -1;
+
+ const uint8_t *data = _str.udata();
+ int count = Data::u16_aligned(data + 2);
+ if (data[1] == T_LIST) {
+ int l = 0, r = count;
+ data += HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ int mval = Data::u16_aligned(data + m * LIST_RECSIZE);
+ if (g < mval)
+ r = m;
+ else if (g == mval)
+ return m;
+ else
+ l = m + 1;
+ }
+ return -1;
+ } else if (data[1] == T_RANGES) {
+ int l = 0, r = count;
+ data += HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ const uint8_t *rec = data + m * RANGES_RECSIZE;
+ if (g < Data::u16_aligned(rec))
+ r = m;
+ else if (g <= Data::u16_aligned(rec + 2))
+ return Data::u16_aligned(rec + 4) + g - Data::u16_aligned(rec);
+ else
+ 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;
+}
+
+Glyph
+Coverage::operator[](int cindex) const throw ()
+{
+ if (_str.length() == 0 || cindex < 0)
+ return 0;
+
+ const uint8_t *data = _str.udata();
+ int count = Data::u16_aligned(data + 2);
+ if (data[1] == T_LIST)
+ return (cindex < count ? Data::u16_aligned(data + cindex * LIST_RECSIZE) : 0);
+ else if (data[1] == T_RANGES) {
+ int l = 0, r = count;
+ data += HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ const uint8_t *rec = data + m * RANGES_RECSIZE;
+ int start_cindex = Data::u16_aligned(rec + 4);
+ if (cindex < start_cindex)
+ r = m;
+ else if (cindex < start_cindex + Data::u16_aligned(rec + 2) - Data::u16_aligned(rec))
+ return Data::u16_aligned(rec) + cindex - start_cindex;
+ else
+ l = m + 1;
+ }
+ return 0;
+ } else
+ return 0;
+}
+
+void
+Coverage::unparse(StringAccum &sa) const throw ()
+{
+ const uint8_t *data = _str.udata();
+ if (_str.length() == 0)
+ sa << "@*#!";
+ else if (data[1] == T_LIST) {
+ int count = Data::u16_aligned(data + 2);
+ for (int i = 0; i < count; i++) {
+ if (i) sa << ',';
+ sa << Data::u16_aligned(data + HEADERSIZE + i*LIST_RECSIZE);
+ }
+ } else {
+ for (int pos = HEADERSIZE; pos < _str.length(); pos += RANGES_RECSIZE) {
+ Glyph start = Data::u16_aligned(data + pos);
+ Glyph end = Data::u16_aligned(data + pos + 2);
+ if (pos > HEADERSIZE) sa << ',';
+ sa << start;
+ if (end != start) sa << '.' << '.' << end;
+ }
+ }
+}
+
+String
+Coverage::unparse() const throw ()
+{
+ StringAccum sa;
+ unparse(sa);
+ return sa.take_string();
+}
+
+Coverage
+operator&(const Coverage &a, const Coverage &b)
+{
+ StringAccum sa;
+ sa << '\000' << '\001' << '\000' << '\000';
+
+ 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);
+ return Coverage(sa.take_string(), 0, false);
+}
+
+bool
+operator<=(const Coverage &a, const Coverage &b)
+{
+ Coverage::iterator ai = a.begin(), bi = b.begin();
+ while (ai && bi) {
+ if (*ai != *bi && !bi.forward_to(*ai))
+ return false;
+ ai++, bi++;
+ }
+ return bi || !ai;
+}
+
+
+/************************
+ * Coverage::iterator *
+ * *
+ ************************/
+
+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();
+ int n = Data::u16_aligned(data + 2);
+ switch (Data::u16_aligned(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 : Data::u16_aligned(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;
+ }
+}
+
+int
+Coverage::iterator::coverage_index() const
+{
+ const uint8_t *data = _str.udata();
+ assert(_pos < _str.length());
+ if (data[1] == T_LIST)
+ return (_pos - HEADERSIZE) / LIST_RECSIZE;
+ else if (data[1] == T_RANGES)
+ return Data::u16_aligned(data + _pos + 4) + _value - Data::u16_aligned(data + _pos);
+ else
+ return _pos - 8;
+}
+
+void
+Coverage::iterator::operator++(int)
+{
+ const uint8_t *data = _str.udata();
+ int len = _str.length();
+ if (_pos >= len
+ || (data[1] == T_RANGES && ++_value <= Data::u16_aligned(data + _pos + 2)))
+ return;
+ switch (data[1]) {
+ case T_LIST:
+ _pos += LIST_RECSIZE;
+ normal_pos_setting:
+ _value = _pos >= len ? 0 : Data::u16_aligned(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
+Coverage::iterator::forward_to(Glyph find)
+{
+ // XXX really should check that this works
+
+ if (find <= _value)
+ return find == _value;
+ else if (_pos >= _str.length())
+ return false;
+
+ const uint8_t *data = _str.udata();
+ if (data[1] == T_LIST) {
+ // check for "common" case: next element
+ _pos += LIST_RECSIZE;
+ if (_pos >= _str.length())
+ return false;
+ else if (find <= Data::u16_aligned(data + _pos)) {
+ _value = Data::u16_aligned(data + _pos);
+ return find == _value;
+ }
+
+ // otherwise, binary search over remaining area
+ int l = ((_pos - HEADERSIZE) / LIST_RECSIZE) + 1;
+ int r = (_str.length() - HEADERSIZE) / LIST_RECSIZE;
+ data += HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ Glyph g = Data::u16_aligned(data + m * LIST_RECSIZE);
+ if (find < g)
+ r = m;
+ else if (find == g)
+ l = r = m;
+ else
+ l = m + 1;
+ }
+ _pos = HEADERSIZE + l * LIST_RECSIZE;
+ _value = (_pos >= _str.length() ? 0 : Data::u16_aligned(data - HEADERSIZE + _pos));
+
+ } else if (data[1] == T_RANGES) {
+ // check for "common" case: this or next element
+ if (find <= Data::u16_aligned(data + _pos + 2)) {
+ assert(find >= Data::u16_aligned(data + _pos));
+ _value = find;
+ return true;
+ }
+ _pos += RANGES_RECSIZE;
+ if (_pos >= _str.length())
+ return false;
+ else if (find <= Data::u16_aligned(data + _pos + 2)) {
+ _value = (find >= Data::u16_aligned(data + _pos) ? find : Data::u16_aligned(data + _pos));
+ return find == _value;
+ }
+
+ // otherwise, binary search over remaining area
+ int l = ((_pos - HEADERSIZE) / RANGES_RECSIZE) + 1;
+ int r = (_str.length() - HEADERSIZE) / RANGES_RECSIZE;
+ data += HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ if (find < Data::u16_aligned(data + m * RANGES_RECSIZE))
+ r = m;
+ else if (find <= Data::u16_aligned(data + m * RANGES_RECSIZE + 2)) {
+ _pos = HEADERSIZE + m * RANGES_RECSIZE;
+ _value = find;
+ return true;
+ } else
+ l = m + 1;
+ }
+ _pos = HEADERSIZE + l * LIST_RECSIZE;
+ _value = (_pos >= _str.length() ? 0 : Data::u16_aligned(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;
+}
+
+
+/**************************
+ * GlyphSet *
+ * *
+ **************************/
+
+GlyphSet::GlyphSet()
+{
+ memset(_v, 0, sizeof(_v));
+}
+
+GlyphSet::GlyphSet(const GlyphSet &o)
+{
+ for (int i = 0; i < VLEN; i++)
+ if (o._v[i]) {
+ _v[i] = new uint32_t[VULEN];
+ memcpy(_v[i], o._v[i], sizeof(uint32_t) * VULEN);
+ } else
+ _v[i] = 0;
+}
+
+GlyphSet::~GlyphSet()
+{
+ for (int i = 0; i < VLEN; i++)
+ delete[] _v[i];
+}
+
+int
+GlyphSet::change(Glyph g, bool value)
+{
+ if ((unsigned)g > MAXGLYPH)
+ return -1;
+ uint32_t *&u = _v[g >> SHIFT];
+ if (!u) {
+ u = new uint32_t[VULEN];
+ memset(u, 0, sizeof(uint32_t) * VULEN);
+ }
+ uint32_t mask = (1 << (g & 0x1F));
+ if (value)
+ u[(g & MASK) >> 5] |= mask;
+ else
+ u[(g & MASK) >> 5] &= ~mask;
+ return 0;
+}
+
+GlyphSet &
+GlyphSet::operator=(const GlyphSet &o)
+{
+ if (&o != this) {
+ for (int i = 0; i < VLEN; i++)
+ if (o._v[i]) {
+ if (!_v[i])
+ _v[i] = new uint32_t[VULEN];
+ memcpy(_v[i], o._v[i], sizeof(uint32_t) * VULEN);
+ } else if (_v[i])
+ memset(_v[i], 0, sizeof(uint32_t) * VULEN);
+ }
+ return *this;
+}
+
+
+/**************************
+ * ClassDef *
+ * *
+ **************************/
+
+ClassDef::ClassDef(const String &str, ErrorHandler *errh) throw ()
+ : _str(str)
+{
+ _str.align(2);
+ if (check(errh ? errh : ErrorHandler::silent_handler()) < 0)
+ _str = String();
+}
+
+int
+ClassDef::check(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // USHORT coverageFormat
+ // USHORT glyphCount
+ const uint8_t *data = _str.udata();
+ if (_str.length() < 6) // NB: prevents empty format-2 tables
+ return errh->error("OTF class def table too small");
+ int classFormat = Data::u16_aligned(data);
+
+ int len;
+ if (classFormat == T_LIST) {
+ int count = Data::u16_aligned(data + 4);
+ len = LIST_HEADERSIZE + count*LIST_RECSIZE;
+ // XXX don't check sorting
+ } else if (classFormat == T_RANGES) {
+ int count = Data::u16_aligned(data + 2);
+ len = RANGES_HEADERSIZE + count*RANGES_RECSIZE;
+ // XXX don't check sorting
+ } else
+ return errh->error("OTF class def table has unknown format %d", classFormat);
+
+ if (len > _str.length())
+ return errh->error("OTF class def table too short");
+ else {
+ _str = _str.substring(0, len);
+ return 0;
+ }
+}
+
+int
+ClassDef::lookup(Glyph g) const throw ()
+{
+ if (_str.length() == 0)
+ return -1;
+
+ const uint8_t *data = _str.udata();
+ int coverageFormat = Data::u16_aligned(data);
+
+ if (coverageFormat == T_LIST) {
+ Glyph start = Data::u16_aligned(data + 2);
+ int count = Data::u16_aligned(data + 4);
+ if (g < start || g >= start + count)
+ return 0;
+ else
+ return Data::u16_aligned(data + LIST_HEADERSIZE + (g - start) * LIST_RECSIZE);
+ } else if (coverageFormat == T_RANGES) {
+ int l = 0, r = Data::u16_aligned(data + 2);
+ data += RANGES_HEADERSIZE;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ const uint8_t *rec = data + m * RANGES_RECSIZE;
+ if (g < Data::u16_aligned(rec))
+ r = m;
+ else if (g <= Data::u16_aligned(rec + 2))
+ return Data::u16_aligned(rec + 4);
+ else
+ l = m + 1;
+ }
+ return 0;
+ } else
+ return 0;
+}
+
+void
+ClassDef::unparse(StringAccum &sa) const throw ()
+{
+ const uint8_t *data = _str.udata();
+ if (_str.length() == 0)
+ sa << "@*#!";
+ else if (data[1] == T_LIST) {
+ Glyph start = Data::u16_aligned(data + 2);
+ int count = Data::u16_aligned(data + 4);
+ for (int i = 0; i < count; i++) {
+ if (i) sa << ',';
+ sa << start + i << '=' << Data::u16_aligned(data + LIST_HEADERSIZE + i*LIST_RECSIZE);
+ }
+ } else {
+ for (int pos = RANGES_HEADERSIZE; pos < _str.length(); pos += RANGES_RECSIZE) {
+ Glyph start = Data::u16_aligned(data + pos);
+ Glyph end = Data::u16_aligned(data + pos + 2);
+ if (pos > RANGES_HEADERSIZE) sa << ',';
+ sa << start;
+ if (end != start) sa << '.' << '.' << end;
+ sa << '=' << Data::u16_aligned(data + pos + 4);
+ }
+ }
+}
+
+String
+ClassDef::unparse() const throw ()
+{
+ StringAccum sa;
+ unparse(sa);
+ return sa.take_string();
+}
+
+
+/******************************
+ * ClassDef::class_iterator *
+ * *
+ ******************************/
+
+ClassDef::class_iterator::class_iterator(const String &str, int pos, int the_class, const Coverage::iterator &coviter)
+ : _str(str), _pos(pos), _class(the_class), _coviter(coviter)
+{
+ // XXX assume _str has been checked
+
+ // cannot handle the_class == 0 when coviter doesn't exist
+ if (_class == 0 && !_coviter)
+ throw Error("cannot iterate over ClassDef class 0");
+
+ // shrink _str to fit the coverage table, and create a fake coverage
+ // iterator if necessary
+ const uint8_t *data = _str.udata();
+ if (_str.length()) {
+ switch (Data::u16_aligned(data)) {
+ case T_LIST: {
+ Glyph start = Data::u16_aligned(data + 2);
+ int nglyphs = Data::u16_aligned(data + 4);
+ _str = _str.substring(0, LIST_HEADERSIZE + nglyphs*LIST_RECSIZE);
+ if (!_coviter)
+ _coviter = Coverage(start, start + nglyphs - 1).begin();
+ if (_class)
+ _coviter.forward_to(start);
+ break;
+ }
+ case T_RANGES: {
+ Glyph start = Data::u16_aligned(data + RANGES_HEADERSIZE);
+ int nranges = Data::u16_aligned(data + 2);
+ _str = _str.substring(0, RANGES_HEADERSIZE + nranges*RANGES_RECSIZE);
+ if (!_coviter) {
+ Glyph end = Data::u16_aligned(data + RANGES_HEADERSIZE + 2 + (nranges - 1)*RANGES_RECSIZE);
+ _coviter = Coverage(start, end).begin();
+ }
+ if (_class)
+ _coviter.forward_to(start);
+ break;
+ }
+ default:
+ _str = String();
+ break;
+ }
+ }
+
+ // move to the first relevant glyph
+ if (_pos >= _str.length())
+ _pos = _str.length();
+ else {
+ _pos = 0;
+ (*this)++;
+ }
+}
+
+void
+ClassDef::class_iterator::increment_class0()
+{
+ const uint8_t *data = _str.udata();
+ int len = _str.length();
+ bool is_list = (data[1] == T_LIST);
+
+ if (_pos != 0)
+ _coviter++;
+ else
+ _pos = FIRST_POS;
+
+ if (_pos == FIRST_POS && _coviter) {
+ if (*_coviter < Data::u16_aligned(data + (is_list ? 2 : RANGES_HEADERSIZE)))
+ return;
+ _pos = (is_list ? LIST_HEADERSIZE : RANGES_HEADERSIZE);
+ }
+
+ while (_pos > 0 && _pos < len && _coviter) {
+ Glyph g = *_coviter;
+ if (is_list) {
+ _pos = LIST_HEADERSIZE + LIST_RECSIZE*(g - Data::u16_aligned(data + 2));
+ if (_pos >= len)
+ break;
+ else if (Data::u16_aligned(data + _pos) == 0) // _class == 0
+ return;
+ _coviter++;
+ } else {
+ if (g < Data::u16_aligned(data + _pos)) // in a zero range
+ return;
+ else if (g > Data::u16_aligned(data + _pos + 2))
+ _pos += RANGES_RECSIZE;
+ else if (Data::u16_aligned(data + _pos + 4) == 0) // _class == 0
+ return;
+ else
+ _coviter.forward_to(Data::u16_aligned(data + _pos + 2) + 1);
+ }
+ }
+
+ if (_coviter)
+ _pos = LAST_POS;
+ else
+ _pos = len;
+}
+
+void
+ClassDef::class_iterator::operator++(int)
+{
+ if (_class == 0) {
+ increment_class0();
+ return;
+ }
+
+ const uint8_t *data = _str.udata();
+ int len = _str.length();
+ bool is_list = (data[1] == T_LIST);
+
+ if (_pos != 0)
+ _coviter++;
+ else
+ _pos = (is_list ? LIST_HEADERSIZE : RANGES_HEADERSIZE);
+
+ while (_pos < len && _coviter) {
+ Glyph g = *_coviter;
+ if (is_list) {
+ _pos = LIST_HEADERSIZE + LIST_RECSIZE*(g - Data::u16_aligned(data + 2));
+ if (_pos >= len || Data::u16_aligned(data + _pos) == _class)
+ return;
+ _coviter++;
+ } else {
+ while (_pos < len && (g > Data::u16_aligned(data + _pos + 2)
+ || Data::u16_aligned(data + _pos + 4) != _class))
+ _pos += RANGES_RECSIZE;
+ // now, _pos >= len, or g <= rec.end && class == rec.class
+ if (_pos >= len || g >= Data::u16_aligned(data + _pos))
+ return;
+ _coviter.forward_to(Data::u16_aligned(data + _pos));
+ }
+ }
+
+ _pos = len;
+}
+
+
+}}
+
+
+// template instantiations
+#include <lcdf/vector.cc>
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfcmap.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfcmap.cc
new file mode 100644
index 00000000000..6626ecb2d2b
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfcmap.cc
@@ -0,0 +1,457 @@
+// -*- related-file-name: "../include/efont/otfcmap.hh" -*-
+
+/* otfcmap.{cc,hh} -- OpenType cmap table
+ *
+ * Copyright (c) 2002-2012 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/otfcmap.hh>
+#include <lcdf/error.hh>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <efont/otfdata.hh> // for ntohl()
+
+#define USHORT_AT(d) (Data::u16_aligned(d))
+#define SHORT_AT(d) (Data::s16_aligned(d))
+#define ULONG_AT(d) (Data::u32_aligned(d))
+
+namespace Efont { namespace OpenType {
+
+Cmap::Cmap(const String &s, ErrorHandler *errh)
+ : _str(s)
+{
+ _str.align(4);
+ _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
+}
+
+int
+Cmap::parse_header(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // USHORT version
+ // USHORT numTables
+ int len = _str.length();
+ const uint8_t *data = _str.udata();
+ if (HEADER_SIZE > len)
+ return errh->error("OTF cmap too small"), -EFAULT;
+ if (!(data[0] == '\000' && data[1] == '\000'))
+ return errh->error("bad cmap version number"), -ERANGE;
+ _ntables = USHORT_AT(data + 2);
+ if (_ntables == 0)
+ return errh->error("OTF cmap contains no tables"), -EINVAL;
+ if (HEADER_SIZE + ENCODING_SIZE * _ntables > len)
+ return errh->error("cmap directory out of range"), -EFAULT;
+
+ // ENCODING ENTRY FORMAT:
+ // USHORT platformID
+ // USHORT encodingID
+ // ULONG offset
+ int last_platform = -1;
+ int last_encoding = -1;
+ int last_language = -1;
+ _first_unicode_table = -1;
+ for (int i = 0; i < _ntables; i++) {
+ int loc = HEADER_SIZE + ENCODING_SIZE * i;
+ int platform = USHORT_AT(data + loc);
+ int encoding = USHORT_AT(data + loc + 2);
+ uint32_t offset = ULONG_AT(data + loc + 4);
+ if (offset + 8 > (uint32_t) len) {
+ length_error:
+ return errh->error("encoding data for entry %d out of range", i);
+ }
+ int format = USHORT_AT(data + offset);
+ int language;
+ if (format == F_BYTE || format == F_HIBYTE || format == F_SEGMENTED
+ || format == F_TRIMMED) {
+ if (USHORT_AT(data + offset + 2) < 6)
+ goto length_error;
+ language = USHORT_AT(data + offset + 4);
+ } else if (format == F_HIBYTE32 || format == F_TRIMMED32
+ || format == F_SEGMENTED32) {
+ if (offset + 12 > (uint32_t) len || ULONG_AT(data + offset + 4) < 12)
+ goto length_error;
+ language = ULONG_AT(data + offset + 8);
+ } else
+ continue;
+ if (!(platform > last_platform
+ || (platform == last_platform
+ && (encoding > last_encoding
+ || (encoding == last_encoding
+ && language > last_language)))))
+ return errh->error("subtables out of order at entry %d", i);
+ if ((platform == 0 || (platform == 3 && encoding == 1))
+ && _first_unicode_table < 0)
+ _first_unicode_table = i;
+ last_platform = platform, last_encoding = encoding, last_language = language;
+ }
+
+ _table_error.assign(_ntables, -2);
+ return 0;
+}
+
+int
+Cmap::first_table(int platform, int encoding) const
+{
+ if (error() < 0)
+ return -1;
+ const uint8_t *data = _str.udata();
+ data += HEADER_SIZE;
+ for (int i = 0; i < _ntables; i++, data += ENCODING_SIZE) {
+ int p = USHORT_AT(data), e = USHORT_AT(data + 2);
+ if (platform == p && (encoding < 0 || encoding == e))
+ return i;
+ }
+ return -1;
+}
+
+int
+Cmap::check_table(int t, ErrorHandler *errh) const
+{
+ if (!errh)
+ errh = ErrorHandler::silent_handler();
+ if (t == USE_FIRST_UNICODE_TABLE && _first_unicode_table == -1) {
+ errh->warning("font appears not to support Unicode");
+ _first_unicode_table = 0;
+ }
+ if (t == USE_FIRST_UNICODE_TABLE)
+ t = _first_unicode_table;
+ if (_error < 0 || t < 0 || t >= _ntables)
+ return errh->error("no such table");
+ if (_table_error[t] != -2)
+ return _table_error[t];
+ _table_error[t] = -1;
+
+ const uint8_t *data = table_data(t);
+ uint32_t left = _str.uend() - data;
+ int format = USHORT_AT(data);
+ uint32_t length = 0; // value not used
+
+ switch (format) {
+
+ case F_BYTE:
+ if (left < 4
+ || (length = USHORT_AT(data + 2)) > left
+ || length != 259)
+ return errh->error("bad table %d length (format %d)", t, format);
+ break;
+
+ case F_HIBYTE:
+ if (left < 4
+ || (length = USHORT_AT(data + 2)) > left
+ || length < 524)
+ return errh->error("bad table %d length (format %d)", t, format);
+ for (int hi_byte = 0; hi_byte < 256; hi_byte++)
+ if (uint32_t subh_key = USHORT_AT(data + 6 + 2 * hi_byte)) {
+ if ((subh_key & 7) || HIBYTE_SUBHEADERS + subh_key + 8 > length)
+ return errh->error("bad table %d subheader %d offset (format 2)", t, hi_byte);
+ const uint8_t *subh = data + HIBYTE_SUBHEADERS + subh_key;
+ int firstCode = USHORT_AT(subh);
+ int entryCount = USHORT_AT(subh + 2);
+ int idRangeOffset = USHORT_AT(subh + 6);
+ if (firstCode + entryCount > 256 || entryCount == 0)
+ return errh->error("bad table %d subheader %d contents (format 2)", t, hi_byte);
+ if ((HIBYTE_SUBHEADERS + subh_key + 6) // pos[idRangeOffset]
+ + idRangeOffset + entryCount * 2 > length)
+ return errh->error("bad table %d subheader %d length (format 2)", t, hi_byte);
+ }
+ break;
+
+ case F_SEGMENTED: {
+ if (left < 4
+ || (length = USHORT_AT(data + 2)) > left
+ || length < 16)
+ return errh->error("bad table %d length (format %d)", t, format);
+ int segCountX2 = USHORT_AT(data + 6);
+ int searchRange = USHORT_AT(data + 8);
+ int entrySelector = USHORT_AT(data + 10);
+ int rangeShift = USHORT_AT(data + 12);
+ if ((segCountX2 & 1)
+ || segCountX2 == 0
+ || (searchRange & (searchRange - 1)) /* not a power of 2? */
+ || searchRange <= segCountX2/2
+ || (searchRange>>1) > segCountX2/2
+ || 1 << (entrySelector + 1) != searchRange
+ || rangeShift != segCountX2 - searchRange)
+ return errh->error("bad table %d segment counts (format 4)", t);
+ uint32_t segCount = segCountX2 >> 1;
+ if (length < 16 + 8 * segCount)
+ return errh->error("bad table %d length (format %d)", t, format);
+ const uint8_t *endCodes = data + 14;
+ const uint8_t *startCodes = endCodes + 2 + segCountX2;
+ const uint8_t *idDeltas = startCodes + segCountX2;
+ const uint8_t *idRangeOffsets = idDeltas + segCountX2;
+ int last_end = 0;
+ for (int i = 0; i < segCountX2; i += 2) {
+ int endCode = USHORT_AT(endCodes + i);
+ int startCode = USHORT_AT(startCodes + i);
+ /* int idDelta = SHORT_AT(idDeltas + i); // no need to check */
+ int idRangeOffset = USHORT_AT(idRangeOffsets + i);
+ if (endCode < startCode || startCode < last_end)
+ return errh->error("bad table %d overlapping range %d (format %d)", t, i/2, format);
+ if (idRangeOffset
+ && idRangeOffsets + i + idRangeOffset + (endCode - startCode)*2 + 2 > data + length)
+ return errh->error("bad table %d range %d length (format 4)", t, i/2);
+ last_end = endCode + 1;
+ }
+ if (USHORT_AT(endCodes + segCountX2 - 2) != 0xFFFF)
+ return errh->error("bad table %d incorrect final endCode (format 4)", t);
+ break;
+ }
+
+ case F_TRIMMED: {
+ if (left < 4
+ || (length = USHORT_AT(data + 2)) > left
+ || length < 10)
+ return errh->error("bad table %d length (format %d)", t, format);
+ uint32_t entryCount = USHORT_AT(data + 8);
+ if (10 + entryCount * 2 > length)
+ return errh->error("bad table %d length (format %d)", t, format);
+ break;
+ }
+
+ case F_SEGMENTED32: {
+ if (left < 8
+ || (length = ULONG_AT(data + 4)) > left
+ || length < 16)
+ return errh->error("bad table %d length (format %d)", t, format);
+ uint32_t nGroups = ULONG_AT(data + 16);
+ if ((length - 16) / 12 < nGroups)
+ return errh->error("bad table %d length (format %d)", t, format);
+ uint32_t last_post_end = 0;
+ data += 16;
+ for (uint32_t i = 0; i < nGroups; i++, data += 12) {
+ uint32_t startCharCode = ULONG_AT(data);
+ uint32_t endCharCode = ULONG_AT(data + 4);
+ if (startCharCode < last_post_end || endCharCode < startCharCode)
+ return errh->error("bad table %d overlapping range %d (format %d)", t, i, format);
+ last_post_end = endCharCode + 1;
+ }
+ break;
+ }
+
+ case F_HIBYTE32:
+ case F_TRIMMED32:
+ default:
+ return errh->error("bad table %d unsupported format %d", t, format);
+
+ }
+
+ _table_error[t] = t;
+ return t;
+}
+
+Glyph
+Cmap::map_table(int t, uint32_t uni, ErrorHandler *errh) const
+{
+ if ((t = check_table(t, errh)) < 0)
+ return 0;
+
+ const uint8_t *data = table_data(t);
+ switch (USHORT_AT(data)) {
+
+ case F_BYTE:
+ if (uni < 256)
+ return data[6 + uni];
+ else
+ return 0;
+
+ case F_HIBYTE: {
+ if (uni >= 65536)
+ return 0;
+ int hi_byte = (uni >> 8) & 255;
+ int subh = USHORT_AT(data + 6 + hi_byte * 2);
+ if (subh == 0 && hi_byte) // XXX?
+ return 0;
+ data += 524 + subh;
+ int firstCode = USHORT_AT(data);
+ int entryCount = USHORT_AT(data + 2);
+ int idDelta = SHORT_AT(data + 4);
+ int idRangeOffset = USHORT_AT(data + 6);
+ int lo_byte = uni & 255;
+ if (lo_byte < firstCode || lo_byte >= firstCode + entryCount)
+ return 0;
+ int answer = USHORT_AT(data + 6 + idRangeOffset + (lo_byte - firstCode) * 2);
+ if (answer == 0)
+ return 0;
+ return (answer + idDelta) & 65535;
+ }
+
+ case F_SEGMENTED: {
+ if (uni >= 65536)
+ return 0;
+ int segCount = USHORT_AT(data + 6) >> 1;
+ const uint8_t *endCounts = data + 14;
+ const uint8_t *startCounts = endCounts + (segCount << 1) + 2;
+ const uint8_t *idDeltas = startCounts + (segCount << 1);
+ const uint8_t *idRangeOffsets = idDeltas + (segCount << 1);
+ int l = 0, r = segCount;
+ while (l < r) {
+ int m = l + (r - l) / 2;
+ uint32_t endCount = USHORT_AT(endCounts + (m << 1));
+ uint32_t startCount = USHORT_AT(startCounts + (m << 1));
+ if (uni < startCount)
+ r = m;
+ else if (uni <= endCount) {
+ int idDelta = SHORT_AT(idDeltas + (m << 1));
+ int idRangeOffset = USHORT_AT(idRangeOffsets + (m << 1));
+ if (idRangeOffset == 0)
+ return (idDelta + uni) & 65535;
+ int g = USHORT_AT(idRangeOffsets + (m << 1) + idRangeOffset + ((uni - startCount) << 1));
+ if (g == 0)
+ return 0;
+ return (idDelta + g) & 65535;
+ } else
+ l = m + 1;
+ }
+ return 0;
+ }
+
+ case F_TRIMMED: {
+ uint32_t firstCode = USHORT_AT(data + 6);
+ uint32_t entryCount = USHORT_AT(data + 8);
+ if (uni < firstCode || uni >= firstCode + entryCount)
+ return 0;
+ return USHORT_AT(data + 10 + ((uni - firstCode) << 1));
+ }
+
+ case F_SEGMENTED32: {
+ uint32_t nGroups = ULONG_AT(data + 12);
+ uint32_t l = 0, r = nGroups;
+ const uint8_t *groups = data + 16;
+ while (l < r) {
+ uint32_t m = l + (r - l) / 2;
+ uint32_t startCharCode = ULONG_AT(groups + m * 12);
+ uint32_t endCharCode = ULONG_AT(groups + m * 12 + 4);
+ if (uni < startCharCode)
+ r = m;
+ else if (uni <= endCharCode)
+ return ULONG_AT(groups + m * 12 + 8) + uni - startCharCode;
+ else
+ l = m + 1;
+ }
+ return 0;
+ }
+
+ default:
+ return 0;
+
+ }
+}
+
+void
+Cmap::dump_table(int t, Vector<std::pair<uint32_t, Glyph> > &ugp, ErrorHandler *errh) const
+{
+ if ((t = check_table(t, errh)) < 0)
+ return;
+
+ const uint8_t *data = table_data(t);
+ switch (USHORT_AT(data)) {
+
+ case F_BYTE:
+ for (uint32_t u = 0; u < 256; ++u)
+ if (int g = data[6 + u])
+ ugp.push_back(std::make_pair(u, g));
+ break;
+
+ case F_HIBYTE:
+ assert(USHORT_AT(data + 6) == 0);
+ for (int hi_byte = 0; hi_byte < 256; hi_byte++) {
+ int subh = USHORT_AT(data + 6 + hi_byte * 4);
+ if (subh == 0 && hi_byte > 0)
+ continue;
+ const uint8_t *tdata = data + 524 + subh;
+ int firstCode = USHORT_AT(tdata);
+ int entryCount = USHORT_AT(tdata + 2);
+ int idDelta = SHORT_AT(tdata + 4);
+ int idRangeOffset = USHORT_AT(tdata + 6);
+ const uint8_t *gdata = tdata + 6 + idRangeOffset;
+ for (int i = 0; i < entryCount; i++)
+ if (Glyph g = USHORT_AT(gdata + (i << 1))) {
+ g = (idDelta + g) & 65535;
+ uint32_t u = (hi_byte << 8) + firstCode + i;
+ ugp.push_back(std::make_pair(u, g));
+ }
+ }
+ break;
+
+ case F_SEGMENTED: {
+ int segCountX2 = USHORT_AT(data + 6);
+ const uint8_t *endCounts = data + 14;
+ const uint8_t *startCounts = endCounts + segCountX2 + 2;
+ const uint8_t *idDeltas = startCounts + segCountX2;
+ const uint8_t *idRangeOffsets = idDeltas + segCountX2;
+ for (int i = 0; i < segCountX2; i += 2) {
+ uint32_t endCount = USHORT_AT(endCounts + i);
+ uint32_t startCount = USHORT_AT(startCounts + i);
+ int idDelta = SHORT_AT(idDeltas + i);
+ int idRangeOffset = USHORT_AT(idRangeOffsets + i);
+ if (idRangeOffset == 0) {
+ for (uint32_t u = startCount; u <= endCount; ++u) {
+ Glyph g = (u + idDelta) & 65535;
+ ugp.push_back(std::make_pair(u, g));
+ }
+ } else {
+ const uint8_t *gdata = idRangeOffsets + i + idRangeOffset;
+ for (uint32_t u = startCount; u <= endCount; ++u, gdata += 2)
+ if (Glyph g = USHORT_AT(gdata)) {
+ g = (g + idDelta) & 65535;
+ ugp.push_back(std::make_pair(u, g));
+ }
+ }
+ }
+ break;
+ }
+
+ case F_TRIMMED: {
+ uint32_t firstCode = USHORT_AT(data + 6);
+ int entryCount = USHORT_AT(data + 8);
+ for (int i = 0; i < entryCount; i++)
+ if (Glyph g = USHORT_AT(data + 10 + (i << 1)))
+ ugp.push_back(std::make_pair(firstCode + i, g));
+ break;
+ }
+
+ case F_SEGMENTED32: {
+ uint32_t nGroups = ULONG_AT(data + 12);
+ const uint8_t *groups = data + 16;
+ for (uint32_t i = 0; i < nGroups; i++, groups += 12) {
+ uint32_t startCharCode = ULONG_AT(groups);
+ uint32_t nCharCodes = ULONG_AT(groups + 4) - startCharCode;
+ Glyph startGlyphID = ULONG_AT(groups + 8);
+ for (uint32_t i = 0; i <= nCharCodes; i++)
+ ugp.push_back(std::make_pair(startCharCode + i, startGlyphID + i));
+ }
+ break;
+ }
+
+ default:
+ break;
+
+ }
+}
+
+int
+Cmap::map_uni(const Vector<uint32_t> &vin, Vector<Glyph> &vout) const
+{
+ int t;
+ if ((t = check_table(USE_FIRST_UNICODE_TABLE)) < 0)
+ return -1;
+ vout.resize(vin.size(), 0);
+ for (int i = 0; i < vin.size(); i++)
+ vout[i] = map_table(t, vin[i]);
+ return 0;
+}
+
+}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdata.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdata.cc
index dce769156f9..4ad6d8aade4 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdata.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdata.cc
@@ -24,7 +24,7 @@ Data
Data::subtable(unsigned offset) const throw (Bounds)
{
if (offset > (unsigned) _str.length())
- throw Bounds();
+ throw Bounds();
return Data(_str.substring(offset));
}
@@ -33,7 +33,7 @@ Data::offset_subtable(unsigned offset_offset) const throw (Bounds)
{
int offset = u16(offset_offset);
if (offset > _str.length())
- throw Bounds();
+ throw Bounds();
return Data(_str.substring(offset));
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdescrip.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdescrip.cc
index 307f0b3cb61..c85ab6e69ba 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfdescrip.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfdescrip.cc
@@ -209,7 +209,7 @@ static const Mapping languages[] = {
{ T("DCR "), "Woods Cree" },
{ T("DEU "), "German" },
{ T("DGR "), "Dogri" },
- { T("DHV "), "Dhivehi" }, // deprecated
+ { T("DHV "), "Dhivehi" }, // deprecated
{ T("DIV "), "Dhivehi" },
{ T("DJR "), "Djerma" },
{ T("DNG "), "Dangme" },
@@ -503,7 +503,7 @@ static const Mapping languages[] = {
{ T("TSG "), "Tsonga" },
{ T("TUA "), "Turoyo Aramaic" },
{ T("TUL "), "Tulu" },
- { T("TUR "), "Turkish" }, // deprecated?
+ { T("TUR "), "Turkish" }, // deprecated?
{ T("TUV "), "Tuvin" },
{ T("TWI "), "Twi" },
{ T("UDM "), "Udmurt" },
@@ -685,13 +685,13 @@ find_description(uint32_t tag, const Mapping *maps, int n)
// should use STL...
int l = 0, r = n;
while (l < r) {
- int m = l + (r - l) / 2;
- if (maps[m].tag < tag)
- l = m + 1;
- else if (maps[m].tag == tag)
- return maps[m].description;
- else
- r = m;
+ int m = l + (r - l) / 2;
+ if (maps[m].tag < tag)
+ l = m + 1;
+ else if (maps[m].tag == tag)
+ return maps[m].description;
+ else
+ r = m;
}
return 0;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgpos.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgpos.cc
new file mode 100644
index 00000000000..4e95d6d0fbc
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgpos.cc
@@ -0,0 +1,328 @@
+// -*- related-file-name: "../include/efont/otfgpos.hh" -*-
+
+/* otfgpos.{cc,hh} -- OpenType GPOS table
+ *
+ * Copyright (c) 2003-2012 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/otfgpos.hh>
+#include <lcdf/error.hh>
+#include <lcdf/straccum.hh>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <algorithm>
+
+namespace Efont { namespace OpenType {
+
+
+/**************************
+ * Gpos *
+ * *
+ **************************/
+
+Gpos::Gpos(const Data &d, ErrorHandler *errh) throw (Error)
+{
+ // Fixed Version
+ // Offset ScriptList
+ // Offset FeatureList
+ // Offset LookupList
+ if (d.length() == 0)
+ throw BlankTable("GPOS");
+ if (d.u16(0) != 1)
+ throw Format("GPOS");
+ if (_script_list.assign(d.offset_subtable(4), errh) < 0)
+ throw Format("GPOS script list");
+ if (_feature_list.assign(d.offset_subtable(6), errh) < 0)
+ throw Format("GPOS feature list");
+ _lookup_list = d.offset_subtable(8);
+}
+
+int
+Gpos::nlookups() const
+{
+ return _lookup_list.u16(0);
+}
+
+GposLookup
+Gpos::lookup(unsigned i) const
+{
+ if (i >= _lookup_list.u16(0))
+ throw Error("GPOS lookup out of range");
+ else
+ return GposLookup(_lookup_list.offset_subtable(2 + i*2));
+}
+
+
+/**************************
+ * GposValue *
+ * *
+ **************************/
+
+const int GposValue::nibble_bitcount_x2[] = { 0, 2, 2, 4, 2, 4, 4, 6,
+ 2, 4, 4, 6, 4, 6, 6, 8 };
+
+
+/**************************
+ * GposLookup *
+ * *
+ **************************/
+
+GposLookup::GposLookup(const Data &d) throw (Error)
+ : _d(d)
+{
+ if (_d.length() < 6)
+ throw Format("GPOS Lookup table");
+ _type = _d.u16(0);
+ if (_type == L_EXTENSION && _d.u16(4) != 0) {
+ Data first_subtable = _d.offset_subtable(HEADERSIZE);
+ if (first_subtable.length() < 8 || first_subtable.u16(0) != 1)
+ throw Format("GPOS Extension Lookup table");
+ _type = first_subtable.u16(2);
+ }
+}
+
+Data
+GposLookup::subtable(int i) const
+{
+ Data subd = _d.offset_subtable(HEADERSIZE + i*RECSIZE);
+ if (_d.u16(0) != L_EXTENSION)
+ return subd;
+ else if (subd.length() >= 8 && subd.u16(0) == 1 && subd.u16(2) == _type)
+ return subd.subtable(subd.u32(4));
+ else
+ return Data();
+}
+
+bool
+GposLookup::unparse_automatics(Vector<Positioning> &v, ErrorHandler *errh) const
+{
+ int nlookup = _d.u16(4), success = 0;
+ switch (_type) {
+ case L_SINGLE:
+ for (int i = 0; i < nlookup; i++)
+ try {
+ GposSingle s(subtable(i));
+ s.unparse(v);
+ success++;
+ } catch (Error e) {
+ if (errh)
+ errh->warning("%s, continuing", e.description.c_str());
+ }
+ return success > 0;
+ case L_PAIR:
+ for (int i = 0; i < nlookup; i++)
+ try {
+ GposPair p(subtable(i));
+ p.unparse(v);
+ success++;
+ } catch (Error e) {
+ if (errh)
+ errh->warning("%s, continuing", e.description.c_str());
+ }
+ return success > 0;
+ default:
+ return false;
+ }
+}
+
+
+/**************************
+ * GposSingle *
+ * *
+ **************************/
+
+GposSingle::GposSingle(const Data &d) throw (Error)
+ : _d(d)
+{
+ if (_d[0] != 0
+ || (_d[1] != 1 && _d[1] != 2))
+ throw Format("GPOS Single Positioning");
+ Coverage coverage(_d.offset_subtable(2));
+ if (!coverage.ok()
+ || (_d[1] == 2 && coverage.size() > _d.u16(6)))
+ throw Format("GPOS Single Positioning coverage");
+}
+
+Coverage
+GposSingle::coverage() const throw ()
+{
+ return Coverage(_d.offset_subtable(2), 0, false);
+}
+
+void
+GposSingle::unparse(Vector<Positioning> &v) const
+{
+ if (_d[1] == 1) {
+ int format = _d.u16(4);
+ Data value = _d.subtable(6);
+ for (Coverage::iterator i = coverage().begin(); i; i++)
+ v.push_back(Positioning(Position(*i, format, value)));
+ } else {
+ int format = _d.u16(4);
+ int size = GposValue::size(format);
+ for (Coverage::iterator i = coverage().begin(); i; i++)
+ v.push_back(Positioning(Position(*i, format, _d.subtable(F2_HEADERSIZE + size*i.coverage_index()))));
+ }
+}
+
+
+/**************************
+ * GposPair *
+ * *
+ **************************/
+
+GposPair::GposPair(const Data &d) throw (Error)
+ : _d(d)
+{
+ if (_d[0] != 0
+ || (_d[1] != 1 && _d[1] != 2))
+ throw Format("GPOS Pair Positioning");
+ Coverage coverage(_d.offset_subtable(2));
+ if (!coverage.ok()
+ || (_d[1] == 1 && coverage.size() > _d.u16(8)))
+ throw Format("GPOS Pair Positioning coverage");
+}
+
+Coverage
+GposPair::coverage() const throw ()
+{
+ return Coverage(_d.offset_subtable(2), 0, false);
+}
+
+void
+GposPair::unparse(Vector<Positioning> &v) const
+{
+ if (_d[1] == 1) {
+ int format1 = _d.u16(4);
+ int format2 = _d.u16(6);
+ int f2_pos = PAIRVALUE_HEADERSIZE + GposValue::size(format1);
+ int pairvalue_size = f2_pos + GposValue::size(format2);
+ for (Coverage::iterator i = coverage().begin(); i; i++) {
+ Data pairset = _d.offset_subtable(F1_HEADERSIZE + i.coverage_index()*F1_RECSIZE);
+ int npair = pairset.u16(0);
+ for (int j = 0; j < npair; j++) {
+ Data pair = pairset.subtable(PAIRSET_HEADERSIZE + j*pairvalue_size);
+ v.push_back(Positioning(Position(*i, format1, pair.subtable(PAIRVALUE_HEADERSIZE)),
+ Position(pair.u16(0), format2, pair.subtable(f2_pos))));
+ }
+ }
+ } else { // _d[1] == 2
+ int format1 = _d.u16(4);
+ int format2 = _d.u16(6);
+ int f2_pos = GposValue::size(format1);
+ int recsize = f2_pos + GposValue::size(format2);
+ ClassDef class1(_d.offset_subtable(8));
+ ClassDef class2(_d.offset_subtable(10));
+ Coverage coverage = this->coverage();
+ int nclass1 = _d.u16(12);
+ int nclass2 = _d.u16(14);
+ int offset = F2_HEADERSIZE;
+ for (int c1 = 0; c1 < nclass1; c1++)
+ for (int c2 = 0; c2 < nclass2; c2++, offset += recsize) {
+ Position p1(format1, _d.subtable(offset));
+ Position p2(format2, _d.subtable(offset + f2_pos));
+ if (p1 || p2) {
+ for (ClassDef::class_iterator c1i = class1.begin(c1, coverage); c1i; c1i++)
+ for (ClassDef::class_iterator c2i = class2.begin(c2); c2i; c2i++)
+ v.push_back(Positioning(Position(*c1i, p1), Position(*c2i, p2)));
+ }
+ }
+ }
+}
+
+
+/**************************
+ * Positioning *
+ * *
+ **************************/
+
+static void
+unparse_glyphid(StringAccum &sa, Glyph gid, const Vector<PermString> *gns)
+{
+ if (!gns)
+ gns = &debug_glyph_names;
+ if (gid && gns && gns->size() > gid && (*gns)[gid])
+ sa << (*gns)[gid];
+ else
+ sa << "g" << gid;
+}
+
+void
+Position::unparse(StringAccum &sa, const Vector<PermString> *gns) const
+{
+ unparse_glyphid(sa, g, gns);
+ if (placed())
+ sa << '@' << pdx << ',' << pdy;
+ sa << '+' << adx;
+ if (ady)
+ sa << '/' << ady;
+}
+
+String
+Position::unparse(const Vector<PermString> *gns) const
+{
+ StringAccum sa;
+ unparse(sa, gns);
+ return sa.take_string();
+}
+
+bool
+Positioning::context_in(const Coverage &c) const
+{
+ return (c.covers(_left.g) || !_left.g) && (!_right.g || c.covers(_right.g));
+}
+
+bool
+Positioning::context_in(const GlyphSet &gs) const
+{
+ return (gs.covers(_left.g) || !_left.g) && (!_right.g || gs.covers(_right.g));
+}
+
+void
+Positioning::unparse(StringAccum &sa, const Vector<PermString> *gns) const
+{
+ if (!*this)
+ sa << "NULL[]";
+ else if (is_single()) {
+ sa << "SINGLE[";
+ _left.unparse(sa, gns);
+ sa << ']';
+ } else if (is_pairkern()) {
+ sa << "KERN[";
+ unparse_glyphid(sa, _left.g, gns);
+ sa << ' ';
+ unparse_glyphid(sa, _right.g, gns);
+ sa << "+" << _left.adx << ']';
+ } else if (is_pair()) {
+ sa << "PAIR[";
+ _left.unparse(sa, gns);
+ sa << ' ';
+ _right.unparse(sa, gns);
+ sa << ']';
+ } else
+ sa << "UNKNOWN[]";
+}
+
+String
+Positioning::unparse(const Vector<PermString> *gns) const
+{
+ StringAccum sa;
+ unparse(sa, gns);
+ return sa.take_string();
+}
+
+}}
+
+#include <lcdf/vector.cc>
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgsub.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgsub.cc
index d33bbc027a7..5c9648bbb47 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfgsub.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfgsub.cc
@@ -32,11 +32,11 @@ Substitution::clear(Substitute &s, uint8_t &t)
{
switch (t) {
case T_GLYPHS:
- delete[] s.gids;
- break;
+ delete[] s.gids;
+ break;
case T_COVERAGE:
- delete s.coverage;
- break;
+ delete s.coverage;
+ break;
}
t = T_NONE;
}
@@ -46,11 +46,11 @@ Substitution::assign_space(Substitute &s, uint8_t &t, int n)
{
clear(s, t);
if (n == 1)
- t = T_GLYPH;
+ t = T_GLYPH;
else if (n > 1) {
- s.gids = new Glyph[n + 1];
- s.gids[0] = n;
- t = T_GLYPHS;
+ s.gids = new Glyph[n + 1];
+ s.gids[0] = n;
+ t = T_GLYPHS;
}
}
@@ -68,13 +68,13 @@ Substitution::assign(Substitute &s, uint8_t &t, int ngids, const Glyph *gids)
clear(s, t);
assert(ngids > 0);
if (ngids == 1) {
- s.gid = gids[0];
- t = T_GLYPH;
+ s.gid = gids[0];
+ t = T_GLYPH;
} else {
- s.gids = new Glyph[ngids + 1];
- s.gids[0] = ngids;
- memcpy(s.gids + 1, gids, ngids * sizeof(Glyph));
- t = T_GLYPHS;
+ s.gids = new Glyph[ngids + 1];
+ s.gids[0] = ngids;
+ memcpy(s.gids + 1, gids, ngids * sizeof(Glyph));
+ t = T_GLYPHS;
}
}
@@ -90,22 +90,22 @@ void
Substitution::assign(Substitute &s, uint8_t &t, const Substitute &os, uint8_t ot)
{
if (&s == &os)
- return;
+ return;
switch (ot) {
case T_NONE:
- clear(s, t);
- break;
+ clear(s, t);
+ break;
case T_GLYPH:
- assign(s, t, os.gid);
- break;
+ assign(s, t, os.gid);
+ break;
case T_GLYPHS:
- assign(s, t, os.gids[0], os.gids + 1);
- break;
+ assign(s, t, os.gids[0], os.gids + 1);
+ break;
case T_COVERAGE:
- assign(s, t, *os.coverage);
- break;
+ assign(s, t, *os.coverage);
+ break;
default:
- assert(0);
+ assert(0);
}
}
@@ -165,13 +165,13 @@ Substitution::Substitution(int nleft, int nin, int nout, int nright)
: _left_is(T_NONE), _in_is(T_NONE), _out_is(T_NONE), _right_is(T_NONE)
{
if (nleft)
- assign_space(_left, _left_is, nleft);
+ assign_space(_left, _left_is, nleft);
if (nin)
- assign_space(_in, _in_is, nin);
+ assign_space(_in, _in_is, nin);
if (nout)
- assign_space(_out, _out_is, nout);
+ assign_space(_out, _out_is, nout);
if (nright)
- assign_space(_right, _right_is, nright);
+ assign_space(_right, _right_is, nright);
}
Substitution::~Substitution()
@@ -198,19 +198,19 @@ Substitution::substitute_in(const Substitute &s, uint8_t t, const Coverage &c)
{
switch (t) {
case T_NONE:
- return true;
+ return true;
case T_GLYPH:
- return c.covers(s.gid);
+ return c.covers(s.gid);
case T_GLYPHS:
- for (int i = 1; i <= s.gids[0]; i++)
- if (!c.covers(s.gids[i]))
- return false;
- return true;
+ for (int i = 1; i <= s.gids[0]; i++)
+ if (!c.covers(s.gids[i]))
+ return false;
+ return true;
case T_COVERAGE:
- return *s.coverage <= c;
+ return *s.coverage <= c;
default:
- assert(0);
- return false;
+ assert(0);
+ return false;
}
}
@@ -219,22 +219,22 @@ Substitution::substitute_in(const Substitute &s, uint8_t t, const GlyphSet &gs)
{
switch (t) {
case T_NONE:
- return true;
+ return true;
case T_GLYPH:
- return gs.covers(s.gid);
+ return gs.covers(s.gid);
case T_GLYPHS:
- for (int i = 1; i <= s.gids[0]; i++)
- if (!gs.covers(s.gids[i]))
- return false;
- return true;
+ for (int i = 1; i <= s.gids[0]; i++)
+ if (!gs.covers(s.gids[i]))
+ return false;
+ return true;
case T_COVERAGE:
- for (Coverage::iterator i = s.coverage->begin(); i; i++)
- if (!gs.covers(*i))
- return false;
- return true;
+ for (Coverage::iterator i = s.coverage->begin(); i; i++)
+ if (!gs.covers(*i))
+ return false;
+ return true;
default:
- assert(0);
- return false;
+ assert(0);
+ return false;
}
}
@@ -242,16 +242,16 @@ bool
Substitution::context_in(const Coverage &c) const
{
return substitute_in(_left, _left_is, c)
- && substitute_in(_in, _in_is, c)
- && substitute_in(_right, _right_is, c);
+ && substitute_in(_in, _in_is, c)
+ && substitute_in(_right, _right_is, c);
}
bool
Substitution::context_in(const GlyphSet &gs) const
{
return substitute_in(_left, _left_is, gs)
- && substitute_in(_in, _in_is, gs)
- && substitute_in(_right, _right_is, gs);
+ && substitute_in(_in, _in_is, gs)
+ && substitute_in(_right, _right_is, gs);
}
Glyph
@@ -265,16 +265,16 @@ Substitution::extract_glyph(const Substitute &s, int which, uint8_t t) throw ()
{
switch (t) {
case T_GLYPH:
- return (which == 0 ? s.gid : 0);
+ return (which == 0 ? s.gid : 0);
case T_GLYPHS:
- return (s.gids[0] > which ? s.gids[which + 1] : 0);
+ return (s.gids[0] > which ? s.gids[which + 1] : 0);
case T_COVERAGE:
- for (Coverage::iterator ci = s.coverage->begin(); ci; ci++, which--)
- if (which == 0)
- return *ci;
- return 0;
+ for (Coverage::iterator ci = s.coverage->begin(); ci; ci++, which--)
+ if (which == 0)
+ return *ci;
+ return 0;
default:
- return 0;
+ return 0;
}
}
@@ -283,21 +283,21 @@ Substitution::extract_glyphs(const Substitute &s, uint8_t t, Vector<Glyph> &v, b
{
switch (t) {
case T_GLYPH:
- v.push_back(s.gid);
- return true;
+ v.push_back(s.gid);
+ return true;
case T_GLYPHS:
- for (int i = 1; i <= s.gids[0]; i++)
- v.push_back(s.gids[i]);
- return true;
+ for (int i = 1; i <= s.gids[0]; i++)
+ v.push_back(s.gids[i]);
+ return true;
case T_COVERAGE:
- if (coverage_ok) {
- for (Coverage::iterator i = s.coverage->begin(); i; i++)
- v.push_back(*i);
- return true;
- } else
- return false;
+ if (coverage_ok) {
+ for (Coverage::iterator i = s.coverage->begin(); i; i++)
+ v.push_back(*i);
+ return true;
+ } else
+ return false;
default:
- return false;
+ return false;
}
}
@@ -306,11 +306,11 @@ Substitution::extract_glyphptr(const Substitute &s, uint8_t t) throw ()
{
switch (t) {
case T_GLYPH:
- return const_cast<Glyph *>(&s.gid);
+ return const_cast<Glyph *>(&s.gid);
case T_GLYPHS:
- return &s.gids[1];
+ return &s.gids[1];
default:
- return 0;
+ return 0;
}
}
@@ -319,13 +319,13 @@ Substitution::extract_nglyphs(const Substitute &s, uint8_t t, bool coverage_ok)
{
switch (t) {
case T_GLYPH:
- return 1;
+ return 1;
case T_GLYPHS:
- return s.gids[0];
+ return s.gids[0];
case T_COVERAGE:
- return (coverage_ok ? 1 : 0);
+ return (coverage_ok ? 1 : 0);
default:
- return 0;
+ return 0;
}
}
@@ -334,13 +334,13 @@ Substitution::matches(const Substitute &s, uint8_t t, int pos, Glyph g) throw ()
{
switch (t) {
case T_GLYPH:
- return (pos == 0 && s.gid == g);
+ return (pos == 0 && s.gid == g);
case T_GLYPHS:
- return (pos >= 0 && pos < s.gids[0] && s.gids[1 + pos] == g);
+ return (pos >= 0 && pos < s.gids[0] && s.gids[1 + pos] == g);
case T_COVERAGE:
- return (pos == 0 && s.coverage->covers(g));
+ return (pos == 0 && s.coverage->covers(g));
default:
- return false;
+ return false;
}
}
@@ -348,9 +348,9 @@ bool
Substitution::is_noop() const
{
return (_in_is == T_GLYPH && _out_is == T_GLYPH && _in.gid == _out.gid)
- || (_in_is == T_GLYPHS && _out_is == T_GLYPHS
- && _in.gids[0] == _out.gids[0]
- && memcmp(_in.gids, _out.gids, (_in.gids[0] + 1) * sizeof(Glyph)) == 0);
+ || (_in_is == T_GLYPHS && _out_is == T_GLYPHS
+ && _in.gids[0] == _out.gids[0]
+ && memcmp(_in.gids, _out.gids, (_in.gids[0] + 1) * sizeof(Glyph)) == 0);
}
bool
@@ -359,10 +359,10 @@ Substitution::all_in_glyphs(Vector<Glyph> &gs) const
bool ok = true;
gs.clear();
if (_left_is != T_NONE)
- ok &= extract_glyphs(_left, _left_is, gs, false);
+ ok &= extract_glyphs(_left, _left_is, gs, false);
ok &= extract_glyphs(_in, _in_is, gs, false);
if (_right_is != T_NONE)
- ok &= extract_glyphs(_right, _right_is, gs, false);
+ ok &= extract_glyphs(_right, _right_is, gs, false);
return ok;
}
@@ -371,10 +371,10 @@ Substitution::all_out_glyphs(Vector<Glyph> &v) const
{
bool ok = true;
if (_left_is != T_NONE)
- ok &= extract_glyphs(_left, _left_is, v, false);
+ ok &= extract_glyphs(_left, _left_is, v, false);
ok &= extract_glyphs(_out, _out_is, v, false);
if (_right_is != T_NONE)
- ok &= extract_glyphs(_right, _right_is, v, false);
+ ok &= extract_glyphs(_right, _right_is, v, false);
return ok;
}
@@ -382,21 +382,21 @@ void
Substitution::assign_append(Substitute &s, uint8_t &t, const Substitute &ls, uint8_t lt, const Substitute &rs, uint8_t rt)
{
if (lt == T_NONE)
- assign(s, t, rs, rt);
+ assign(s, t, rs, rt);
else if (rt == T_NONE)
- assign(s, t, ls, lt);
+ assign(s, t, ls, lt);
else if (lt != T_COVERAGE && rt != T_COVERAGE) {
- int nl = extract_nglyphs(ls, lt, false);
- int nr = extract_nglyphs(rs, rt, false);
- Glyph *gids = new Glyph[nl + nr + 1];
- gids[0] = nl + nr;
- memcpy(&gids[1], extract_glyphptr(ls, lt), nl * sizeof(Glyph));
- memcpy(&gids[1 + nl], extract_glyphptr(rs, rt), nr * sizeof(Glyph));
- clear(s, t);
- s.gids = gids;
- t = T_GLYPHS;
+ int nl = extract_nglyphs(ls, lt, false);
+ int nr = extract_nglyphs(rs, rt, false);
+ Glyph *gids = new Glyph[nl + nr + 1];
+ gids[0] = nl + nr;
+ memcpy(&gids[1], extract_glyphptr(ls, lt), nl * sizeof(Glyph));
+ memcpy(&gids[1 + nl], extract_glyphptr(rs, rt), nr * sizeof(Glyph));
+ clear(s, t);
+ s.gids = gids;
+ t = T_GLYPHS;
} else
- throw Error();
+ throw Error();
}
void
@@ -430,14 +430,14 @@ void
Substitution::remove_outer_left()
{
if (_left_is == T_GLYPH)
- _left_is = T_NONE;
+ _left_is = T_NONE;
else if (_left_is == T_GLYPHS) {
- if (_left.gids[0] == 2)
- assign(_left, _left_is, _left.gids[2]);
- else {
- _left.gids[0]--;
- memmove(_left.gids + 1, _left.gids + 2, _left.gids[0] * sizeof(Glyph));
- }
+ if (_left.gids[0] == 2)
+ assign(_left, _left_is, _left.gids[2]);
+ else {
+ _left.gids[0]--;
+ memmove(_left.gids + 1, _left.gids + 2, _left.gids[0] * sizeof(Glyph));
+ }
}
}
@@ -451,12 +451,12 @@ void
Substitution::remove_outer_right()
{
if (_right_is == T_GLYPH)
- _right_is = T_NONE;
+ _right_is = T_NONE;
else if (_right_is == T_GLYPHS) {
- if (_right.gids[0] == 2)
- assign(_right, _right_is, _right.gids[1]);
- else
- _right.gids[0]--;
+ if (_right.gids[0] == 2)
+ assign(_right, _right_is, _right.gids[1]);
+ else
+ _right.gids[0]--;
}
}
@@ -469,21 +469,21 @@ Substitution::out_alter(const Substitution &o, int pos) throw ()
int out_ng = o.out_nglyphs();
int in_ng = o.in_nglyphs();
if (pos + in_ng > ng || out_ng == 0)
- return false;
+ return false;
// check that input substitution actually matches us
for (int i = 0; i < in_ng; i++)
- if (!o.in_matches(i, g[pos+i]))
- return false;
+ if (!o.in_matches(i, g[pos+i]))
+ return false;
// actually change output
Vector<Glyph> new_g;
for (int i = 0; i < pos; i++)
- new_g.push_back(g[i]);
+ new_g.push_back(g[i]);
for (int i = 0; i < out_ng; i++)
- new_g.push_back(out_g[i]);
+ new_g.push_back(out_g[i]);
for (int i = pos + in_ng; i < ng; i++)
- new_g.push_back(g[i]);
+ new_g.push_back(g[i]);
assign(_out, _out_is, new_g.size(), &new_g[0]);
return true;
@@ -493,60 +493,60 @@ static void
unparse_glyphid(StringAccum &sa, Glyph gid, const Vector<PermString> *gns) throw ()
{
if (gid > 0 && gns && gns->size() > gid && (*gns)[gid])
- sa << (*gns)[gid];
+ sa << (*gns)[gid];
else
- sa << "g" << gid;
+ sa << "g" << gid;
}
void
Substitution::unparse_glyphids(StringAccum &sa, const Substitute &s, uint8_t t, const Vector<PermString> *gns) throw ()
{
if (t == T_GLYPH)
- unparse_glyphid(sa, s.gid, gns);
+ unparse_glyphid(sa, s.gid, gns);
else if (t == T_GLYPHS) {
- for (int i = 1; i <= s.gids[0]; i++) {
- if (i != 1)
- sa << ' ';
- unparse_glyphid(sa, s.gids[i], gns);
- }
+ for (int i = 1; i <= s.gids[0]; i++) {
+ if (i != 1)
+ sa << ' ';
+ unparse_glyphid(sa, s.gids[i], gns);
+ }
} else if (t == T_COVERAGE)
- sa << "<coverage>";
+ sa << "<coverage>";
else
- sa << "-";
+ sa << "-";
}
void
Substitution::unparse(StringAccum &sa, const Vector<PermString> *gns) const
{
if (!*this)
- sa << "NULL[]";
+ sa << "NULL[]";
else {
- if (is_single())
- sa << "SINGLE[";
- else if (is_ligature())
- sa << "LIGATURE[";
- else if (is_multiple())
- sa << "MULTIPLE[";
- else if (is_alternate())
- sa << "ALTERNATE[";
- else if (is_simple_context())
- sa << "SIMPLECONTEXT[";
- else
- sa << "UNKNOWN[";
-
- if (_left_is != T_NONE) {
- unparse_glyphids(sa, _left, _left_is, gns);
- sa << " | ";
- }
- unparse_glyphids(sa, _in, _in_is, gns);
- sa << " => ";
- unparse_glyphids(sa, _out, _out_is, gns);
- if (_right_is != T_NONE) {
- sa << " | ";
- unparse_glyphids(sa, _right, _right_is, gns);
- }
-
- sa << ']';
+ if (is_single())
+ sa << "SINGLE[";
+ else if (is_ligature())
+ sa << "LIGATURE[";
+ else if (is_multiple())
+ sa << "MULTIPLE[";
+ else if (is_alternate())
+ sa << "ALTERNATE[";
+ else if (is_simple_context())
+ sa << "SIMPLECONTEXT[";
+ else
+ sa << "UNKNOWN[";
+
+ if (_left_is != T_NONE) {
+ unparse_glyphids(sa, _left, _left_is, gns);
+ sa << " | ";
+ }
+ unparse_glyphids(sa, _in, _in_is, gns);
+ sa << " => ";
+ unparse_glyphids(sa, _out, _out_is, gns);
+ if (_right_is != T_NONE) {
+ sa << " | ";
+ unparse_glyphids(sa, _right, _right_is, gns);
+ }
+
+ sa << ']';
}
}
@@ -568,28 +568,28 @@ Substitution::unparse(const Vector<PermString> *gns) const
Gsub::Gsub(const Data &d, const Font *otf, ErrorHandler *errh) throw (Error)
: _chaincontext_reverse_backtrack(false)
{
- // Fixed Version
- // Offset ScriptList
- // Offset FeatureList
- // Offset LookupList
+ // Fixed Version
+ // Offset ScriptList
+ // Offset FeatureList
+ // Offset LookupList
if (d.length() == 0)
- throw BlankTable("GSUB");
+ throw BlankTable("GSUB");
if (d.u16(0) != 1)
- throw Format("GSUB");
+ throw Format("GSUB");
if (_script_list.assign(d.offset_subtable(4), errh) < 0)
- throw Format("GSUB script list");
+ throw Format("GSUB script list");
if (_feature_list.assign(d.offset_subtable(6), errh) < 0)
- throw Format("GSUB feature list");
+ throw Format("GSUB feature list");
_lookup_list = d.offset_subtable(8);
if (!otf)
- return;
+ return;
// Check for "correct" chaining context rules, as suggested by Adobe's
// OpenType FDK
try {
- Name nametable(otf->table("name"), ErrorHandler::silent_handler());
- _chaincontext_reverse_backtrack = nametable.version_chaincontext_reverse_backtrack();
+ Name nametable(otf->table("name"), ErrorHandler::silent_handler());
+ _chaincontext_reverse_backtrack = nametable.version_chaincontext_reverse_backtrack();
} catch (Error) {
}
}
@@ -604,9 +604,9 @@ GsubLookup
Gsub::lookup(unsigned i) const
{
if (i >= _lookup_list.u16(0))
- throw Error("GSUB lookup out of range");
+ throw Error("GSUB lookup out of range");
else
- return GsubLookup(_lookup_list.offset_subtable(2 + i*2));
+ return GsubLookup(_lookup_list.offset_subtable(2 + i*2));
}
@@ -619,13 +619,13 @@ GsubLookup::GsubLookup(const Data &d) throw (Error)
: _d(d)
{
if (_d.length() < 6)
- throw Format("GSUB Lookup table");
+ throw Format("GSUB Lookup table");
_type = _d.u16(0);
if (_type == L_EXTENSION && _d.u16(4) != 0) {
- Data first_subtable = _d.offset_subtable(HEADERSIZE);
- if (first_subtable.length() < 8 || first_subtable.u16(0) != 1)
- throw Format("GSUB Extension Lookup table");
- _type = first_subtable.u16(2);
+ Data first_subtable = _d.offset_subtable(HEADERSIZE);
+ if (first_subtable.length() < 8 || first_subtable.u16(0) != 1)
+ throw Format("GSUB Extension Lookup table");
+ _type = first_subtable.u16(2);
}
}
@@ -634,11 +634,11 @@ GsubLookup::subtable(int i) const
{
Data subd = _d.offset_subtable(HEADERSIZE + i*RECSIZE);
if (_d.u16(0) != L_EXTENSION)
- return subd;
+ return subd;
else if (subd.length() >= 8 && subd.u16(0) == 1 && subd.u16(2) == _type)
- return subd.subtable(subd.u32(4));
+ return subd.subtable(subd.u32(4));
else
- return Data();
+ return Data();
}
void
@@ -647,41 +647,41 @@ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ for (int i = 0; i < nlookup; i++) {
+ GsubChainContext x(subtable(i));
+ x.mark_out_glyphs(gsub, gmap);
+ }
+ return;
}
}
@@ -691,47 +691,47 @@ GsubLookup::unparse_automatics(const Gsub &gsub, Vector<Substitution> &v, 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, limit);
- }
- return true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubSingle x(subtable(i)); // this pattern makes gcc-3.3.4 happier
+ x.unparse(v, limit);
+ }
+ return true;
case L_MULTIPLE:
- for (int i = 0; i < nlookup; i++) {
- GsubMultiple x(subtable(i));
- x.unparse(v);
- }
- return true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubMultiple x(subtable(i));
+ x.unparse(v);
+ }
+ return true;
case L_ALTERNATE:
- for (int i = 0; i < nlookup; i++) {
- GsubMultiple x(subtable(i));
- x.unparse(v, true);
- }
- return true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubMultiple x(subtable(i));
+ x.unparse(v, true);
+ }
+ return true;
case L_LIGATURE:
- for (int i = 0; i < nlookup; i++) {
- GsubLigature x(subtable(i));
- x.unparse(v);
- }
- return true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubLigature x(subtable(i));
+ x.unparse(v);
+ }
+ return true;
case L_CONTEXT: {
- bool understood = true;
- for (int i = 0; i < nlookup; i++) {
- GsubContext x(subtable(i));
- understood &= x.unparse(gsub, v, limit);
- }
- return understood;
+ bool understood = true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubContext x(subtable(i));
+ understood &= x.unparse(gsub, v, limit);
+ }
+ return understood;
}
case L_CHAIN: {
- bool understood = true;
- for (int i = 0; i < nlookup; i++) {
- GsubChainContext x(subtable(i));
- understood &= x.unparse(gsub, v, limit);
- }
- return understood;
+ bool understood = true;
+ for (int i = 0; i < nlookup; i++) {
+ GsubChainContext x(subtable(i));
+ understood &= x.unparse(gsub, v, limit);
+ }
+ return understood;
}
default:
- return false;
+ return false;
}
}
@@ -741,35 +741,35 @@ GsubLookup::apply(const Glyph *g, int pos, int n, Substitution &s) const
int nlookup = _d.u16(4);
switch (_type) {
case L_SINGLE:
- for (int i = 0; i < nlookup; i++) {
- GsubSingle x(subtable(i));
- if (x.apply(g, pos, n, s))
- return true;
- }
- return false;
+ for (int i = 0; i < nlookup; i++) {
+ GsubSingle x(subtable(i));
+ if (x.apply(g, pos, n, s))
+ return true;
+ }
+ return false;
case L_MULTIPLE:
- for (int i = 0; i < nlookup; i++) {
- GsubMultiple x(subtable(i));
- if (x.apply(g, pos, n, s))
- return true;
- }
- return false;
+ for (int i = 0; i < nlookup; i++) {
+ GsubMultiple x(subtable(i));
+ if (x.apply(g, pos, n, s))
+ return true;
+ }
+ return false;
case L_ALTERNATE:
- for (int i = 0; i < nlookup; i++) {
- GsubMultiple x(subtable(i));
- if (x.apply(g, pos, n, s, true))
- return true;
- }
- return false;
+ for (int i = 0; i < nlookup; i++) {
+ GsubMultiple x(subtable(i));
+ if (x.apply(g, pos, n, s, true))
+ return true;
+ }
+ return false;
case L_LIGATURE:
- for (int i = 0; i < nlookup; i++) {
- GsubLigature x(subtable(i));
- if (x.apply(g, pos, n, s))
- return true;
- }
- return false;
- default: // XXX
- return false;
+ for (int i = 0; i < nlookup; i++) {
+ GsubLigature x(subtable(i));
+ if (x.apply(g, pos, n, s))
+ return true;
+ }
+ return false;
+ default: // XXX
+ return false;
}
}
@@ -783,12 +783,12 @@ GsubSingle::GsubSingle(const Data &d) throw (Error)
: _d(d)
{
if (_d[0] != 0
- || (_d[1] != 1 && _d[1] != 2))
- throw Format("GSUB Single Substitution");
+ || (_d[1] != 1 && _d[1] != 2))
+ throw Format("GSUB Single Substitution");
Coverage coverage(_d.offset_subtable(2));
if (!coverage.ok()
- || (_d[1] == 2 && coverage.size() > _d.u16(4)))
- throw Format("GSUB Single Substitution coverage");
+ || (_d[1] == 2 && coverage.size() > _d.u16(4)))
+ throw Format("GSUB Single Substitution coverage");
}
Coverage
@@ -802,23 +802,23 @@ GsubSingle::map(Glyph g) const
{
int ci = coverage().coverage_index(g);
if (ci < 0)
- return g;
+ return g;
else if (_d[1] == 1)
- return g + _d.s16(4);
+ return g + _d.s16(4);
else
- return _d.u16(HEADERSIZE + FORMAT2_RECSIZE*ci);
+ return _d.u16(HEADERSIZE + FORMAT2_RECSIZE*ci);
}
void
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++)
- gmap[*i + delta] = true;
+ int delta = _d.s16(4);
+ for (Coverage::iterator i = coverage().begin(); i; i++)
+ gmap[*i + delta] = true;
} else {
- for (Coverage::iterator i = coverage().begin(); i; i++)
- gmap[_d.u16(HEADERSIZE + i.coverage_index()*FORMAT2_RECSIZE)] = true;
+ for (Coverage::iterator i = coverage().begin(); i; i++)
+ gmap[_d.u16(HEADERSIZE + i.coverage_index()*FORMAT2_RECSIZE)] = true;
}
}
@@ -826,14 +826,14 @@ 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));
+ 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)));
+ 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)));
}
}
@@ -841,14 +841,14 @@ bool
GsubSingle::apply(const Glyph *g, int pos, int n, Substitution &s) const
{
int ci;
- if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
- if (_d[1] == 1)
- s = Substitution(g[pos], g[pos] + _d.s16(4));
- else
- s = Substitution(g[pos], _d.u16(HEADERSIZE + ci*FORMAT2_RECSIZE));
- return true;
+ if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
+ if (_d[1] == 1)
+ s = Substitution(g[pos], g[pos] + _d.s16(4));
+ else
+ s = Substitution(g[pos], _d.u16(HEADERSIZE + ci*FORMAT2_RECSIZE));
+ return true;
} else
- return false;
+ return false;
}
@@ -861,11 +861,11 @@ GsubMultiple::GsubMultiple(const Data &d) throw (Error)
: _d(d)
{
if (_d[0] != 0 || _d[1] != 1)
- throw Format("GSUB Multiple Substitution");
+ throw Format("GSUB Multiple Substitution");
Coverage coverage(_d.offset_subtable(2));
if (!coverage.ok()
- || coverage.size() > _d.u16(4))
- throw Format("GSUB Multiple Substitution coverage");
+ || coverage.size() > _d.u16(4))
+ throw Format("GSUB Multiple Substitution coverage");
}
Coverage
@@ -880,13 +880,13 @@ GsubMultiple::map(Glyph g, Vector<Glyph> &v) const
v.clear();
int ci = coverage().coverage_index(g);
if (ci < 0) {
- v.push_back(g);
- return false;
+ v.push_back(g);
+ return false;
} else {
- Data seq = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
- for (int i = 0; i < seq.u16(0); i++)
- v.push_back(seq.u16(SEQ_HEADERSIZE + i*SEQ_RECSIZE));
- return true;
+ Data seq = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
+ for (int i = 0; i < seq.u16(0); i++)
+ v.push_back(seq.u16(SEQ_HEADERSIZE + i*SEQ_RECSIZE));
+ return true;
}
}
@@ -894,9 +894,9 @@ 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;
+ 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;
}
}
@@ -905,11 +905,11 @@ GsubMultiple::unparse(Vector<Substitution> &v, bool is_alternate) const
{
Vector<Glyph> result;
for (Coverage::iterator i = coverage().begin(); i; i++) {
- Data seq = _d.offset_subtable(HEADERSIZE + i.coverage_index()*RECSIZE);
- result.clear();
- for (int j = 0; j < seq.u16(0); j++)
- result.push_back(seq.u16(SEQ_HEADERSIZE + j*SEQ_RECSIZE));
- v.push_back(Substitution(*i, result, is_alternate));
+ Data seq = _d.offset_subtable(HEADERSIZE + i.coverage_index()*RECSIZE);
+ result.clear();
+ for (int j = 0; j < seq.u16(0); j++)
+ result.push_back(seq.u16(SEQ_HEADERSIZE + j*SEQ_RECSIZE));
+ v.push_back(Substitution(*i, result, is_alternate));
}
}
@@ -917,15 +917,15 @@ bool
GsubMultiple::apply(const Glyph *g, int pos, int n, Substitution &s, bool is_alternate) const
{
int ci;
- if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
- Vector<Glyph> result;
- Data seq = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
- for (int j = 0; j < seq.u16(0); j++)
- result.push_back(seq.u16(SEQ_HEADERSIZE + j*SEQ_RECSIZE));
- s = Substitution(g[pos], result, is_alternate);
- return true;
+ if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
+ Vector<Glyph> result;
+ Data seq = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
+ for (int j = 0; j < seq.u16(0); j++)
+ result.push_back(seq.u16(SEQ_HEADERSIZE + j*SEQ_RECSIZE));
+ s = Substitution(g[pos], result, is_alternate);
+ return true;
} else
- return false;
+ return false;
}
@@ -938,12 +938,12 @@ GsubLigature::GsubLigature(const Data &d) throw (Error)
: _d(d)
{
if (_d[0] != 0
- || _d[1] != 1)
- throw Format("GSUB Ligature Substitution");
+ || _d[1] != 1)
+ throw Format("GSUB Ligature Substitution");
Coverage coverage(_d.offset_subtable(2));
if (!coverage.ok()
- || coverage.size() > _d.u16(4))
- throw Format("GSUB Ligature Substitution coverage");
+ || coverage.size() > _d.u16(4))
+ throw Format("GSUB Ligature Substitution coverage");
}
Coverage
@@ -960,20 +960,20 @@ GsubLigature::map(const Vector<Glyph> &gs, Glyph &result, int &consumed) const
consumed = 1;
int ci = coverage().coverage_index(gs[0]);
if (ci < 0)
- return false;
+ return false;
Data ligset = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
int nligset = ligset.u16(0);
for (int i = 0; i < nligset; i++) {
- Data lig = ligset.offset_subtable(SET_HEADERSIZE + i*SET_RECSIZE);
- int nlig = lig.u16(2);
- if (nlig > gs.size() - 1)
- goto bad;
- for (int j = 0; j < nlig - 1; j++)
- if (lig.u16(LIG_HEADERSIZE + j*LIG_RECSIZE) != gs[j + 1])
- goto bad;
- result = lig.u16(0);
- consumed = nlig + 1;
- return true;
+ Data lig = ligset.offset_subtable(SET_HEADERSIZE + i*SET_RECSIZE);
+ int nlig = lig.u16(2);
+ if (nlig > gs.size() - 1)
+ goto bad;
+ for (int j = 0; j < nlig - 1; j++)
+ if (lig.u16(LIG_HEADERSIZE + j*LIG_RECSIZE) != gs[j + 1])
+ goto bad;
+ result = lig.u16(0);
+ consumed = nlig + 1;
+ return true;
bad: ;
}
return false;
@@ -983,13 +983,13 @@ 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;
- }
+ 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;
+ }
}
}
@@ -997,17 +997,17 @@ void
GsubLigature::unparse(Vector<Substitution> &v) 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);
- int nlig = lig.u16(2);
- components.resize(1);
- for (int k = 0; k < nlig - 1; k++)
- components.push_back(lig.u16(LIG_HEADERSIZE + k*LIG_RECSIZE));
- v.push_back(Substitution(components, lig.u16(0)));
- }
+ 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);
+ int nlig = lig.u16(2);
+ components.resize(1);
+ for (int k = 0; k < nlig - 1; k++)
+ components.push_back(lig.u16(LIG_HEADERSIZE + k*LIG_RECSIZE));
+ v.push_back(Substitution(components, lig.u16(0)));
+ }
}
}
@@ -1015,21 +1015,21 @@ bool
GsubLigature::apply(const Glyph *g, int pos, int n, Substitution &s) const
{
int ci;
- if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
- Data ligset = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
- int nligset = ligset.u16(0);
- for (int j = 0; j < nligset; j++) {
- Data lig = ligset.offset_subtable(SET_HEADERSIZE + j*SET_RECSIZE);
- int nlig = lig.u16(2);
- if (pos + nlig <= n) {
- for (int k = 0; k < nlig - 1; k++)
- if (lig.u16(LIG_HEADERSIZE + k*LIG_RECSIZE) != g[pos + k + 1])
- goto ligature_failed;
- s = Substitution(nlig, &g[pos], lig.u16(0));
- return true;
- }
- ligature_failed: ;
- }
+ if (pos < n && (ci = coverage().coverage_index(g[pos])) >= 0) {
+ Data ligset = _d.offset_subtable(HEADERSIZE + ci*RECSIZE);
+ int nligset = ligset.u16(0);
+ for (int j = 0; j < nligset; j++) {
+ Data lig = ligset.offset_subtable(SET_HEADERSIZE + j*SET_RECSIZE);
+ int nlig = lig.u16(2);
+ if (pos + nlig <= n) {
+ for (int k = 0; k < nlig - 1; k++)
+ if (lig.u16(LIG_HEADERSIZE + k*LIG_RECSIZE) != g[pos + k + 1])
+ goto ligature_failed;
+ s = Substitution(nlig, &g[pos], lig.u16(0));
+ return true;
+ }
+ ligature_failed: ;
+ }
}
return false;
}
@@ -1046,18 +1046,18 @@ GsubContext::GsubContext(const Data &d) throw (Error)
switch (_d.u16(0)) {
case 1:
case 2:
- break;
+ break;
case 3: {
- int ninput = _d.u16(2);
- if (ninput < 1)
- throw Format("GSUB Context Substitution input sequence");
- Coverage coverage(_d.offset_subtable(F3_HSIZE));
- if (!coverage.ok())
- throw Format("GSUB Context Substitution coverage");
- break;
+ int ninput = _d.u16(2);
+ if (ninput < 1)
+ throw Format("GSUB Context Substitution input sequence");
+ Coverage coverage(_d.offset_subtable(F3_HSIZE));
+ if (!coverage.ok())
+ throw Format("GSUB Context Substitution coverage");
+ break;
}
default:
- throw Format("GSUB Context Substitution");
+ throw Format("GSUB Context Substitution");
}
}
@@ -1065,9 +1065,9 @@ Coverage
GsubContext::coverage() const throw ()
{
if (_d[1] == 3)
- return Coverage(_d.offset_subtable(F3_HSIZE), 0, false);
+ return Coverage(_d.offset_subtable(F3_HSIZE), 0, false);
else
- return Coverage();
+ return Coverage();
}
void
@@ -1076,16 +1076,16 @@ GsubContext::subruleset_mark_out_glyphs(const Data &data, int nsub,
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);
+ 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;
+ if (_d.u16(0) != 3) // XXX
+ return;
int nglyph = _d.u16(2);
int nsubst = _d.u16(4);
subruleset_mark_out_glyphs(_d, nsubst, F3_HSIZE + nglyph*2, gsub, gmap);
@@ -1113,10 +1113,10 @@ GsubContext::f1_unparse(const Data& data,
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)
+ 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);
@@ -1124,42 +1124,42 @@ GsubContext::f3_unparse(const Data &data,
// get array of possible substitutions including contexts
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 & 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();
- subs.swap(work_subs);
+ assert(!work_subs.size());
+ Coverage c(data.offset_subtable(glyphtab_offset + i*2));
+ 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();
+ subs.swap(work_subs);
}
// now, apply referred lookups to the resulting substitution array
Substitution subtab_sub;
for (int i = 0; i < subs.size(); i++) {
- Substitution &s = subs[i];
- int napplied = 0;
- for (int j = 0; j < nsub; j++) {
- int seq_index = data.u16(subtab_offset + SUBRECSIZE*j);
- int lookup_index = data.u16(subtab_offset + SUBRECSIZE*j + 2);
- // XXX check seq_index against size of output glyphs?
- if (gsub.lookup(lookup_index).apply(s.out_glyphptr(), seq_index, s.out_nglyphs(), subtab_sub)) {
- napplied++;
- s.out_alter(subtab_sub, seq_index);
- }
- }
- // 26.Jun.2003 -- always push substitution back, since the no-op might
- // override a following substitution
- outsubs.push_back(s);
+ Substitution &s = subs[i];
+ int napplied = 0;
+ for (int j = 0; j < nsub; j++) {
+ int seq_index = data.u16(subtab_offset + SUBRECSIZE*j);
+ int lookup_index = data.u16(subtab_offset + SUBRECSIZE*j + 2);
+ // XXX check seq_index against size of output glyphs?
+ if (gsub.lookup(lookup_index).apply(s.out_glyphptr(), seq_index, s.out_nglyphs(), subtab_sub)) {
+ napplied++;
+ s.out_alter(subtab_sub, seq_index);
+ }
+ }
+ // 26.Jun.2003 -- always push substitution back, since the no-op might
+ // override a following substitution
+ outsubs.push_back(s);
}
- return true; // XXX
+ return true; // XXX
}
bool
GsubContext::unparse(const Gsub &gsub, Vector<Substitution> &v, const Coverage &limit) const
{
- if (_d.u16(0) != 3) // XXX
- return false;
+ 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, limit, nsubst, F3_HSIZE + nglyph*2, gsub, v, Substitution());
@@ -1183,20 +1183,20 @@ GsubChainContext::GsubChainContext(const Data &d) throw (Error)
break;
}
case 2:
- break;
+ break;
case 3: {
- int nbacktrack = _d.u16(2);
- int input_offset = F3_HSIZE + nbacktrack*2;
- int ninput = _d.u16(input_offset);
- if (ninput < 1)
- throw Format("GSUB ChainContext Substitution input sequence");
- Coverage coverage(_d.offset_subtable(input_offset + F3_INPUT_HSIZE));
- if (!coverage.ok())
- throw Format("GSUB ChainContext Substitution coverage");
- break;
+ int nbacktrack = _d.u16(2);
+ int input_offset = F3_HSIZE + nbacktrack*2;
+ int ninput = _d.u16(input_offset);
+ if (ninput < 1)
+ throw Format("GSUB ChainContext Substitution input sequence");
+ Coverage coverage(_d.offset_subtable(input_offset + F3_INPUT_HSIZE));
+ if (!coverage.ok())
+ throw Format("GSUB ChainContext Substitution coverage");
+ break;
}
default:
- throw Format("GSUB ChainContext Substitution");
+ throw Format("GSUB ChainContext Substitution");
}
}
@@ -1321,62 +1321,62 @@ GsubChainContext::f3_unparse(const Gsub &gsub, Vector<Substitution> &v, const Co
Vector<Coverage> backtrackc;
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)) & limit);
+ for (int i = 0; i < nbacktrack; i++)
+ 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)) & limit);
+ for (int i = nbacktrack - 1; i >= 0; i--)
+ 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)) & limit);
+ 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();
+ n *= backtrackc[i].size();
for (int i = 0; i < nlookahead; ++i)
- n *= lookaheadc[i].size();
+ 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;
+ 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;
for (int i = 0; i < nbacktrack; i++)
- backtracki.push_back(backtrackc[i].begin());
+ backtracki.push_back(backtrackc[i].begin());
for (int i = 0; i < nlookahead; i++)
- lookaheadi.push_back(lookaheadc[i].begin());
+ lookaheadi.push_back(lookaheadc[i].begin());
bool any = false;
while (1) {
- // run GsubContext
- Substitution s(nbacktrack, 0, 0, nlookahead);
- Glyph *left_begin = s.left_glyphptr();
- for (int i = 0; i < nbacktrack; i++)
- left_begin[i] = *backtracki[i];
- Glyph *right_begin = s.right_glyphptr();
- for (int i = 0; i < nlookahead; i++)
- right_begin[i] = *lookaheadi[i];
-
- 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--) {
- lookaheadi[i]++;
- if (lookaheadi[i])
- goto next;
- lookaheadi[i] = lookaheadc[i].begin();
- }
- for (int i = nbacktrack - 1; i >= 0; i--) {
- backtracki[i]++;
- if (backtracki[i])
- goto next;
- backtracki[i] = backtrackc[i].begin();
- }
- break;
+ // run GsubContext
+ Substitution s(nbacktrack, 0, 0, nlookahead);
+ Glyph *left_begin = s.left_glyphptr();
+ for (int i = 0; i < nbacktrack; i++)
+ left_begin[i] = *backtracki[i];
+ Glyph *right_begin = s.right_glyphptr();
+ for (int i = 0; i < nlookahead; i++)
+ right_begin[i] = *lookaheadi[i];
+
+ 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--) {
+ lookaheadi[i]++;
+ if (lookaheadi[i])
+ goto next;
+ lookaheadi[i] = lookaheadc[i].begin();
+ }
+ for (int i = nbacktrack - 1; i >= 0; i--) {
+ backtracki[i]++;
+ if (backtracki[i])
+ goto next;
+ backtracki[i] = backtrackc[i].begin();
+ }
+ break;
next: ;
}
@@ -1392,7 +1392,7 @@ GsubChainContext::unparse(const Gsub &gsub, Vector<Substitution> &v, const Cover
else if (_d.u16(0) == 3)
return f3_unparse(gsub, v, limit);
else
- return false;
+ return false;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfname.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfname.cc
new file mode 100644
index 00000000000..4878da1243e
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfname.cc
@@ -0,0 +1,194 @@
+// -*- related-file-name: "../include/efont/otfname.hh" -*-
+
+/* otfname.{cc,hh} -- OpenType name table
+ *
+ * Copyright (c) 2003-2012 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/otfname.hh>
+#include <lcdf/error.hh>
+#include <lcdf/straccum.hh>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <algorithm>
+
+#define USHORT_AT(d) (Data::u16_aligned(d))
+
+namespace Efont { namespace OpenType {
+
+static const uint16_t mac_roman_encoding[] = {
+ // 0x80-0x8F
+ 0x00C4, 0x00C5, 0x00C7, 0x00C9, // Adieresis Aring Ccedilla Eacute
+ 0x00D1, 0x00D6, 0x00DC, 0x00E1, // Ntilde Odieresis Udieresis aacute
+ 0x00E0, 0x00E2, 0x00E4, 0x00E3, // agrave acircumflex adieresis atilde
+ 0x00E5, 0x00E7, 0x00E9, 0x00E8, // aring ccedilla eacute egrave
+ // 0x90-0x9F
+ 0x00EA, 0x00EB, 0x00ED, 0x00EC, // ecircumflex edieresis iacute igrave
+ 0x00EE, 0x00EF, 0x00F1, 0x00F3, // icircumflex idieresis ntilde oacute
+ 0x00F2, 0x00F4, 0x00F6, 0x00F5, // ograve ocircumflex odieresis otilde
+ 0x00FA, 0x00F9, 0x00FB, 0x00FC, // uacute ugrave ucircumflex udieresis
+ // 0xA0-0xAF
+ 0x2020, 0x00B0, 0x00A2, 0x00A3, // dagger degree cent sterling
+ 0x00A7, 0x2022, 0x00B6, 0x00DF, // section bullet paragraph germandbls
+ 0x00AE, 0x00A9, 0x2122, 0x00B4, // registered copyright trademark acute
+ 0x00A8, 0x2260, 0x00C6, 0x00D8, // dieresis notequal AE Oslash
+ // 0xB0-0xBF
+ 0x221E, 0x00B1, 0x2264, 0x2265, // infinity plusminus lessequal greaterequal
+ 0x00A5, 0x00B5, 0x2202, 0x2211, // yen mu partialdiff summation
+ 0x220F, 0x03C0, 0x222B, 0x00AA, // product pi integral ordfeminine
+ 0x00BA, 0x03A9, 0x00E6, 0x00F8, // ordmasculine Omegagreek ae oslash
+ // 0xC0-0xCF
+ 0x00BF, 0x00A1, 0x00AC, 0x221A, // questiondown exclamdown logicalnot radical
+ 0x0192, 0x2248, 0x2206, 0x00AB, // florin approxequal increment guillemotleft
+ 0x00BB, 0x2026, 0x00A0, 0x00C0, // guillemotright ellipsis nbspace Agrave
+ 0x00C3, 0x00D5, 0x0152, 0x0153, // Atilde Otilde OE oe
+ // 0xD0-0xDF
+ 0x2013, 0x2014, 0x201C, 0x201D, // endash emdash quotedblleft quotedblright
+ 0x2018, 0x2019, 0x00F7, 0x25CA, // quoteleft quoteright divide lozenge
+ 0x00FF, 0x0178, 0x2044, 0x20AC, // ydieresis Ydieresis fraction Euro
+ 0x2039, 0x203A, 0xFB01, 0xFB02, // guilsinglleft guilsinglright fi fl
+ // 0xE0-0xEF
+ 0x2021, 0x00B7, 0x201A, 0x201E, // daggerdbl middot quotesinglbase quotedblbase
+ 0x2030, 0x00C2, 0x00CA, 0x00C1, // perthousand Acircumflex Ecircumflex Aacute
+ 0x00CB, 0x00C8, 0x00CD, 0x00CE, // Edieresis Egrave Iacute Icircumflex
+ 0x00CF, 0x00CC, 0x00D3, 0x00D4, // Idieresis Igrave Oacute Ocircumflex
+ // 0xF0-0xFF
+ 0xF8FF, 0x00D2, 0x00DA, 0x00DB, // apple Ograve Uacute Ucircumflex
+ 0x00D9, 0x0131, 0x02C6, 0x02DC, // Ugrave dotlessi circumflex tilde
+ 0x00AF, 0x02D8, 0x02D9, 0x02DA, // macron breve dotaccent ring
+ 0x00B8, 0x02DD, 0x02DB, 0x02C7 // cedilla hungarumlaut ogonek caron
+};
+
+
+Name::Name(const String &s, ErrorHandler *errh)
+ : _str(s) {
+ _str.align(2);
+ _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
+}
+
+int
+Name::parse_header(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // USHORT version
+ // USHORT numTables
+ int len = _str.length();
+ const uint8_t *data = _str.udata();
+ if (len == 0)
+ return errh->error("font has no %<name%> table"), -EFAULT;
+ if (HEADER_SIZE > len)
+ return errh->error("%<name%> table too small"), -EFAULT;
+ if (!(data[0] == '\000' && data[1] == '\000'))
+ return errh->error("bad %<name%> version number"), -ERANGE;
+ int count = USHORT_AT(data + 2);
+ if (HEADER_SIZE + count*NAMEREC_SIZE > len)
+ return errh->error("%<name%> table too small"), -EFAULT;
+ return 0;
+}
+
+String
+Name::name(const_iterator i) const
+{
+ if (i < end()) {
+ int stringOffset = USHORT_AT(_str.udata() + 4);
+ int length = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 8);
+ int offset = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 10);
+ if (stringOffset + offset + length <= _str.length())
+ return _str.substring(stringOffset + offset, length);
+ }
+ return String();
+}
+
+String
+Name::utf8_name(const_iterator i) const
+{
+ // This code can handle Microsoft Unicode BMP and Mac Roman encodings,
+ // but that's it
+ if (!(i < end()))
+ return String();
+ int stringOffset = USHORT_AT(_str.udata() + 4);
+ int length = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 8);
+ int offset = USHORT_AT(reinterpret_cast<const uint8_t *>(i) + 10);
+ if (stringOffset + offset + length > _str.length())
+ return String();
+ const unsigned char *begins = _str.udata() + stringOffset + offset;
+ const unsigned char *ends = begins + length;
+ if (platform(*i) == P_MICROSOFT && encoding(*i) == E_MS_UNICODE_BMP) {
+ StringAccum sa;
+ for (const unsigned char *s = begins; s + 1 < ends; s += 2)
+ sa.append_utf8(Data::u16(s));
+ return sa.take_string();
+ } else if (platform(*i) == P_MACINTOSH && encoding(*i) == E_MAC_ROMAN) {
+ StringAccum sa;
+ for (const unsigned char *s = begins; s < ends; s++)
+ if (*s >= 0x80) {
+ sa.append(begins, s);
+ sa.append_utf8(mac_roman_encoding[*s & 0x7F]);
+ begins = s + 1;
+ }
+ if (!sa)
+ return _str.substring(begins, ends);
+ else {
+ sa.append(begins, ends);
+ return sa.take_string();
+ }
+ } else
+ return _str.substring(begins, ends);
+}
+
+String
+Name::english_name(int nameid) const
+{
+ const_iterator end = this->end();
+ const_iterator it = std::find_if(begin(), end, PlatformPred(nameid, P_MICROSOFT, E_MS_UNICODE_BMP, L_MS_ENGLISH_AMERICAN));
+ if (it == end)
+ it = std::find_if(begin(), end, PlatformPred(nameid, P_MACINTOSH, E_MAC_ROMAN, 0));
+ return utf8_name(it);
+}
+
+bool
+Name::version_chaincontext_reverse_backtrack() const
+{
+ String vstr = name(std::find_if(begin(), end(), PlatformPred(N_VERSION, 1, 0, 0)));
+ const char *v = vstr.begin(), *endv = vstr.end();
+ if (v + 20 <= endv) {
+ if (v[0] != 'O' || v[1] != 'T' || v[2] != 'F' || v[3] == ';')
+ goto try_core;
+ for (v += 4; v < endv && *v != ';'; v++)
+ /* do nothing */;
+ if (v + 3 >= endv || v[1] != 'P' || v[2] != 'S' || v[3] == ';')
+ goto try_core;
+ for (v += 4; v < endv && *v != ';'; v++)
+ /* do nothing */;
+ if (v + 11 >= endv || memcmp(v + 1, "Core 1.0.", 9) != 0
+ || (v[10] != '2' && v[10] != '3')
+ || (v[11] < '0' || v[11] > '9'))
+ goto try_core;
+ return true;
+ }
+ try_core:
+ v = vstr.begin();
+ if (v + 16 > endv
+ || v[0] != 'C' || v[1] != 'o' || v[2] != 'r' || v[3] != 'e')
+ return false;
+ for (v += 4; v < endv && *v != ';'; v++)
+ /* do nothing */;
+ if (v + 12 > endv || memcmp(v, ";makeotf.lib", 12) != 0)
+ return false;
+ return true;
+}
+
+} // namespace Efont::OpenType
+} // namespace Efont
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfos2.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfos2.cc
index 66ceeba791f..6f46596ba2b 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/otfos2.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfos2.cc
@@ -29,18 +29,18 @@ Os2::Os2(const Data &data, ErrorHandler *errh)
{
_error = parse_header(errh ? errh : ErrorHandler::silent_handler());
if (_error < 0)
- _data = Data();
+ _data = Data();
}
int
Os2::parse_header(ErrorHandler *errh)
{
// HEADER FORMAT:
- // USHORT version
+ // USHORT version
if (HEADER_SIZE > _data.length())
- return errh->error("OTF OS/2 table too small"), -EFAULT;
- if (_data.u16(0) > 4)
- return errh->error("unexpected OS/2 version number %d", _data.u16(0)), -ERANGE;
+ return errh->error("OTF OS/2 table too small"), -EFAULT;
+ if (_data.u16(0) > 5)
+ return errh->error("unexpected OS/2 version number %d", _data.u16(0)), -ERANGE;
return 0;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfpost.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfpost.cc
new file mode 100644
index 00000000000..92ba1427760
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/otfpost.cc
@@ -0,0 +1,200 @@
+// -*- related-file-name: "../include/efont/otfpost.hh" -*-
+
+/* otfpost.{cc,hh} -- OpenType post table
+ *
+ * Copyright (c) 2006-2012 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/otfpost.hh>
+#include <lcdf/error.hh>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <efont/otfdata.hh> // for ntohl()
+
+#define USHORT_AT(d) (Data::u16_aligned(d))
+#define SHORT_AT(d) (Data::s16_aligned(d))
+#define ULONG_AT(d) (Data::u32_aligned(d))
+#define LONG_AT(d) (Data::s32_aligned(d))
+
+namespace Efont { namespace OpenType {
+
+static const char * const mac_names[] = {
+ ".notdef", ".null", "nonmarkingreturn", "space", // 0-3
+ "exclam", "quotedbl", "numbersign", "dollar", // 4-7
+ "percent", "ampersand", "quotesingle", "parenleft", // 8-11
+ "parenright", "asterisk", "plus", "comma", // 12-15
+ "hyphen", "period", "slash", "zero", // 16-19
+ "one", "two", "three", "four", // 20-23
+ "five", "six", "seven", "eight", // 24-27
+ "nine", "colon", "semicolon", "less", // 28-31
+ "equal", "greater", "question", "at", // 32-35
+ "A", "B", "C", "D", // 36-39
+ "E", "F", "G", "H", // 40-43
+ "I", "J", "K", "L", // 44-47
+ "M", "N", "O", "P", // 48-51
+ "Q", "R", "S", "T", // 52-55
+ "U", "V", "W", "X", // 56-59
+ "Y", "Z", "bracketleft", "backslash", // 60-63
+ "bracketright", "asciicircum", "underscore", "grave", // 64-67
+ "a", "b", "c", "d", // 68-71
+ "e", "f", "g", "h", // 72-75
+ "i", "j", "k", "l", // 76-79
+ "m", "n", "o", "p", // 80-83
+ "q", "r", "s", "t", // 84-87
+ "u", "v", "w", "x", // 88-91
+ "y", "z", "braceleft", "bar", // 92-95
+ "braceright", "asciitilde", "Adieresis", "Aring", // 96-99
+ "Ccedilla", "Eacute", "Ntilde", "Odieresis", // 100-103
+ "Udieresis", "aacute", "agrave", "acircumflex", // 104-107
+ "adieresis", "atilde", "aring", "ccedilla", // 108-111
+ "eacute", "egrave", "ecircumflex", "edieresis", // 112-115
+ "iacute", "igrave", "icircumflex", "idieresis", // 116-119
+ "ntilde", "oacute", "ograve", "ocircumflex", // 120-123
+ "odieresis", "otilde", "uacute", "ugrave", // 124-127
+ "ucircumflex", "udieresis", "dagger", "degree", // 128-131
+ "cent", "sterling", "section", "bullet", // 132-135
+ "paragraph", "germandbls", "registered", "copyright", // 136-139
+ "trademark", "acute", "dieresis", "notequal", // 140-143
+ "AE", "Oslash", "infinity", "plusminus", // 144-147
+ "lessequal", "greaterequal", "yen", "mu", // 148-151
+ "partialdiff", "summation", "product", "pi", // 152-155
+ "integral", "ordfeminine", "ordmasculine", "Omega", // 156-159
+ "ae", "oslash", "questiondown", "exclamdown", // 160-163
+ "logicalnot", "radical", "florin", "approxequal", // 164-167
+ "Delta", "guillemotleft", "guillemotright", "ellipsis", // 168-171
+ "nonbreakingspace", "Agrave", "Atilde", "Otilde", // 172-175
+ "OE", "oe", "endash", "emdash", // 176-179
+ "quotedblleft", "quotedblright", "quoteleft", "quoteright", // 180-183
+ "divide", "lozenge", "ydieresis", "Ydieresis", // 184-187
+ "fraction", "currency", "guilsinglleft", "guilsinglright", // 188-191
+ "fi", "fl", "daggerdbl", "periodcentered", // 192-195
+ "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", // 196-199
+ "Ecircumflex", "Aacute", "Edieresis", "Egrave", // 200-203
+ "Iacute", "Icircumflex", "Idieresis", "Igrave", // 204-207
+ "Oacute", "Ocircumflex", "apple", "Ograve", // 208-211
+ "Uacute", "Ucircumflex", "Ugrave", "dotlessi", // 212-215
+ "circumflex", "tilde", "macron", "breve", // 216-219
+ "dotaccent", "ring", "cedilla", "hungarumlaut", // 220-223
+ "ogonek", "caron", "Lslash", "lslash", // 224-227
+ "Scaron", "scaron", "Zcaron", "zcaron", // 228-231
+ "brokenbar", "Eth", "eth", "Yacute", // 232-235
+ "yacute", "Thorn", "thorn", "minus", // 236-239
+ "multiply", "onesuperior", "twosuperior", "threesuperior", // 240-243
+ "onehalf", "onequarter", "threequarters", "franc", // 244-247
+ "Gbreve", "gbreve", "Idotaccent", "Scedilla", // 248-251
+ "scedilla", "Cacute", "cacute", "Ccaron", // 252-255
+ "ccaron", "dcroat" // 256-257
+};
+
+
+Post::Post(const String &s, ErrorHandler *errh)
+ : _str(s), _version(0)
+{
+ _str.align_long();
+ _error = parse_header(errh ? errh : ErrorHandler::silent_handler());
+}
+
+int
+Post::parse_header(ErrorHandler *errh)
+{
+ // HEADER FORMAT:
+ // 0 FIXED version
+ // 4 FIXED italicAngle
+ // 8 FWORD underlinePosition
+ // 10 FWORD underlineThickness
+ // 12 ULONG isFixedPitch
+ // 16 ULONG minMemType42
+ // 20 ULONG maxMemType42
+ // 24 ULONG minMemType1
+ // 28 ULONG maxMemType1
+ int len = _str.length();
+ const uint8_t *data = _str.udata();
+ if (HEADER_SIZE > len)
+ return errh->error("OTF post table too small"), -EFAULT;
+ _version = USHORT_AT(data); // ignore minor version number
+ // except that version 2.5 isn't compatible
+ if (_version < 1 || _version > 3
+ || (_version == 2 && USHORT_AT(data + 2) == 0x5000))
+ return errh->error("bad post version number"), -ERANGE;
+ if (_version == 2) {
+ // VERSION 2.0 GLYPH NAMES FORMAT:
+ // 32 USHORT numberOfGlyphs
+ // 34 USHORT glyphNameIndex[mumberOfGlyphs]
+ // CHAR names[...]
+ if (HEADER_SIZE + 2 > len
+ || ((_nglyphs = USHORT_AT(data + HEADER_SIZE)),
+ HEADER_SIZE + 2 + 2 * _nglyphs > len))
+ return errh->error("OTF post table too small for glyph map"), -EFAULT;
+ int pos = HEADER_SIZE + 2 + 2 * _nglyphs;
+ while (pos < len && pos + data[pos] < len) {
+ _extend_glyph_names.push_back(pos);
+ pos += 1 + data[pos];
+ }
+ const uint8_t *gni = data + HEADER_SIZE + 2;
+ for (int i = 0, g; i < _nglyphs; ++i, gni += 2)
+ if ((g = USHORT_AT(gni)) >= _extend_glyph_names.size() + N_MAC_GLYPHS)
+ return errh->error("bad glyph name index in post");
+ } else if (_version == 1)
+ _nglyphs = N_MAC_GLYPHS;
+ else
+ _nglyphs = -1;
+
+ return 0;
+}
+
+double
+Post::italic_angle() const
+{
+ if (error() < 0)
+ return -1;
+ return (double) LONG_AT(_str.udata() + 4) / 65536.;
+}
+
+bool
+Post::is_fixed_pitch() const
+{
+ if (error() < 0)
+ return false;
+ return ULONG_AT(_str.udata() + 12) != 0;
+}
+
+bool
+Post::glyph_names(Vector<PermString> &gnames) const
+{
+ gnames.clear();
+ if (error() < 0)
+ return false;
+ if (_version == 1) {
+ for (int i = 0; i < N_MAC_GLYPHS; i++)
+ gnames.push_back(mac_names[i]);
+ return true;
+ } else if (_version == 2) {
+ const uint8_t *data = _str.udata();
+ const uint8_t *gni = data + HEADER_SIZE + 2;
+ for (int i = 0; i < _nglyphs; i++, gni += 2) {
+ int g = USHORT_AT(gni);
+ if (g < N_MAC_GLYPHS)
+ gnames.push_back(mac_names[g]);
+ else {
+ const uint8_t *n = data + _extend_glyph_names[g - N_MAC_GLYPHS];
+ gnames.push_back(PermString((const char *) n + 1, *n));
+ }
+ }
+ return true;
+ } else
+ return false;
+}
+
+}}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/pairop.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/pairop.cc
index 5b64be1ac41..3b6eef3fc14 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/pairop.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/pairop.cc
@@ -66,7 +66,7 @@ PairProgram::add_kern(GlyphIndex left, GlyphIndex right, int ki)
bool
PairProgram::add_lig(GlyphIndex left, GlyphIndex right, GlyphIndex result,
- int kind)
+ int kind)
{
PairOp newop(left, right, result, kind, _left_map[left]);
int newopi = _op.size();
@@ -137,12 +137,12 @@ PairProgram::print() const
PairOpBlock &opb = *blocks[i];
for (int j = 0; j < opb.size(); j++)
if (opb[j].is_lig())
- printf("%s->%s ", printname(opb[j].right()),
- printname(opb[j].result()));
+ printf("%s->%s ", printname(opb[j].right()),
+ printname(opb[j].result()));
else if (opb[j].is_kern())
- printf("%s[%g] ", printname(opb[j].right()), kern(opb[j].value()));
+ printf("%s[%g] ", printname(opb[j].right()), kern(opb[j].value()));
else if (opb[j].is_noop())
- printf(". ");
+ printf(". ");
if (blocks[i]->nextblock != -1)
printf(" :B%d", blocks[i]->nextblock);
printf("\n");
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/psres.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/psres.cc
index 2136a6b3237..10b51e0ff93 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/psres.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/psres.cc
@@ -84,17 +84,17 @@ read_psres_line(Slurper &slurper, int *equals_pos)
// process backslash escapes
for (; pos < len - 1; pos++) {
if (s[pos] == '\\') {
- // quote the next character
- pos++;
- last_escape = pos;
+ // quote the next character
+ pos++;
+ last_escape = pos;
} else if (!found_eq && s[pos] == '=') {
- // an equals sign: store its position
- if (equals_pos) *equals_pos = pos;
- found_eq = true;
+ // an equals sign: store its position
+ if (equals_pos) *equals_pos = pos;
+ found_eq = true;
} else if (s[pos] == '%') {
- // unescaped '%' is a comment; return immediately after shortening line
- len = pos;
- goto done;
+ // unescaped '%' is a comment; return immediately after shortening line
+ len = pos;
+ goto done;
}
}
@@ -136,7 +136,7 @@ psres_escape(char *s, unsigned len)
void
PsresDatabaseSection::add_psres_file_section
- (Slurper &slurper, PermString directory, bool override)
+ (Slurper &slurper, PermString directory, bool override)
{
int equals_pos;
bool first_line = true;
@@ -148,9 +148,9 @@ PsresDatabaseSection::add_psres_file_section
if (first_line) {
first_line = false;
if (s[0] == '/') {
- psres_escape(s + 1, slurper.cur_line_length() - 1);
- directory = PermString(s + 1);
- continue;
+ psres_escape(s + 1, slurper.cur_line_length() - 1);
+ directory = PermString(s + 1);
+ continue;
}
}
@@ -253,8 +253,8 @@ PsresDatabase::add_psres_directory(PermString directory)
while (struct dirent *dirent = readdir(dir)) {
int len = DIR_NAMLEN(dirent);
if (len > 4 && dirent->d_name[0] != '.'
- && memcmp(dirent->d_name + len - 4, ".upr", 4) == 0
- && (len != 9 || memcmp(dirent->d_name, "PSres.upr", 9) != 0)) {
+ && memcmp(dirent->d_name + len - 4, ".upr", 4) == 0
+ && (len != 9 || memcmp(dirent->d_name, "PSres.upr", 9) != 0)) {
Filename fn(directory, PermString(dirent->d_name, len));
add_psres_file(fn, false);
}
@@ -281,8 +281,8 @@ PsresDatabase::add_psres_directory(PermString directory)
while (proceed) {
int len = strlen(find_file_data.cFileName);
if (len > 4 && find_file_data.cFileName[0] != '.'
- && _strnicmp(find_file_data.cFileName + len - 4, ".upr", 4) == 0
- && (len != 9 || _strnicmp(find_file_data.cFileName, "PSres.upr", 9) != 0)) {
+ && _strnicmp(find_file_data.cFileName + len - 4, ".upr", 4) == 0
+ && (len != 9 || _strnicmp(find_file_data.cFileName, "PSres.upr", 9) != 0)) {
Filename fn(directory, PermString(find_file_data.cFileName, len));
add_psres_file(fn, false);
}
@@ -296,7 +296,7 @@ PsresDatabase::add_psres_directory(PermString directory)
void
PsresDatabase::add_psres_path(const char *path, const char *default_path,
- bool override)
+ bool override)
{
if (!path && !default_path)
return;
@@ -320,7 +320,7 @@ PsresDatabase::add_psres_path(const char *path, const char *default_path,
Filename filename(directory, "PSres.upr");
if (epath == path) {
add_psres_path(default_path, 0, false);
- default_path = 0; // don't use default path twice
+ default_path = 0; // don't use default path twice
} else if (!filename.readable() || !add_psres_file(filename, false))
add_psres_directory(directory);
@@ -343,19 +343,19 @@ void
PsresDatabaseSection::add_section(PsresDatabaseSection *s, bool override)
{
for (HashMap<PermString, int>::const_iterator i = s->_map.begin(); i; i++) {
- int value = i.value();
- if (_map[i.key()] <= 0) {
- int my_index = _directories.size();
- _directories.push_back(s->_directories[value]);
- _values.push_back(s->_values[value]);
- _value_escaped.push_back(s->_value_escaped[value]);
- _map.insert(i.key(), my_index);
- } else if (override) {
- int my_index = _map[i.key()];
- _directories[my_index] = s->_directories[value];
- _values[my_index] = s->_values[value];
- _value_escaped[my_index] = s->_value_escaped[value];
- }
+ int value = i.value();
+ if (_map[i.key()] <= 0) {
+ int my_index = _directories.size();
+ _directories.push_back(s->_directories[value]);
+ _values.push_back(s->_values[value]);
+ _value_escaped.push_back(s->_value_escaped[value]);
+ _map.insert(i.key(), my_index);
+ } else if (override) {
+ int my_index = _map[i.key()];
+ _directories[my_index] = s->_directories[value];
+ _values[my_index] = s->_values[value];
+ _value_escaped[my_index] = s->_value_escaped[value];
+ }
}
}
@@ -391,9 +391,9 @@ PsresDatabase::value(PermString sec, PermString key) const
{
PsresDatabaseSection *s = section(sec);
if (s)
- return s->value(key);
+ return s->value(key);
else
- return String::make_empty();
+ return String::make_empty();
}
const String &
@@ -401,9 +401,9 @@ PsresDatabase::unescaped_value(PermString sec, PermString key) const
{
PsresDatabaseSection *s = section(sec);
if (s)
- return s->unescaped_value(key);
+ return s->unescaped_value(key);
else
- return String::make_empty();
+ return String::make_empty();
}
Filename
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1bounds.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1bounds.cc
index 428169c115f..d48f5947028 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1bounds.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1bounds.cc
@@ -56,9 +56,9 @@ CharstringBounds::xf_mark(const Bezier &b)
b.halve(b1, b2);
xf_mark(b1.point(3));
if (!xf_controls_inside(b1))
- xf_mark(b1);
+ xf_mark(b1);
if (!xf_controls_inside(b2))
- xf_mark(b2);
+ xf_mark(b2);
}
void
@@ -86,8 +86,8 @@ CharstringBounds::act_curve(int, const Point &p0, const Point &p1, const Point &
xf_mark(q3);
if (!xf_inside(q1) || !xf_inside(q2)) {
- Bezier b(q0, q1, q2, q3);
- xf_mark(b);
+ Bezier b(q0, q1, q2, q3);
+ xf_mark(b);
}
}
@@ -95,12 +95,12 @@ void
CharstringBounds::set_xf(const CharstringProgram *program)
{
if (_last_xf_program != program) {
- _last_xf_program = program;
- double matrix[6];
- program->font_matrix(matrix);
- Transform font_xf = Transform(matrix).scaled(program->units_per_em());
- font_xf.check_null(0.001);
- _xf = _nonfont_xf * font_xf;
+ _last_xf_program = program;
+ double matrix[6];
+ program->font_matrix(matrix);
+ Transform font_xf = Transform(matrix).scaled(program->units_per_em());
+ font_xf.check_null(0.001);
+ _xf = _nonfont_xf * font_xf;
}
}
@@ -128,17 +128,17 @@ bool
CharstringBounds::output(double bb[4], double& width, bool use_cur_width) const
{
if (!KNOWN(_lb.x))
- bb[0] = bb[1] = bb[2] = bb[3] = 0;
+ bb[0] = bb[1] = bb[2] = bb[3] = 0;
else {
- bb[0] = _lb.x;
- bb[1] = _lb.y;
- bb[2] = _rt.x;
- bb[3] = _rt.y;
+ bb[0] = _lb.x;
+ bb[1] = _lb.y;
+ bb[2] = _rt.x;
+ bb[3] = _rt.y;
}
if (use_cur_width)
- width = _width.x;
+ width = _width.x;
else {
- Point p = Point(0, 0) * _xf;
+ Point p = Point(0, 0) * _xf;
width = p.x;
}
return error() >= 0;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1cs.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1cs.cc
index 2e58ecd161c..cde1c3d91a0 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1cs.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1cs.cc
@@ -98,25 +98,25 @@ String
Charstring::command_name(int cmd)
{
if (cmd >= 0 && cmd <= cLastCommand)
- return command_names[cmd];
+ return command_names[cmd];
else if (cmd < cEscapeDelta + 256)
- return String("COMMAND_12_") + String(cmd - cEscapeDelta);
+ return String("COMMAND_12_") + String(cmd - cEscapeDelta);
else
- return String("<INVALID>");
+ return String("<INVALID>");
}
Type1Charstring::Type1Charstring(int lenIV, const String &s)
: Charstring(), _key(-1)
{
- if (lenIV < 0) // no charstring encryption
- _s = s;
+ if (lenIV < 0) // no charstring encryption
+ _s = s;
else if (lenIV < s.length()) {
- const unsigned char *d = reinterpret_cast<const unsigned char*>(s.data());
- _key = t1R_cs;
- for (int i = 0; i < lenIV; i++, d++)
- _key = ((*d + _key) * t1C1 + t1C2) & 0xFFFF;
- _s = s.substring(lenIV);
+ const unsigned char *d = reinterpret_cast<const unsigned char*>(s.data());
+ _key = t1R_cs;
+ for (int i = 0; i < lenIV; i++, d++)
+ _key = ((*d + _key) * t1C1 + t1C2) & 0xFFFF;
+ _s = s.substring(lenIV);
}
}
@@ -124,9 +124,9 @@ void
Type1Charstring::prepend(const Type1Charstring &t1cs)
{
if (_key >= 0)
- decrypt();
+ decrypt();
if (t1cs._key >= 0)
- t1cs.decrypt();
+ t1cs.decrypt();
_s = t1cs._s + _s;
}
@@ -134,14 +134,14 @@ void
Type1Charstring::decrypt() const
{
if (_key >= 0) {
- int r = _key;
- uint8_t *d = reinterpret_cast<uint8_t *>(_s.mutable_data());
- for (int i = 0; i < _s.length(); i++, d++) {
- uint8_t encrypted = *d;
- *d = encrypted ^ (r >> 8);
- r = ((encrypted + r) * t1C1 + t1C2) & 0xFFFF;
- }
- _key = -1;
+ int r = _key;
+ uint8_t *d = reinterpret_cast<uint8_t *>(_s.mutable_data());
+ for (int i = 0; i < _s.length(); i++, d++) {
+ uint8_t encrypted = *d;
+ *d = encrypted ^ (r >> 8);
+ r = ((encrypted + r) * t1C1 + t1C2) & 0xFFFF;
+ }
+ _key = -1;
}
}
@@ -152,57 +152,57 @@ Type1Charstring::process(CharstringInterp &interp) const
int left = _s.length();
while (left > 0) {
- bool more;
- int ahead;
-
- if (*data >= 32 && *data <= 246) { // push small number
- more = interp.number(data[0] - 139);
- ahead = 1;
-
- } else if (*data < 32) { // a command
- if (*data == cEscape) {
- if (left < 2)
- goto runoff_error;
- more = interp.type1_command(cEscapeDelta + data[1]);
- ahead = 2;
- } else if (*data == cShortint) { // short integer
- if (left < 3)
- goto runoff_error;
- int16_t val = (data[1] << 8) | data[2];
- more = interp.number(val);
- ahead = 3;
- } else {
- more = interp.type1_command(data[0]);
- ahead = 1;
- }
-
- } else if (*data >= 247 && *data <= 250) { // push medium number
- if (left < 2)
- goto runoff_error;
- int val = + ((data[0] - 247) << 8) + 108 + data[1];
- more = interp.number(val);
- ahead = 2;
-
- } else if (*data >= 251 && *data <= 254) { // push negative medium number
- if (left < 2)
- goto runoff_error;
- int val = - ((data[0] - 251) << 8) - 108 - data[1];
- more = interp.number(val);
- ahead = 2;
-
- } else { // 255: push huge number
- if (left < 5)
- goto runoff_error;
- int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
- more = interp.number(val);
- ahead = 5;
- }
-
- if (!more)
- return interp.error() == CharstringInterp::errOK;
-
- data += ahead;
- left -= ahead;
+ bool more;
+ int ahead;
+
+ if (*data >= 32 && *data <= 246) { // push small number
+ more = interp.number(data[0] - 139);
+ ahead = 1;
+
+ } else if (*data < 32) { // a command
+ if (*data == cEscape) {
+ if (left < 2)
+ goto runoff_error;
+ more = interp.type1_command(cEscapeDelta + data[1]);
+ ahead = 2;
+ } else if (*data == cShortint) { // short integer
+ if (left < 3)
+ goto runoff_error;
+ int16_t val = (data[1] << 8) | data[2];
+ more = interp.number(val);
+ ahead = 3;
+ } else {
+ more = interp.type1_command(data[0]);
+ ahead = 1;
+ }
+
+ } else if (*data >= 247 && *data <= 250) { // push medium number
+ if (left < 2)
+ goto runoff_error;
+ int val = + ((data[0] - 247) << 8) + 108 + data[1];
+ more = interp.number(val);
+ ahead = 2;
+
+ } else if (*data >= 251 && *data <= 254) { // push negative medium number
+ if (left < 2)
+ goto runoff_error;
+ int val = - ((data[0] - 251) << 8) - 108 - data[1];
+ more = interp.number(val);
+ ahead = 2;
+
+ } else { // 255: push huge number
+ if (left < 5)
+ goto runoff_error;
+ int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
+ more = interp.number(val);
+ ahead = 5;
+ }
+
+ if (!more)
+ return interp.error() == CharstringInterp::errOK;
+
+ data += ahead;
+ left -= ahead;
}
runoff_error:
@@ -217,19 +217,19 @@ Type1Charstring::first_caret_after(int pos) const
const uint8_t *edata = data + (pos < length() ? pos : length());
while (data < edata) {
- if (*data >= 32 && *data <= 246) // push small number
- data++;
- else if (*data < 32) { // a command
- if (*data == cEscape)
- data += 2;
- else if (*data == cShortint)
- data += 3;
- else
- data++;
- } else if (*data >= 247 && *data <= 254) // push medium number
- data += 2;
- else // 255: push huge number
- data += 5;
+ if (*data >= 32 && *data <= 246) // push small number
+ data++;
+ else if (*data < 32) { // a command
+ if (*data == cEscape)
+ data += 2;
+ else if (*data == cShortint)
+ data += 3;
+ else
+ data++;
+ } else if (*data >= 247 && *data <= 254) // push medium number
+ data += 2;
+ else // 255: push huge number
+ data += 5;
}
const uint8_t *odata = Type1Charstring::data();
@@ -240,19 +240,19 @@ void
Type1Charstring::assign_substring(int pos, int len, const String &cs)
{
if (_key >= 0)
- decrypt();
+ decrypt();
if (pos < 0 || len < 0 || pos + len >= _s.length())
- /* do nothing */;
+ /* do nothing */;
else if (cs.length() == len) {
- char *d = _s.mutable_data();
- memcpy(d + pos, cs.data(), cs.length());
+ char *d = _s.mutable_data();
+ memcpy(d + pos, cs.data(), cs.length());
} else if (cs.length() <= len) {
- char *d = _s.mutable_data();
- memcpy(d + pos, cs.data(), cs.length());
- memmove(d + pos + cs.length(), d + pos + len, _s.length() - pos - len);
- _s = _s.substring(0, cs.length() - len);
+ char *d = _s.mutable_data();
+ memcpy(d + pos, cs.data(), cs.length());
+ memmove(d + pos + cs.length(), d + pos + len, _s.length() - pos - len);
+ _s = _s.substring(0, cs.length() - len);
} else
- _s = _s.substring(0, pos) + cs + _s.substring(pos + len);
+ _s = _s.substring(0, pos) + cs + _s.substring(pos + len);
}
@@ -263,61 +263,61 @@ Type2Charstring::process(CharstringInterp &interp) const
int left = _s.length();
while (left > 0) {
- bool more;
- int ahead;
-
- if (*data >= 32 && *data <= 246) { // push small number
- more = interp.number(data[0] - 139);
- ahead = 1;
-
- } else if (*data < 32) { // a command
- if (*data == cEscape) {
- if (left < 2)
- goto runoff_error;
- more = interp.type2_command(cEscapeDelta + data[1], 0, 0);
- ahead = 2;
- } else if (*data == cShortint) { // short integer
- if (left < 3)
- goto runoff_error;
- int16_t val = (data[1] << 8) | data[2];
- more = interp.number(val);
- ahead = 3;
- } else if (*data == cHintmask || *data == cCntrmask) {
- int left_ptr = left - 1;
- more = interp.type2_command(data[0], data + 1, &left_ptr);
- ahead = 1 + (left - 1) - left_ptr;
- } else {
- more = interp.type2_command(data[0], 0, 0);
- ahead = 1;
- }
-
- } else if (*data >= 247 && *data <= 250) { // push medium number
- if (left < 2)
- goto runoff_error;
- int val = + ((data[0] - 247) << 8) + 108 + data[1];
- more = interp.number(val);
- ahead = 2;
-
- } else if (*data >= 251 && *data <= 254) { // push negative medium number
- if (left < 2)
- goto runoff_error;
- int val = - ((data[0] - 251) << 8) - 108 - data[1];
- more = interp.number(val);
- ahead = 2;
-
- } else { // 255: push huge number
- if (left < 5)
- goto runoff_error;
- int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
- more = interp.number(val / 65536.);
- ahead = 5;
- }
-
- if (!more)
- return interp.error() == CharstringInterp::errOK;
-
- data += ahead;
- left -= ahead;
+ bool more;
+ int ahead;
+
+ if (*data >= 32 && *data <= 246) { // push small number
+ more = interp.number(data[0] - 139);
+ ahead = 1;
+
+ } else if (*data < 32) { // a command
+ if (*data == cEscape) {
+ if (left < 2)
+ goto runoff_error;
+ more = interp.type2_command(cEscapeDelta + data[1], 0, 0);
+ ahead = 2;
+ } else if (*data == cShortint) { // short integer
+ if (left < 3)
+ goto runoff_error;
+ int16_t val = (data[1] << 8) | data[2];
+ more = interp.number(val);
+ ahead = 3;
+ } else if (*data == cHintmask || *data == cCntrmask) {
+ int left_ptr = left - 1;
+ more = interp.type2_command(data[0], data + 1, &left_ptr);
+ ahead = 1 + (left - 1) - left_ptr;
+ } else {
+ more = interp.type2_command(data[0], 0, 0);
+ ahead = 1;
+ }
+
+ } else if (*data >= 247 && *data <= 250) { // push medium number
+ if (left < 2)
+ goto runoff_error;
+ int val = + ((data[0] - 247) << 8) + 108 + data[1];
+ more = interp.number(val);
+ ahead = 2;
+
+ } else if (*data >= 251 && *data <= 254) { // push negative medium number
+ if (left < 2)
+ goto runoff_error;
+ int val = - ((data[0] - 251) << 8) - 108 - data[1];
+ more = interp.number(val);
+ ahead = 2;
+
+ } else { // 255: push huge number
+ if (left < 5)
+ goto runoff_error;
+ int32_t val = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4];
+ more = interp.number(val / 65536.);
+ ahead = 5;
+ }
+
+ if (!more)
+ return interp.error() == CharstringInterp::errOK;
+
+ data += ahead;
+ left -= ahead;
}
runoff_error:
@@ -350,7 +350,7 @@ CharstringProgram::glyph_names(Vector<PermString> &gnames) const
int n = nglyphs();
gnames.resize(n);
for (int i = 0; i < n; i++)
- gnames[i] = glyph_name(i);
+ gnames[i] = glyph_name(i);
}
Vector<double> *
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1csgen.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1csgen.cc
index b24c8f21307..392c4bf7873 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1csgen.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1csgen.cc
@@ -48,9 +48,9 @@ static const char * const command_desc[] = {
Type1CharstringGen::Type1CharstringGen(int precision)
{
if (precision >= 1 && precision <= 107)
- _precision = precision;
+ _precision = precision;
else
- _precision = 5;
+ _precision = 5;
_f_precision = _precision;
clear();
}
@@ -71,30 +71,30 @@ Type1CharstringGen::gen_rational(int big_val, int divisor)
int val = (frac == 0 ? big_val / divisor : big_val);
if (val >= -107 && val <= 107)
- _ncs.append((char)(val + 139));
+ _ncs.append((char)(val + 139));
else if (val >= -1131 && val <= 1131) {
- int base = val < 0 ? 251 : 247;
- if (val < 0) val = -val;
- val -= 108;
- int w = val % 256;
- val = (val - w) / 256;
- _ncs.append((char)(val + base));
- _ncs.append((char)w);
+ int base = val < 0 ? 251 : 247;
+ if (val < 0) val = -val;
+ val -= 108;
+ int w = val % 256;
+ val = (val - w) / 256;
+ _ncs.append((char)(val + base));
+ _ncs.append((char)w);
} else {
- _ncs.append('\377');
- long l = val;
- _ncs.append((char)((l >> 24) & 0xFF));
- _ncs.append((char)((l >> 16) & 0xFF));
- _ncs.append((char)((l >> 8) & 0xFF));
- _ncs.append((char)((l >> 0) & 0xFF));
+ _ncs.append('\377');
+ long l = val;
+ _ncs.append((char)((l >> 24) & 0xFF));
+ _ncs.append((char)((l >> 16) & 0xFF));
+ _ncs.append((char)((l >> 8) & 0xFF));
+ _ncs.append((char)((l >> 0) & 0xFF));
}
if (frac != 0) {
- _ncs.append((char)(divisor + 139));
- _ncs.append((char)Charstring::cEscape);
- _ncs.append((char)(Charstring::cDiv - Charstring::cEscapeDelta));
+ _ncs.append((char)(divisor + 139));
+ _ncs.append((char)Charstring::cEscape);
+ _ncs.append((char)(Charstring::cDiv - Charstring::cEscapeDelta));
}
}
@@ -103,19 +103,19 @@ Type1CharstringGen::gen_number(double float_val, int kind)
{
switch (kind) {
case 'x':
- _true.x += float_val;
- float_val = _true.x - _false.x;
- break;
+ _true.x += float_val;
+ float_val = _true.x - _false.x;
+ break;
case 'y':
- _true.y += float_val;
- float_val = _true.y - _false.y;
- break;
+ _true.y += float_val;
+ float_val = _true.y - _false.y;
+ break;
case 'X':
- _true.x = float_val;
- break;
+ _true.x = float_val;
+ break;
case 'Y':
- _true.y = float_val;
- break;
+ _true.y = float_val;
+ break;
}
// 30.Jul.2003 - Avoid rounding differences between platforms with the
@@ -127,17 +127,17 @@ Type1CharstringGen::gen_number(double float_val, int kind)
float_val = big_val / _f_precision;
switch (kind) {
case 'x':
- _false.x += float_val;
- break;
+ _false.x += float_val;
+ break;
case 'y':
- _false.y += float_val;
- break;
+ _false.y += float_val;
+ break;
case 'X':
- _false.x = float_val;
- break;
+ _false.x = float_val;
+ break;
case 'Y':
- _false.y = float_val;
- break;
+ _false.y = float_val;
+ break;
}
}
@@ -146,14 +146,14 @@ void
Type1CharstringGen::gen_command(int command)
{
if (command >= Charstring::cEscapeDelta) {
- _ncs.append((char)Charstring::cEscape);
- _ncs.append((char)(command - Charstring::cEscapeDelta));
- if (command != Charstring::cSbw)
- _state = S_GEN;
+ _ncs.append((char)Charstring::cEscape);
+ _ncs.append((char)(command - Charstring::cEscapeDelta));
+ if (command != Charstring::cSbw)
+ _state = S_GEN;
} else {
- _ncs.append((char)command);
- if (command > Charstring::cVmoveto && command != Charstring::cHsbw)
- _state = S_GEN;
+ _ncs.append((char)command);
+ if (command > Charstring::cVmoveto && command != Charstring::cHsbw)
+ _state = S_GEN;
}
}
@@ -163,31 +163,31 @@ Type1CharstringGen::gen_stem3_stack(CharstringInterp &interp)
// special handling to ensure rounding doesn't generate an invalid stem3
// hint
if (interp.size() < 6)
- return false;
+ return false;
// sort hints
int i0, i1, i2;
if (interp.at(0) > interp.at(2))
- i0 = 2, i1 = 0;
+ i0 = 2, i1 = 0;
else
- i0 = 0, i1 = 2;
+ i0 = 0, i1 = 2;
if (interp.at(4) < interp.at(i0))
- i2 = i1, i1 = i0, i0 = 4;
+ i2 = i1, i1 = i0, i0 = 4;
else if (interp.at(4) < interp.at(i1))
- i2 = i1, i1 = 4;
+ i2 = i1, i1 = 4;
else
- i2 = 4;
+ i2 = 4;
// check constraints. count "almost equal" as equal
double stemw0 = interp.at(i0+1), stemw2 = interp.at(i2+1);
if ((int)(1024*(stemw0 - stemw2) + .5) != 0)
- return false;
+ return false;
double c0 = interp.at(i0) + interp.at(i0+1)/2;
double c1 = interp.at(i1) + interp.at(i1+1)/2;
double c2 = interp.at(i2) + interp.at(i2+1)/2;
if ((int)(1024*((c1 - c0) - (c2 - c1)) + .5) != 0)
- return false;
+ return false;
// if all constraints are satisfied now, make sure they are also satisfied
// after rounding
@@ -201,9 +201,9 @@ Type1CharstringGen::gen_stem3_stack(CharstringInterp &interp)
gen_rational(big_v0, _precision);
gen_rational(big_stemw0, _precision);
if (big_v1_times2 % 2)
- gen_rational(big_v1_times2, 2 * _precision);
+ gen_rational(big_v1_times2, 2 * _precision);
else
- gen_rational(big_v1_times2 / 2, _precision);
+ gen_rational(big_v1_times2 / 2, _precision);
gen_rational(big_stemw1, _precision);
gen_rational(big_v2, _precision);
gen_rational(big_stemw0, _precision);
@@ -217,14 +217,14 @@ Type1CharstringGen::gen_stack(CharstringInterp &interp, int for_cmd)
{
const char *str = ((unsigned)for_cmd <= Charstring::cLastCommand ? command_desc[for_cmd] : (const char *)0);
if ((for_cmd == Charstring::cHstem3 || for_cmd == Charstring::cVstem3)
- && gen_stem3_stack(interp))
- return;
+ && gen_stem3_stack(interp))
+ return;
int i;
for (i = 0; str && *str && i < interp.size(); i++, str++)
- gen_number(interp.at(i), *str);
+ gen_number(interp.at(i), *str);
for (; i < interp.size(); i++)
- gen_number(interp.at(i));
+ gen_number(interp.at(i));
interp.clear();
}
@@ -238,21 +238,21 @@ Type1CharstringGen::gen_moveto(const Point &p, bool closepath, bool always)
int big_dy = (int)floor(d.y * _f_precision + 0.50001);
if (big_dx == 0 && big_dy == 0 && _state != S_INITIAL && !always)
- /* do nothing */;
+ /* do nothing */;
else {
- if (closepath)
- gen_command(Charstring::cClosepath);
- if (big_dy == 0) {
- gen_number(d.x, 'x');
- gen_command(Charstring::cHmoveto);
- } else if (big_dx == 0) {
- gen_number(d.y, 'y');
- gen_command(Charstring::cVmoveto);
- } else {
- gen_number(d.x, 'x');
- gen_number(d.y, 'y');
- gen_command(Charstring::cRmoveto);
- }
+ if (closepath)
+ gen_command(Charstring::cClosepath);
+ if (big_dy == 0) {
+ gen_number(d.x, 'x');
+ gen_command(Charstring::cHmoveto);
+ } else if (big_dx == 0) {
+ gen_number(d.y, 'y');
+ gen_command(Charstring::cVmoveto);
+ } else {
+ gen_number(d.x, 'x');
+ gen_number(d.y, 'y');
+ gen_command(Charstring::cRmoveto);
+ }
}
_true = p;
@@ -323,17 +323,17 @@ void
Type1CharstringGenInterp::gen_sbw(bool hints_follow)
{
if (!hints_follow && nhints())
- act_hintmask(Cs::cHintmask, 0, nhints());
+ act_hintmask(Cs::cHintmask, 0, nhints());
else if (left_sidebearing().y == 0 && _width.y == 0) {
- gen_number(left_sidebearing().x, 'X');
- gen_number(_width.x);
- gen_command(Cs::cHsbw);
+ gen_number(left_sidebearing().x, 'X');
+ gen_number(_width.x);
+ gen_command(Cs::cHsbw);
} else {
- gen_number(left_sidebearing().x, 'X');
- gen_number(left_sidebearing().y, 'Y');
- gen_number(_width.x);
- gen_number(_width.y);
- gen_command(Cs::cSbw);
+ gen_number(left_sidebearing().x, 'X');
+ gen_number(left_sidebearing().y, 'Y');
+ gen_number(_width.x);
+ gen_number(_width.y);
+ gen_command(Cs::cSbw);
}
_state = S_CLOSED;
}
@@ -348,7 +348,7 @@ void
Type1CharstringGenInterp::act_seac(int, double asb, double adx, double ady, int bchar, int achar)
{
if (_state == S_INITIAL)
- gen_sbw(false);
+ gen_sbw(false);
gen_number(asb);
gen_number(adx);
gen_number(ady);
@@ -371,7 +371,7 @@ void
Type1CharstringGenInterp::act_hstem(int, double pos, double width)
{
if (_state != S_INITIAL && !_in_hr)
- swap_stem_hints();
+ swap_stem_hints();
_stem_pos.push_back(pos);
_stem_width.push_back(width);
_stem_hstem.push_back(1);
@@ -381,7 +381,7 @@ void
Type1CharstringGenInterp::act_vstem(int, double pos, double width)
{
if (_state != S_INITIAL && !_in_hr)
- swap_stem_hints();
+ swap_stem_hints();
_stem_pos.push_back(pos);
_stem_width.push_back(width);
_stem_hstem.push_back(0);
@@ -393,14 +393,14 @@ Type1CharstringGenInterp::gen_hints(const unsigned char *data, int nhints) const
_hint_csgen.clear();
unsigned char mask = 0x80;
for (int i = 0; i < nhints; i++) {
- if (*data & mask) {
- double offset = (_stem_hstem[i] ? left_sidebearing().y : left_sidebearing().x);
- _hint_csgen.gen_number(_stem_pos[i] - offset);
- _hint_csgen.gen_number(_stem_width[i]);
- _hint_csgen.gen_command(_stem_hstem[i] ? Cs::cHstem : Cs::cVstem);
- }
- if ((mask >>= 1) == 0)
- data++, mask = 0x80;
+ if (*data & mask) {
+ double offset = (_stem_hstem[i] ? left_sidebearing().y : left_sidebearing().x);
+ _hint_csgen.gen_number(_stem_pos[i] - offset);
+ _hint_csgen.gen_number(_stem_width[i]);
+ _hint_csgen.gen_command(_stem_hstem[i] ? Cs::cHstem : Cs::cVstem);
+ }
+ if ((mask >>= 1) == 0)
+ data++, mask = 0x80;
}
return _hint_csgen.take_string();
}
@@ -409,42 +409,42 @@ void
Type1CharstringGenInterp::act_hintmask(int cmd, const unsigned char *data, int nhints)
{
if (cmd == Cs::cCntrmask || nhints > Type1CharstringGenInterp::nhints())
- return;
+ return;
String data_holder;
if (!data) {
- data_holder = String::make_fill('\377', ((nhints - 1) >> 3) + 1);
- data = data_holder.udata();
+ data_holder = String::make_fill('\377', ((nhints - 1) >> 3) + 1);
+ data = data_holder.udata();
}
String hints = gen_hints(data, nhints);
_in_hr = false;
if (_state == S_INITIAL || _direct_hr) {
- _last_hints = hints;
- if (_state == S_INITIAL)
- gen_sbw(true);
- _csgen.append_charstring(hints);
+ _last_hints = hints;
+ if (_state == S_INITIAL)
+ gen_sbw(true);
+ _csgen.append_charstring(hints);
} else if (_hr_storage && hints != _last_hints) {
- _last_hints = hints;
- hints += (char)(Cs::cReturn);
-
- int subrno = -1, nsubrs = _hr_storage->nsubrs();
- for (int i = _hr_firstsubr; i < nsubrs; i++)
- if (Type1Subr *s = _hr_storage->subr_x(i))
- if (s->t1cs() == hints) {
- subrno = i;
- break;
- }
-
- if (subrno < 0 && _hr_storage->set_subr(nsubrs, Type1Charstring(hints)))
- subrno = nsubrs;
-
- if (subrno >= 0) {
- _csgen.gen_number(subrno);
- _csgen.gen_number(4);
- _csgen.gen_command(Cs::cCallsubr);
- }
+ _last_hints = hints;
+ hints += (char)(Cs::cReturn);
+
+ int subrno = -1, nsubrs = _hr_storage->nsubrs();
+ for (int i = _hr_firstsubr; i < nsubrs; i++)
+ if (Type1Subr *s = _hr_storage->subr_x(i))
+ if (s->t1cs() == hints) {
+ subrno = i;
+ break;
+ }
+
+ if (subrno < 0 && _hr_storage->set_subr(nsubrs, Type1Charstring(hints)))
+ subrno = nsubrs;
+
+ if (subrno >= 0) {
+ _csgen.gen_number(subrno);
+ _csgen.gen_number(4);
+ _csgen.gen_command(Cs::cCallsubr);
+ }
}
}
@@ -452,21 +452,21 @@ void
Type1CharstringGenInterp::act_line(int cmd, const Point &a, const Point &b)
{
if (_state == S_INITIAL)
- gen_sbw(false);
+ gen_sbw(false);
else if (_in_hr)
- act_hintmask(cmd, 0, nhints());
+ act_hintmask(cmd, 0, nhints());
_csgen.gen_moveto(a, _state == S_OPEN, false);
_state = S_OPEN;
if (a.x == b.x) {
- gen_number(b.y - a.y, 'y');
- gen_command(Cs::cVlineto);
+ gen_number(b.y - a.y, 'y');
+ gen_command(Cs::cVlineto);
} else if (a.y == b.y) {
- gen_number(b.x - a.x, 'x');
- gen_command(Cs::cHlineto);
+ gen_number(b.x - a.x, 'x');
+ gen_command(Cs::cHlineto);
} else {
- gen_number(b.x - a.x, 'x');
- gen_number(b.y - a.y, 'y');
- gen_command(Cs::cRlineto);
+ gen_number(b.x - a.x, 'x');
+ gen_number(b.y - a.y, 'y');
+ gen_command(Cs::cRlineto);
}
}
@@ -474,31 +474,31 @@ void
Type1CharstringGenInterp::act_curve(int cmd, const Point &a, const Point &b, const Point &c, const Point &d)
{
if (_state == S_INITIAL)
- gen_sbw(false);
+ gen_sbw(false);
else if (_in_hr)
- act_hintmask(cmd, 0, nhints());
+ act_hintmask(cmd, 0, nhints());
_csgen.gen_moveto(a, _state == S_OPEN, false);
_state = S_OPEN;
if (b.y == a.y && d.x == c.x) {
- gen_number(b.x - a.x, 'x');
- gen_number(c.x - b.x, 'x');
- gen_number(c.y - b.y, 'y');
- gen_number(d.y - c.y, 'y');
- gen_command(Cs::cHvcurveto);
+ gen_number(b.x - a.x, 'x');
+ gen_number(c.x - b.x, 'x');
+ gen_number(c.y - b.y, 'y');
+ gen_number(d.y - c.y, 'y');
+ gen_command(Cs::cHvcurveto);
} else if (b.x == a.x && d.y == c.y) {
- gen_number(b.y - a.y, 'y');
- gen_number(c.x - a.x, 'x');
- gen_number(c.y - b.y, 'y');
- gen_number(d.x - c.x, 'x');
- gen_command(Cs::cVhcurveto);
+ gen_number(b.y - a.y, 'y');
+ gen_number(c.x - a.x, 'x');
+ gen_number(c.y - b.y, 'y');
+ gen_number(d.x - c.x, 'x');
+ gen_command(Cs::cVhcurveto);
} else {
- gen_number(b.x - a.x, 'x');
- gen_number(b.y - a.y, 'y');
- gen_number(c.x - b.x, 'x');
- gen_number(c.y - b.y, 'y');
- gen_number(d.x - c.x, 'x');
- gen_number(d.y - c.y, 'y');
- gen_command(Cs::cRrcurveto);
+ gen_number(b.x - a.x, 'x');
+ gen_number(b.y - a.y, 'y');
+ gen_number(c.x - b.x, 'x');
+ gen_number(c.y - b.y, 'y');
+ gen_number(d.x - c.x, 'x');
+ gen_number(d.y - c.y, 'y');
+ gen_command(Cs::cRrcurveto);
}
}
@@ -506,9 +506,9 @@ void
Type1CharstringGenInterp::act_flex(int cmd, const Point &p0, const Point &p1, const Point &p2, const Point &p3_4, const Point &p5, const Point &p6, const Point &p7, double flex_depth)
{
if (_state == S_INITIAL)
- gen_sbw(false);
+ gen_sbw(false);
else if (_in_hr)
- act_hintmask(cmd, 0, nhints());
+ act_hintmask(cmd, 0, nhints());
_csgen.gen_moveto(p0, _state == S_OPEN, false);
_state = S_OPEN;
@@ -518,77 +518,77 @@ Type1CharstringGenInterp::act_flex(int cmd, const Point &p0, const Point &p1, co
// 2. Join point and its neighboring controls must be at an extreme
if (v_ok && p2.x == p3_4.x && p3_4.x == p5.x) {
- double distance = fabs(p3_4.x - p0.x);
- int sign = (p3_4.x < p0.x ? -1 : 1);
- if (sign * (p1.x - p0.x) < 0 || sign * (p1.x - p0.x) > distance
- || sign * (p6.x - p0.x) < 0 || sign * (p6.x - p0.x) > distance)
- v_ok = false;
+ double distance = fabs(p3_4.x - p0.x);
+ int sign = (p3_4.x < p0.x ? -1 : 1);
+ if (sign * (p1.x - p0.x) < 0 || sign * (p1.x - p0.x) > distance
+ || sign * (p6.x - p0.x) < 0 || sign * (p6.x - p0.x) > distance)
+ v_ok = false;
} else
- v_ok = false;
+ v_ok = false;
if (h_ok && p2.y == p3_4.y && p3_4.y == p5.y) {
- double distance = fabs(p3_4.y - p0.y);
- int sign = (p3_4.y < p0.y ? -1 : 1);
- if (sign * (p1.y - p0.y) < 0 || sign * (p1.y - p0.y) > distance
- || sign * (p6.y - p0.y) < 0 || sign * (p6.y - p0.y) > distance)
- h_ok = false;
+ double distance = fabs(p3_4.y - p0.y);
+ int sign = (p3_4.y < p0.y ? -1 : 1);
+ if (sign * (p1.y - p0.y) < 0 || sign * (p1.y - p0.y) > distance
+ || sign * (p6.y - p0.y) < 0 || sign * (p6.y - p0.y) > distance)
+ h_ok = false;
} else
- h_ok = false;
+ h_ok = false;
// 3. Flex height <= 20
if (v_ok && fabs(p3_4.x - p0.x) > 20)
- v_ok = false;
+ v_ok = false;
if (h_ok && fabs(p3_4.y - p0.y) > 20)
- h_ok = false;
+ h_ok = false;
// generate flex commands
if (v_ok || h_ok) {
- Point p_reference = (h_ok ? Point(p3_4.x, p0.y) : Point(p0.x, p3_4.y));
+ Point p_reference = (h_ok ? Point(p3_4.x, p0.y) : Point(p0.x, p3_4.y));
- _csgen.gen_number(1);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_number(1);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p_reference, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p_reference, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p1, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p1, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p2, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p2, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p3_4, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p3_4, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p5, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p5, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p6, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p6, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_moveto(p7, false, true);
- _csgen.gen_number(2);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_moveto(p7, false, true);
+ _csgen.gen_number(2);
+ _csgen.gen_command(Cs::cCallsubr);
- _csgen.gen_number(flex_depth);
- _csgen.gen_number(p7.x, 'X');
- _csgen.gen_number(p7.y, 'Y');
- _csgen.gen_number(0);
- _csgen.gen_command(Cs::cCallsubr);
+ _csgen.gen_number(flex_depth);
+ _csgen.gen_number(p7.x, 'X');
+ _csgen.gen_number(p7.y, 'Y');
+ _csgen.gen_number(0);
+ _csgen.gen_command(Cs::cCallsubr);
- double flex_height = fabs(h_ok ? p3_4.y - p0.y : p3_4.x - p0.x);
- if (flex_height > _max_flex_height)
- _max_flex_height = flex_height;
+ double flex_height = fabs(h_ok ? p3_4.y - p0.y : p3_4.x - p0.x);
+ if (flex_height > _max_flex_height)
+ _max_flex_height = flex_height;
} else {
- _bad_flex = true;
- act_curve(cmd, p0, p1, p2, p3_4);
- act_curve(cmd, p3_4, p5, p6, p7);
+ _bad_flex = true;
+ act_curve(cmd, p0, p1, p2, p3_4);
+ act_curve(cmd, p3_4, p5, p6, p7);
}
}
@@ -596,7 +596,7 @@ void
Type1CharstringGenInterp::act_closepath(int cmd)
{
if (_in_hr)
- act_hintmask(cmd, 0, nhints());
+ act_hintmask(cmd, 0, nhints());
gen_command(Cs::cClosepath);
_state = S_CLOSED;
}
@@ -621,11 +621,11 @@ Type1CharstringGenInterp::run(const CharstringContext &g, Type1Charstring &out)
CharstringInterp::interpret(g);
if (_state == S_INITIAL)
- gen_sbw(false);
+ gen_sbw(false);
else if (_in_hr)
- act_hintmask(Cs::cEndchar, 0, nhints());
+ act_hintmask(Cs::cEndchar, 0, nhints());
if (_state != S_SEAC)
- _csgen.gen_command(Cs::cEndchar);
+ _csgen.gen_command(Cs::cEndchar);
_csgen.output(out);
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1font.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1font.cc
new file mode 100644
index 00000000000..35ceca72489
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1font.cc
@@ -0,0 +1,916 @@
+// -*- related-file-name: "../include/efont/t1font.hh" -*-
+
+/* t1font.{cc,hh} -- Type 1 font
+ *
+ * Copyright (c) 1998-2014 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/t1font.hh>
+#include <efont/t1item.hh>
+#include <efont/t1rw.hh>
+#include <efont/t1mm.hh>
+#include <lcdf/error.hh>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+namespace Efont {
+
+static PermString::Initializer initializer;
+static PermString lenIV_str = "lenIV";
+static PermString FontInfo_str = "FontInfo";
+
+Type1Font::Type1Font(PermString name)
+ : CharstringProgram(1000),
+ _cached_defs(false), _built(true), _font_name(name), _glyph_map(-1),
+ _encoding(0), _cached_mmspace(0), _mmspace(0), _synthetic_item(0)
+{
+ _dict = new HashMap<PermString, Type1Definition *>[dLast];
+ for (int i = 0; i < dLast; i++) {
+ _index[i] = -1;
+ _dict_deltas[i] = 0;
+ _dict[i].set_default_value((Type1Definition *)0);
+ }
+}
+
+Type1Font::Type1Font(Type1Reader &reader)
+ : CharstringProgram(1000),
+ _cached_defs(false), _built(false), _glyph_map(-1), _encoding(0),
+ _cached_mmspace(0), _mmspace(0), _synthetic_item(0)
+{
+ _dict = new HashMap<PermString, Type1Definition *>[dLast];
+ for (int i = 0; i < dLast; i++) {
+ _index[i] = -1;
+ _dict_deltas[i] = 0;
+ _dict[i].set_default_value((Type1Definition *)0);
+ }
+ read(reader);
+}
+
+Type1Font::~Type1Font()
+{
+ delete[] _dict;
+ for (int i = 0; i < _items.size(); i++)
+ delete _items[i];
+ delete _mmspace;
+ for (int i = 0; i < _subrs.size(); i++)
+ delete _subrs[i];
+ if (!_synthetic_item)
+ for (int i = 0; i < _glyphs.size(); i++)
+ delete _glyphs[i];
+}
+
+void
+Type1Font::set_item(int i, Type1Item *it)
+{
+ delete _items[i];
+ _items[i] = it;
+}
+
+static const char * const dict_starters[] = {
+ "0 dict begin", "/FontInfo 0 dict dup begin", "dup /Private 0 dict dup begin", "/Blend 0 dict dup begin", 0, 0
+};
+
+void
+Type1Font::add_definition(int dict, Type1Definition *t1d)
+{
+ if (_index[dict] < 0) {
+ if (_built && dict_starters[dict])
+ add_item(new Type1CopyItem(dict_starters[dict]));
+ _index[dict] = _items.size();
+ }
+ add_item(t1d);
+ set_dict(dict, t1d->name(), t1d);
+}
+
+void
+Type1Font::add_type1_encoding(Type1Encoding *e)
+{
+ if (_encoding) {
+ for (Type1Item** t1i = _items.begin(); t1i < _items.end(); t1i++)
+ if (*t1i == _encoding) {
+ delete _encoding;
+ *t1i = _encoding = e;
+ return;
+ }
+ }
+ _encoding = e;
+ add_item(e);
+}
+
+void
+Type1Font::add_glyph(Type1Subr *s)
+{
+ int &g = _glyph_map.find_force(s->name(), _glyphs.size());
+ if (g == _glyphs.size())
+ _glyphs.push_back(s);
+ else {
+ delete _glyphs[g];
+ _glyphs[g] = s;
+ }
+}
+
+int
+Type1Font::read(Type1Reader &reader)
+{
+ Dict cur_dict = dFont;
+ int eexec_state = 0;
+ bool have_subrs = false;
+ bool have_charstrings = false;
+ int lenIV = 4;
+ Type1SubrGroupItem *cur_group = 0;
+ int cur_group_count = 0;
+
+ StringAccum accum;
+ while (reader.next_line(accum)) {
+
+ // check for NULL STRING
+ int x_length = accum.length();
+ if (!x_length)
+ continue;
+ const char *x = accum.c_str(); // ensure we don't run off the string
+
+ // check for CHARSTRINGS
+ if (reader.was_charstring()) {
+ Type1Subr *fcs = Type1Subr::make(x, x_length, reader.charstring_start(), reader.charstring_length(), lenIV);
+
+ if (fcs->is_subr()) {
+ if (fcs->subrno() >= _subrs.size())
+ _subrs.resize(fcs->subrno() + 30, (Type1Subr *)0);
+ if (_subrs[fcs->subrno()]) // hybrid font program
+ delete _subrs[fcs->subrno()];
+ _subrs[fcs->subrno()] = fcs;
+ if (!have_subrs && _items.size()) {
+ if (Type1CopyItem *item = _items.back()->cast_copy()) {
+ cur_group = new Type1SubrGroupItem
+ (this, true, item->value());
+ cur_group_count = 0;
+ _items.back() = cur_group;
+ delete item;
+ }
+ have_subrs = true;
+ }
+
+ } else {
+ add_glyph(fcs);
+ if (!have_charstrings && _items.size()) {
+ if (Type1CopyItem *item = _items.back()->cast_copy()) {
+ cur_group = new Type1SubrGroupItem
+ (this, false, item->value());
+ cur_group_count = 0;
+ _items.back() = cur_group;
+ delete item;
+ }
+ have_charstrings = true;
+ }
+ }
+
+ accum.clear();
+ continue;
+ }
+
+ // check for COMMENTS
+ if (x[0] == '%') {
+ add_item(new Type1CopyItem(accum.take_string()));
+ continue;
+ }
+
+ // check for CHARSTRING START
+ // 5/29/1999: beware of charstring start-like things that don't have
+ // `readstring' in them!
+ if (!_charstring_definer
+ && strstr(x, "string currentfile") != 0
+ && strstr(x, "readstring") != 0) {
+ const char *sb = x;
+ while (*sb && *sb != '/')
+ sb++;
+ const char *se = sb + 1;
+ while (*sb && *se && *se != ' ' && *se != '{')
+ se++;
+ if (*sb && *se) {
+ _charstring_definer = permprintf(" %*s ", se - sb - 1, sb + 1);
+ reader.set_charstring_definer(_charstring_definer);
+ add_item(new Type1CopyItem(accum.take_string()));
+ continue;
+ }
+ }
+
+ // check for ENCODING
+ if (!_encoding && strncmp(x, "/Encoding ", 10) == 0) {
+ read_encoding(reader, x + 10);
+ accum.clear();
+ continue;
+ }
+
+ // check for a DEFINITION
+ if (x[0] == '/') {
+ definition_succeed:
+ Type1Definition *t1d = Type1Definition::make(accum, &reader);
+ if (!t1d)
+ goto definition_fail;
+ if (t1d->name() == lenIV_str)
+ t1d->value_int(lenIV);
+ add_definition(cur_dict, t1d);
+ accum.clear();
+ continue;
+ } else if (x[0] == ' ') {
+ const char *y;
+ for (y = x; y[0] == ' '; y++)
+ ;
+ if (y[0] == '/')
+ goto definition_succeed;
+ }
+
+ definition_fail:
+
+ // check for ZEROS special case
+ if (eexec_state == 2) {
+ // In eexec_state 2 (right after turning off eexec), the opening
+ // part of the string will have some 0 bytes followed by '0's.
+ // Change the 0 bytes into textual '0's.
+ int zeros = 0;
+ while (x[zeros] == 0 && x_length > 0)
+ zeros++, x_length--;
+ add_item(new Type1CopyItem(String::make_fill('0', zeros * 2 + x_length)));
+ eexec_state = 3;
+ accum.clear();
+ continue;
+ }
+
+ // check for MODIFIED FONT
+ if (eexec_state == 1 && strstr(x, "FontDirectory") != 0
+ && read_synthetic_font(reader, x, accum)) {
+ accum.clear();
+ continue;
+ }
+
+ // check for END-OF-CHARSTRING-GROUP TEXT
+ if (cur_group) {
+ if (cur_group_count == 0
+ || ((strstr(x, "end") != 0 || strstr(x, "put") != 0)
+ && strchr(x, '/') == 0)) {
+ cur_group->add_end_text(x);
+ cur_group_count++;
+ accum.clear();
+ continue;
+ }
+ cur_group = 0;
+ }
+
+ // add COPY ITEM
+ String s = accum.take_string();
+ add_item(new Type1CopyItem(s));
+ x = s.data();
+
+ if (eexec_state == 0 && strncmp(x, "currentfile eexec", 17) == 0 && (isspace((unsigned char) x[17]) || !x[17])) {
+ // allow arbitrary whitespace after "currentfile eexec".
+ // note: strlen("currentfile eexec") == 17
+ for (x += 17; isspace((unsigned char) *x); x++)
+ /* nada */;
+ reader.switch_eexec(true, (unsigned char *)x, (s.data() + s.length()) - x);
+ set_item(nitems() - 1, new Type1EexecItem(true));
+ eexec_state = 1;
+ } else if (eexec_state == 1 && strstr(x, "currentfile closefile") != 0) {
+ reader.switch_eexec(false, 0, 0);
+ add_item(new Type1EexecItem(false));
+ eexec_state = 2;
+ } else if (strstr(x, "begin") != 0) {
+ // 30.Sep.2002: NuevaMM's BlendFontInfo dict starts with a simple
+ // "/FontInfo ... begin" inside a "/Blend ... begin".
+ Dict was_dict = cur_dict;
+ if (strstr(x, "/Private") != 0)
+ cur_dict = dPrivate;
+ else if (strstr(x, "/FontInfo") != 0)
+ cur_dict = dFontInfo;
+ else
+ cur_dict = dFont;
+ if (strstr(x, "/Blend") != 0)
+ cur_dict = (Dict)(cur_dict + dBlend);
+ else if (was_dict == dBlend && cur_dict == dFontInfo)
+ cur_dict = (Dict)(cur_dict + dBlend);
+ } else if (cur_dict == dFontInfo && strstr(x, "end") != 0)
+ cur_dict = dFont;
+ }
+
+ // set dictionary deltas
+ for (int i = dFI; i < dLast; i++)
+ _dict_deltas[i] = get_dict_size(i) - _dict[i].size();
+ // borrow glyphs and glyph map from _synthetic_item
+ if (!_glyphs.size() && _synthetic_item) {
+ _glyphs = _synthetic_item->included_font()->_glyphs;
+ _glyph_map = _synthetic_item->included_font()->_glyph_map;
+ }
+
+ return (ok() ? 0 : -1);
+}
+
+bool
+Type1Font::ok() const
+{
+ return font_name() && _glyphs.size() > 0;
+}
+
+static char *skip_comment_space(char *s)
+{
+ while (1) {
+ if (isspace((unsigned char) *s))
+ ++s;
+ else if (*s == '%') {
+ for (++s; *s != '\r' && *s != '\n' && *s != '\0'; ++s)
+ /* nada */;
+ } else
+ return s;
+ }
+}
+
+void
+Type1Font::read_encoding(Type1Reader &reader, const char *first_line)
+{
+ while (isspace((unsigned char) *first_line))
+ first_line++;
+ if (strncmp(first_line, "StandardEncoding", 16) == 0) {
+ add_type1_encoding(Type1Encoding::standard_encoding());
+ return;
+ }
+
+ add_type1_encoding(new Type1Encoding);
+
+ bool got_any = false;
+ StringAccum accum;
+
+ while (reader.next_line(accum)) {
+
+ // check for NULL STRING
+ if (!accum.length())
+ continue;
+ accum.append('\0'); // ensure we don't run off the string
+ char *pos = accum.data();
+
+ // skip to first `dup' token
+ if (!got_any) {
+ if (!(pos = strstr(pos, "dup"))) {
+ pos = accum.data();
+ goto check_done;
+ }
+ }
+
+ // parse as many `dup INDEX */CHARNAME put' as there are in the line
+ while (1) {
+ // skip spaces, look for `dup '
+ while (isspace((unsigned char) pos[0]))
+ ++pos;
+ if (pos[0] == '%')
+ pos = skip_comment_space(pos);
+ if (pos[0] != 'd' || pos[1] != 'u' || pos[2] != 'p' || !isspace((unsigned char) pos[3]))
+ break;
+
+ // look for `INDEX */'
+ char *scan;
+ int char_value = strtol(pos + 4, &scan, 10);
+ if (scan[0] == '#' && char_value > 0 && char_value < 37
+ && isalnum((unsigned char) scan[1]))
+ char_value = strtol(scan + 1, &scan, char_value);
+ while (isspace((unsigned char) scan[0]))
+ scan++;
+ if (char_value < 0 || char_value >= 256 || scan[0] != '/')
+ break;
+
+ // look for `CHARNAME put'
+ scan++;
+ char *name_pos = scan;
+ while (!isspace((unsigned char) scan[0]) && scan[0] != '\0')
+ ++scan;
+ char *name_end = scan;
+ while (isspace((unsigned char) scan[0]))
+ ++scan;
+ if (scan[0] != 'p' || scan[1] != 'u' || scan[2] != 't')
+ break;
+
+ _encoding->put(char_value, PermString(name_pos, name_end - name_pos));
+ got_any = true;
+ pos = scan + 3;
+ }
+
+ check_done:
+ // check for end of encoding section
+ // if not over, add COPY ITEM for leftovers we didn't parse
+ if ((strstr(pos, "readonly") != 0 || strstr(pos, "def") != 0)
+ && (got_any || strstr(pos, "for") == 0)) {
+ _encoding->set_definer(String(pos));
+ return;
+ } else if (got_any && *pos)
+ add_item(new Type1CopyItem(String(pos)));
+
+ accum.clear();
+ }
+}
+
+static bool
+read_synthetic_string(Type1Reader &reader, StringAccum &wrong_accum,
+ const char *format, int *value)
+{
+ StringAccum accum;
+ if (!reader.next_line(accum))
+ return false;
+ wrong_accum << accum;
+ accum.append('\0'); // ensure we don't run off the string
+ int n = 0;
+ if (value)
+ sscanf(accum.data(), format, value, &n);
+ else
+ sscanf(accum.data(), format, &n);
+ return (n != 0 && (isspace((unsigned char) accum[n]) || accum[n] == '\0'));
+}
+
+bool
+Type1Font::read_synthetic_font(Type1Reader &reader, const char *first_line,
+ StringAccum &wrong_accum)
+{
+ // read font name
+ PermString font_name;
+ {
+ char *x = new char[strlen(first_line) + 1];
+ int n = 0;
+ sscanf(first_line, "FontDirectory /%[^] \t\r\n[{}/] known {%n", x, &n);
+ if (n && (isspace((unsigned char) first_line[n]) || first_line[n] == 0))
+ font_name = x;
+ delete[] x;
+ if (!font_name)
+ return false;
+ }
+
+ // check UniqueID
+ int unique_id;
+ {
+ StringAccum accum;
+ if (!reader.next_line(accum))
+ return false;
+ wrong_accum << accum;
+ accum.c_str(); // ensure we don't run off the string
+ const char *y = accum.data();
+ if (*y != '/' || strncmp(y + 1, font_name.c_str(), font_name.length()) != 0)
+ return false;
+ int n = 0;
+ sscanf(y + font_name.length() + 1, " findfont%n", &n);
+ y = strstr(y, "/UniqueID get ");
+ if (n == 0 || y == 0)
+ return false;
+ n = 0;
+ sscanf(y + 14, "%d%n", &unique_id, &n);
+ if (n == 0)
+ return false;
+ }
+
+ // check lines that say how much text
+ int multiplier;
+ if (!read_synthetic_string(reader, wrong_accum, "save userdict /fbufstr %d string put%n", &multiplier))
+ return false;
+
+ int multiplicand;
+ if (!read_synthetic_string(reader, wrong_accum, "%d {currentfile fbufstr readstring { pop } { clear currentfile%n", &multiplicand))
+ return false;
+
+ if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse } repeat%n", 0))
+ return false;
+
+ int extra;
+ if (!read_synthetic_string(reader, wrong_accum, "currentfile %d string readstring { pop } { clear currentfile%n", &extra))
+ return false;
+
+ if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse%n", 0))
+ return false;
+
+ if (!read_synthetic_string(reader, wrong_accum, "restore } if } if%n", 0))
+ return false;
+
+ Type1SubsetReader subreader(&reader, multiplier*multiplicand + extra);
+ Type1Font *synthetic = new Type1Font(subreader);
+ if (!synthetic->ok())
+ delete synthetic;
+ else {
+ _synthetic_item = new Type1IncludedFont(synthetic, unique_id);
+ add_item(_synthetic_item);
+ }
+ return true;
+}
+
+
+void
+Type1Font::undo_synthetic()
+{
+ // A synthetic font doesn't share arbitrary code with its base font; it
+ // shares just the CharStrings dictionary, according to Adobe Type 1 Font
+ // Format. We take advantage of this.
+
+ if (!_synthetic_item)
+ return;
+
+ int mod_ii;
+ for (mod_ii = nitems() - 1; mod_ii >= 0; mod_ii--)
+ if (_items[mod_ii] == _synthetic_item)
+ break;
+ if (mod_ii < 0)
+ return;
+
+ // remove synthetic item and the reference to the included font
+ _items[mod_ii] = new Type1NullItem;
+ if (Type1CopyItem *copy = _items[mod_ii+1]->cast_copy())
+ if (copy->value().find_left("findfont") >= 0) {
+ delete copy;
+ _items[mod_ii+1] = new Type1NullItem;
+ }
+
+ Type1Font *f = _synthetic_item->included_font();
+ // its glyphs are already stored in our _glyphs array
+
+ // copy SubrGroupItem from `f' into `this'
+ Type1SubrGroupItem *oth_subrs = 0, *oth_glyphs = 0;
+ for (int i = 0; i < f->nitems(); i++)
+ if (Type1SubrGroupItem *subr_grp = f->_items[i]->cast_subr_group()) {
+ if (subr_grp->is_subrs())
+ oth_subrs = subr_grp;
+ else
+ oth_glyphs = subr_grp;
+ }
+
+ assert(oth_glyphs != 0);
+
+ for (int i = nitems() - 1; i >= 0; i--)
+ if (Type1SubrGroupItem *subr_grp = _items[i]->cast_subr_group()) {
+ assert(subr_grp->is_subrs());
+ if (oth_subrs)
+ subr_grp->set_end_text(oth_subrs->end_text());
+ shift_indices(i + 1, 1);
+ Type1SubrGroupItem *nsubr = new Type1SubrGroupItem(*oth_glyphs, this);
+ _items[i + 1] = nsubr;
+ break;
+ }
+
+ // delete included font
+ f->_glyphs.clear(); // don't delete glyphs; we've stolen them
+ delete _synthetic_item;
+ _synthetic_item = 0;
+}
+
+
+Type1Charstring *
+Type1Font::subr(int e) const
+{
+ if (e >= 0 && e < _subrs.size() && _subrs[e])
+ return &_subrs[e]->t1cs();
+ else
+ return 0;
+}
+
+PermString
+Type1Font::glyph_name(int i) const
+{
+ if (i >= 0 && i < _glyphs.size() && _glyphs[i])
+ return _glyphs[i]->name();
+ else
+ return PermString();
+}
+
+Type1Charstring *
+Type1Font::glyph(int i) const
+{
+ if (i >= 0 && i < _glyphs.size() && _glyphs[i])
+ return &_glyphs[i]->t1cs();
+ else
+ return 0;
+}
+
+Type1Charstring *
+Type1Font::glyph(PermString name) const
+{
+ int i = _glyph_map[name];
+ if (i >= 0)
+ return &_glyphs[i]->t1cs();
+ else
+ return 0;
+}
+
+
+bool
+Type1Font::set_subr(int e, const Type1Charstring &t1cs, PermString definer)
+{
+ if (e < 0)
+ return false;
+ if (e >= _subrs.size())
+ _subrs.resize(e + 1, (Type1Subr *)0);
+
+ if (!definer) {
+ Type1Subr *pattern_subr = _subrs[e];
+ for (int i = 0; i < _subrs.size() && !pattern_subr; i++)
+ pattern_subr = _subrs[i];
+ if (!pattern_subr)
+ return false;
+ definer = pattern_subr->definer();
+ }
+
+ delete _subrs[e];
+ _subrs[e] = Type1Subr::make_subr(e, t1cs, definer);
+ return true;
+}
+
+bool
+Type1Font::remove_subr(int e)
+{
+ if (e < 0 || e >= _subrs.size())
+ return false;
+ delete _subrs[e];
+ _subrs[e] = 0;
+ return true;
+}
+
+void
+Type1Font::fill_in_subrs()
+{
+ while (_subrs.size() && _subrs.back() == 0)
+ _subrs.pop_back();
+ for (int i = 0; i < _subrs.size(); i++)
+ if (!_subrs[i])
+ set_subr(i, Type1Charstring(String::make_stable("\013", 1)));
+}
+
+void
+Type1Font::renumber_subrs(const Vector<int> &renumbering)
+{
+ Vector<Type1Subr *> old_subrs;
+ old_subrs.swap(_subrs);
+ for (int i = 0; i < old_subrs.size() && i < renumbering.size(); i++) {
+ int r = renumbering[i];
+ Type1Subr *s = old_subrs[i];
+ if (r >= 0 && s)
+ set_subr(r, s->t1cs(), s->definer());
+ else
+ delete s;
+ }
+ for (int i = renumbering.size(); i < old_subrs.size(); i++)
+ delete old_subrs[i];
+}
+
+
+void
+Type1Font::shift_indices(int move_index, int delta)
+{
+ if (delta > 0) {
+ _items.resize(_items.size() + delta, (Type1Item *)0);
+ memmove(&_items[move_index + delta], &_items[move_index],
+ sizeof(Type1Item *) * (_items.size() - move_index - delta));
+
+ for (int i = dFont; i < dLast; i++)
+ if (_index[i] > move_index)
+ _index[i] += delta;
+
+ } else {
+ memmove(&_items[move_index], &_items[move_index - delta],
+ sizeof(Type1Item *) * (_items.size() - (move_index - delta)));
+ _items.resize(_items.size() + delta);
+
+ for (int i = dFont; i < dLast; i++)
+ if (_index[i] >= move_index) {
+ if (_index[i] < move_index - delta)
+ _index[i] = move_index;
+ else
+ _index[i] += delta;
+ }
+ }
+}
+
+Type1Definition *
+Type1Font::ensure(Dict dict, PermString name)
+{
+ assert(_index[dict] >= 0);
+ Type1Definition *def = _dict[dict][name];
+ if (!def) {
+ def = new Type1Definition(name, 0, "def");
+ int move_index = _index[dict];
+ shift_indices(move_index, 1);
+ _items[move_index] = def;
+ set_dict(dict, name, def);
+ }
+ return def;
+}
+
+void
+Type1Font::add_header_comment(const String &comment)
+{
+ int i;
+ for (i = 0; i < _items.size(); i++) {
+ Type1CopyItem *copy = _items[i]->cast_copy();
+ if (!copy || copy->value()[0] != '%')
+ break;
+ }
+ shift_indices(i, 1);
+ _items[i] = new Type1CopyItem(comment);
+}
+
+
+Type1Item *
+Type1Font::dict_size_item(int d) const
+{
+ switch (d) {
+
+ case dF:
+ if (_built && _index[d] > 0)
+ return _items[_index[d] - 1];
+ break;
+
+ case dFI: case dP: case dB:
+ if (_index[d] > 0)
+ return _items[_index[d] - 1];
+ break;
+
+ case dBFI:
+ if (Type1Item *t1i = b_dict("FontInfo"))
+ return t1i;
+ else if (_index[dBFI] > 0)
+ return _items[_index[dBFI] - 1];
+ break;
+
+ case dBP:
+ if (Type1Item *t1i = b_dict("Private"))
+ return t1i;
+ else if (_index[dBP] > 0)
+ return _items[_index[dBP] - 1];
+ break;
+
+ }
+ return 0;
+}
+
+int
+Type1Font::get_dict_size(int d) const
+{
+ Type1Item *item = dict_size_item(d);
+ if (!item)
+ /* nada */;
+ else if (Type1Definition *t1d = item->cast_definition()) {
+ int num;
+ if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num))
+ return num;
+ } else if (Type1CopyItem *copy = item->cast_copy()) {
+ String value = copy->value();
+ int pos = value.find_left(" dict");
+ if (pos >= 1 && isdigit((unsigned char) value[pos - 1])) {
+ while (pos >= 1 && isdigit((unsigned char) value[pos - 1]))
+ pos--;
+ return strtol(value.data() + pos, 0, 10);
+ }
+ }
+ return -1;
+}
+
+void
+Type1Font::set_dict_size(int d, int size)
+{
+ Type1Item *item = dict_size_item(d);
+ if (!item)
+ return;
+ if (Type1Definition *t1d = item->cast_definition()) {
+ int num;
+ if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num))
+ t1d->set_int(size);
+ } else if (Type1CopyItem *copy = item->cast_copy()) {
+ String value = copy->value();
+ int pos = value.find_left(" dict");
+ if (pos >= 1 && isdigit((unsigned char) value[pos - 1])) {
+ int numpos = pos - 1;
+ while (numpos >= 1 && isdigit((unsigned char) value[numpos - 1]))
+ numpos--;
+ StringAccum accum;
+ accum << value.substring(0, numpos) << size << value.substring(pos);
+ copy->set_value(accum.take_string());
+ }
+ }
+}
+
+void
+Type1Font::write(Type1Writer &w)
+{
+ Type1Definition *lenIV_def = p_dict("lenIV");
+ int lenIV = 4;
+ if (lenIV_def)
+ lenIV_def->value_int(lenIV);
+ w.set_charstring_start(_charstring_definer);
+ w.set_lenIV(lenIV);
+
+ // change dict sizes
+ for (int i = dF; i < dLast; i++)
+ set_dict_size(i, _dict[i].size() + _dict_deltas[i]);
+ // XXX what if dict had nothing, but now has something?
+
+ for (int i = 0; i < _items.size(); i++)
+ _items[i]->gen(w);
+
+ w.flush();
+}
+
+void
+Type1Font::cache_defs() const
+{
+ Type1Definition *t1d = dict("FontName");
+ if (t1d)
+ t1d->value_name(_font_name);
+ _cached_defs = true;
+}
+
+MultipleMasterSpace *
+Type1Font::mmspace() const
+{
+ if (!_cached_mmspace)
+ create_mmspace();
+ return _mmspace;
+}
+
+MultipleMasterSpace *
+Type1Font::create_mmspace(ErrorHandler *errh) const
+{
+ if (_cached_mmspace)
+ return _mmspace;
+ _cached_mmspace = 1;
+
+ Type1Definition *t1d;
+
+ Vector< Vector<double> > master_positions;
+ t1d = fi_dict("BlendDesignPositions");
+ if (!t1d || !t1d->value_numvec_vec(master_positions))
+ return 0;
+
+ int nmasters = master_positions.size();
+ if (nmasters <= 0) {
+ errh->error("bad BlendDesignPositions");
+ return 0;
+ }
+ int naxes = master_positions[0].size();
+ _mmspace = new MultipleMasterSpace(font_name(), naxes, nmasters);
+ _mmspace->set_master_positions(master_positions);
+
+ Vector< Vector<double> > normalize_in, normalize_out;
+ t1d = fi_dict("BlendDesignMap");
+ if (t1d && t1d->value_normalize(normalize_in, normalize_out))
+ _mmspace->set_normalize(normalize_in, normalize_out);
+
+ Vector<PermString> axis_types;
+ t1d = fi_dict("BlendAxisTypes");
+ if (t1d && t1d->value_namevec(axis_types) && axis_types.size() == naxes)
+ for (int a = 0; a < naxes; a++)
+ _mmspace->set_axis_type(a, axis_types[a]);
+
+ int ndv, cdv;
+ Type1Charstring *cs;
+ t1d = p_dict("NDV");
+ if (t1d && t1d->value_int(ndv) && (cs = subr(ndv)))
+ _mmspace->set_ndv(*cs);
+ t1d = p_dict("CDV");
+ if (t1d && t1d->value_int(cdv) && (cs = subr(cdv)))
+ _mmspace->set_cdv(*cs);
+
+ Vector<double> design_vector;
+ t1d = dict("DesignVector");
+ if (t1d && t1d->value_numvec(design_vector))
+ _mmspace->set_design_vector(design_vector);
+
+ Vector<double> weight_vector;
+ t1d = dict("WeightVector");
+ if (t1d && t1d->value_numvec(weight_vector))
+ _mmspace->set_weight_vector(weight_vector);
+
+ if (!_mmspace->check(errh)) {
+ delete _mmspace;
+ _mmspace = 0;
+ }
+ return _mmspace;
+}
+
+void
+Type1Font::uncache_defs()
+{
+ _cached_defs = false;
+}
+
+void
+Type1Font::font_matrix(double matrix[6]) const
+{
+ Vector<double> t1d_matrix;
+ Type1Definition *t1d = dict("FontMatrix");
+ if (t1d && t1d->value_numvec(t1d_matrix) && t1d_matrix.size() == 6)
+ memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
+ else {
+ matrix[0] = matrix[3] = 0.001;
+ matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
+ }
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1fontskel.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1fontskel.cc
index e5e48023348..f4f9111f2d5 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1fontskel.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1fontskel.cc
@@ -218,7 +218,7 @@ Type1Font::skeleton_make(PermString font_name, const String &version)
StringAccum sa;
sa << "%!PS-AdobeFont-1.0: " << font_name;
if (version)
- sa << ' ' << version;
+ sa << ' ' << version;
output->add_item(new Type1CopyItem(sa.take_string()));
output->_dict_deltas[dF] = 3; // Private, FontInfo, Encoding
@@ -238,9 +238,9 @@ void
Type1Font::skeleton_fontinfo_end()
{
if (first_dict_item(Type1Font::dFI) >= 0)
- add_item(new Type1CopyItem("end readonly def"));
+ add_item(new Type1CopyItem("end readonly def"));
else
- add_item(new Type1CopyItem("% no FontInfo dict"));
+ add_item(new Type1CopyItem("% no FontInfo dict"));
}
void
@@ -311,15 +311,15 @@ add_number_def(Type1Font *output, int dict, PermString name, const Type1Font *fo
{
double v;
if (Type1Definition *t1d = font->dict(dict, name))
- if (t1d->value_num(v))
- output->add_definition(dict, Type1Definition::make(name, v, "def"));
+ if (t1d->value_num(v))
+ output->add_definition(dict, Type1Definition::make(name, v, "def"));
}
static void
add_copy_def(Type1Font *output, int dict, PermString name, const Type1Font *font, const char *definer = "def")
{
if (Type1Definition *t1d = font->dict(dict, name))
- output->add_definition(dict, Type1Definition::make_literal(name, t1d->value(), definer));
+ output->add_definition(dict, Type1Definition::make_literal(name, t1d->value(), definer));
}
static String
@@ -327,8 +327,8 @@ font_dict_string(const Type1Font *font, int dict, PermString name)
{
String s;
if (Type1Definition *d = font->dict(dict, name))
- if (d->value_string(s))
- return s;
+ if (d->value_string(s))
+ return s;
return String();
}
@@ -340,34 +340,34 @@ Type1Font::skeleton_make_copy(const Type1Font *font, PermString font_name, const
// other comments from font header
for (int i = 0; i < font->nitems(); i++)
- if (Type1CopyItem *c = font->item(i)->cast_copy()) {
- if (c->length() > 1 && c->value()[0] == '%') {
- if (c->value()[1] != '!')
- output->add_item(new Type1CopyItem(c->value()));
- } else
- break;
- } else
- break;
+ if (Type1CopyItem *c = font->item(i)->cast_copy()) {
+ if (c->length() > 1 && c->value()[0] == '%') {
+ if (c->value()[1] != '!')
+ output->add_item(new Type1CopyItem(c->value()));
+ } else
+ break;
+ } else
+ break;
output->skeleton_comments_end();
// FontInfo dictionary
if (version)
- output->add_definition(dFI, Type1Definition::make_string("version", version, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("version", version, "readonly def"));
if (String s = font_dict_string(font, dFI, "Notice"))
- output->add_definition(dFI, Type1Definition::make_string("Notice", s, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("Notice", s, "readonly def"));
if (String s = font_dict_string(font, dFI, "Copyright"))
- output->add_definition(dFI, Type1Definition::make_string("Copyright", s, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("Copyright", s, "readonly def"));
if (String s = font_dict_string(font, dFI, "FullName"))
- output->add_definition(dFI, Type1Definition::make_string("FullName", s, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("FullName", s, "readonly def"));
if (String s = font_dict_string(font, dFI, "FamilyName"))
- output->add_definition(dFI, Type1Definition::make_string("FamilyName", s, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("FamilyName", s, "readonly def"));
if (String s = font_dict_string(font, dFI, "Weight"))
- output->add_definition(dFI, Type1Definition::make_string("Weight", s, "readonly def"));
+ output->add_definition(dFI, Type1Definition::make_string("Weight", s, "readonly def"));
if (Type1Definition *t1d = font->fi_dict("isFixedPitch")) {
- bool v;
- if (t1d->value_bool(v))
- output->add_definition(dFI, Type1Definition::make_literal("isFixedPitch", (v ? "true" : "false"), "def"));
+ bool v;
+ if (t1d->value_bool(v))
+ output->add_definition(dFI, Type1Definition::make_literal("isFixedPitch", (v ? "true" : "false"), "def"));
}
add_number_def(output, dFI, "ItalicAngle", font);
add_number_def(output, dFI, "UnderlinePosition", font);
@@ -381,26 +381,26 @@ Type1Font::skeleton_make_copy(const Type1Font *font, PermString font_name, const
add_copy_def(output, dF, "FontMatrix", font, "readonly def");
add_number_def(output, dF, "StrokeWidth", font);
if (!xuid_extension)
- add_number_def(output, dF, "UniqueID", font);
+ add_number_def(output, dF, "UniqueID", font);
add_copy_def(output, dF, "XUID", font, "readonly def");
if (xuid_extension) {
- Vector<double> xuid;
- if (Type1Definition *xuid_def = output->dict("XUID"))
- xuid_def->value_numvec(xuid);
- if (!xuid.size()) {
- Type1Definition *uid_def = font->dict("UniqueID");
- int uid;
- if (uid_def && uid_def->value_int(uid)) {
- xuid.push_back(1);
- xuid.push_back(uid);
- }
- }
- if (xuid.size()) {
- for (int i = 0; i < xuid_extension->size(); i++)
- xuid.push_back((*xuid_extension)[i]);
- Type1Definition *xuid_def = output->ensure(dF, "XUID");
- xuid_def->set_numvec(xuid);
- }
+ Vector<double> xuid;
+ if (Type1Definition *xuid_def = output->dict("XUID"))
+ xuid_def->value_numvec(xuid);
+ if (!xuid.size()) {
+ Type1Definition *uid_def = font->dict("UniqueID");
+ int uid;
+ if (uid_def && uid_def->value_int(uid)) {
+ xuid.push_back(1);
+ xuid.push_back(uid);
+ }
+ }
+ if (xuid.size()) {
+ for (int i = 0; i < xuid_extension->size(); i++)
+ xuid.push_back((*xuid_extension)[i]);
+ Type1Definition *xuid_def = output->ensure(dF, "XUID");
+ xuid_def->set_numvec(xuid);
+ }
}
add_copy_def(output, dF, "FontBBox", font, "readonly def");
output->skeleton_fontdict_end();
@@ -421,7 +421,7 @@ Type1Font::skeleton_make_copy(const Type1Font *font, PermString font_name, const
add_number_def(output, dP, "LanguageGroup", font);
add_number_def(output, dP, "ExpansionFactor", font);
if (!xuid_extension)
- add_number_def(output, dP, "UniqueID", font);
+ add_number_def(output, dP, "UniqueID", font);
output->add_definition(dP, Type1Definition::make_literal("MinFeature", "{16 16}", "|-"));
output->add_definition(dP, Type1Definition::make_literal("password", "5839", "def"));
output->add_definition(dP, Type1Definition::make_literal("lenIV", "0", "def"));
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1interp.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1interp.cc
new file mode 100644
index 00000000000..f56cb6f11df
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1interp.cc
@@ -0,0 +1,1377 @@
+// -*- related-file-name: "../include/efont/t1interp.hh" -*-
+
+/* t1interp.{cc,hh} -- Type 1/2 charstring interpretation
+ *
+ * Copyright (c) 1998-2014 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/t1interp.hh>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#ifdef WIN32
+# define random() rand()
+#endif
+
+#define CHECK_STACK(numargs) do { if (size() < numargs) return error(errUnderflow, cmd); } while (0)
+#define CHECK_STATE() do { if (_state < S_IPATH) return error(errOrdering, cmd); } while (0)
+#define CHECK_PATH_START() do { _state = S_PATH; } while (0)
+#define CHECK_PATH_END() do { if (_state == S_PATH) { act_closepath(cmd); } _state = S_IPATH; } while (0)
+
+#ifndef static_assert
+# define static_assert(c, msg) switch ((int) (c)) case 0: case (c):
+#endif
+
+namespace Efont {
+
+static const char * const error_formats[] = {
+ "charstring OK", // errOK
+ "charstring internal error in '%C'", // errInternal
+ "charstring commands past end", // errRunoff
+ "charstring command '%C' unimplemented", // errUnimplemented
+ "charstring stack overflow", // errOverflow
+ "charstring stack underflow in '%C'", // errUnderflow
+ "charstring bad vector operation in '%C'", // errVector
+ "charstring bad value in '%C'", // errValue
+ "charstring bad subroutine number %d", // errSubr
+ "charstring bad glyph number '%d'", // errGlyph
+ "charstring no current point in '%C'", // errCurrentPoint
+ "charstring flex error", // errFlex
+ "charstring multiple master error in '%C'", // errMultipleMaster
+ "charstring open stroke", // errOpenStroke
+ "charstring late sidebearing command '%C'", // errLateSidebearing
+ "charstring bad othersubr number %d", // errOthersubr
+ "charstring ordering constraints violated at '%C'", // errOrdering
+ "charstring inappropriate hintmask", // errHintmask
+ "charstring subrs nested too deep at '%d'" // errSubrDepth
+};
+
+double CharstringInterp::double_for_error;
+
+
+CharstringInterp::CharstringInterp()
+ : _error(errOK), _careful(false), _sp(0), _ps_sp(0),
+ _scratch_vector(SCRATCH_SIZE, 0), _program(0)
+{
+}
+
+CharstringInterp::CharstringInterp(const Vector<double> &weight_vector)
+ : _error(errOK), _careful(false), _sp(0), _ps_sp(0),
+ _weight_vector(weight_vector),
+ _scratch_vector(SCRATCH_SIZE, 0), _program(0)
+{
+}
+
+void
+CharstringInterp::initialize()
+{
+ clear();
+ ps_clear();
+ _lsb = _cp = _seac_origin = Point(0, 0);
+ _state = S_INITIAL;
+ _flex = false;
+ _t2nhints = 0;
+ _subr_depth = 0;
+ _done = false;
+ _error = errOK;
+}
+
+bool
+CharstringInterp::interpret(const CharstringProgram *program, const Charstring *cs)
+{
+ if (cs) {
+ initialize();
+ _program = program;
+ cs->process(*this);
+ return _error == errOK;
+ } else
+ return error(errGlyph, 0);
+}
+
+bool
+CharstringInterp::error(int err, int error_data)
+{
+ _error = err;
+ _error_data = error_data;
+ return false;
+}
+
+String
+CharstringInterp::error_string(int error, int error_data)
+{
+ static_assert(-errLastError == (sizeof(error_formats) / sizeof(error_formats[0])) - 1,
+ "errLastError defined incorrectly");
+ if (error >= 0)
+ return error_formats[0];
+ else if (error < errLastError)
+ return "charstring unknown error number " + String(error);
+ String format = error_formats[-error];
+ int percent = format.find_left('%');
+ if (percent >= 0 && format[percent + 1] == 'C')
+ return format.substring(0, percent) + Charstring::command_name(error_data) + format.substring(percent + 2);
+ else if (percent >= 0 && format[percent + 1] == 'd')
+ return format.substring(0, percent) + String(error_data) + format.substring(percent + 2);
+ else
+ return format;
+}
+
+bool
+CharstringInterp::number(double v)
+{
+ push(v);
+ return true;
+}
+
+void
+CharstringInterp::fetch_weight_vector()
+{
+ if (_program)
+ if (Vector<double> *wv = _program->mm_vector(CharstringProgram::VEC_WEIGHT, false))
+ _weight_vector = *wv;
+}
+
+bool
+CharstringInterp::vector_command(int cmd)
+{
+ CharstringProgram::VectorType which_vector;
+ int vectoroff, offset, num, i;
+ Vector<double> *v = 0;
+
+ switch (cmd) {
+
+ case Cs::cPut:
+ CHECK_STACK(2);
+ offset = (int)top(0);
+ vec(&_scratch_vector, offset) = top(1);
+ pop(2);
+ break;
+
+ case Cs::cGet:
+ CHECK_STACK(1);
+ offset = (int)top();
+ top() = vec(&_scratch_vector, offset);
+ break;
+
+ case Cs::cStore:
+ CHECK_STACK(4);
+ which_vector = (CharstringProgram::VectorType)((int)top(3));
+ vectoroff = (int)top(2);
+ offset = (int)top(1);
+ num = (int)top(0);
+ pop(4);
+
+ if (!_program)
+ return error(errVector, cmd);
+ v = _program->mm_vector(which_vector, true);
+ if (!v)
+ return error(errVector, cmd);
+
+ for (i = 0; i < num; i++, offset++, vectoroff++)
+ vec(v, vectoroff) = vec(&_scratch_vector, offset);
+ // erase our weight vector if the global weight vector has changed
+ if (which_vector == CharstringProgram::VEC_WEIGHT)
+ _weight_vector.clear();
+ break;
+
+ case Cs::cLoad:
+ CHECK_STACK(3);
+ which_vector = (CharstringProgram::VectorType)((int)top(2));
+ offset = (int)top(1);
+ num = (int)top(0);
+ pop(3);
+
+ if (!_program)
+ return error(errVector, cmd);
+ v = _program->mm_vector(which_vector, false);
+ // use our weight vector if appropriate
+ if (!v && which_vector == CharstringProgram::VEC_WEIGHT && _weight_vector.size())
+ v = &_weight_vector;
+ if (!v)
+ return error(errVector, cmd);
+
+ for (i = 0; i < num; i++, offset++)
+ vec(&_scratch_vector, offset) = vec(v, i);
+ break;
+
+ default:
+ return error(errUnimplemented, cmd);
+
+ }
+
+ return true;
+}
+
+bool
+CharstringInterp::blend_command()
+{
+ const int cmd = Cs::cBlend;
+ CHECK_STACK(1);
+ int nargs = (int)pop();
+
+ ensure_weight_vector();
+ if (!_weight_vector.size())
+ return error(errVector, cmd);
+
+ int nmasters = _weight_vector.size();
+ CHECK_STACK(nargs * nmasters);
+
+ int base = _sp - nargs * nmasters;
+ int off = base + nargs;
+ for (int j = 0; j < nargs; j++) {
+ double &val = _s[base + j];
+ for (int i = 1; i < nmasters; i++, off++)
+ val += _weight_vector.at_u(i) * _s[off];
+ }
+
+ pop(nargs * (nmasters - 1));
+ return true;
+}
+
+bool
+CharstringInterp::roll_command()
+{
+ const int cmd = Cs::cRoll;
+ CHECK_STACK(2);
+ int amount = (int)pop();
+ int n = (int)pop();
+ if (n <= 0)
+ return error(errValue, cmd);
+ CHECK_STACK(n);
+
+ int base = _sp - n;
+ while (amount < 0)
+ amount += n;
+
+ int i;
+ double copy_stack[STACK_SIZE];
+ for (i = 0; i < n; i++)
+ copy_stack[i] = _s[ base + (i+amount) % n ];
+ for (i = 0; i < n; i++)
+ _s[base + i] = copy_stack[i];
+
+ return true;
+}
+
+bool
+CharstringInterp::arith_command(int cmd)
+{
+ int i;
+ double d;
+
+ switch (cmd) {
+
+ case Cs::cBlend:
+ return blend_command();
+
+ case Cs::cAbs:
+ CHECK_STACK(1);
+ if (top() < 0)
+ top() = -top();
+ break;
+
+ case Cs::cAdd:
+ CHECK_STACK(1);
+ d = pop();
+ top() += d;
+ break;
+
+ case Cs::cSub:
+ CHECK_STACK(1);
+ d = pop();
+ top() -= d;
+ break;
+
+ case Cs::cDiv:
+ CHECK_STACK(2);
+ d = pop();
+ top() /= d;
+ break;
+
+ case Cs::cNeg:
+ CHECK_STACK(1);
+ top() = -top();
+ break;
+
+ case Cs::cRandom: {
+ double d;
+ do {
+ d = random() / ((double)RAND_MAX);
+ } while (d == 0);
+ push(d);
+ break;
+ }
+
+ case Cs::cMul:
+ CHECK_STACK(2);
+ d = pop();
+ top() *= d;
+ break;
+
+ case Cs::cSqrt:
+ CHECK_STACK(1);
+ if (top() < 0)
+ return error(errValue, cmd);
+ top() = sqrt(top());
+ break;
+
+ case Cs::cDrop:
+ CHECK_STACK(1);
+ pop();
+ break;
+
+ case Cs::cExch:
+ CHECK_STACK(2);
+ d = top(0);
+ top(0) = top(1);
+ top(1) = d;
+ break;
+
+ case Cs::cIndex:
+ CHECK_STACK(1);
+ i = (int)top();
+ if (i < 0)
+ return error(errValue, cmd);
+ CHECK_STACK(i + 2);
+ top() = top(i+1);
+ break;
+
+ case Cs::cRoll:
+ return roll_command();
+
+ case Cs::cDup:
+ CHECK_STACK(1);
+ push(top());
+ break;
+
+ case Cs::cAnd:
+ CHECK_STACK(2);
+ d = pop();
+ top() = (top() != 0) && (d != 0);
+ break;
+
+ case Cs::cOr:
+ CHECK_STACK(2);
+ d = pop();
+ top() = (top() != 0) || (d != 0);
+ break;
+
+ case Cs::cNot:
+ CHECK_STACK(1);
+ top() = (top() == 0);
+ break;
+
+ case Cs::cEq:
+ CHECK_STACK(2);
+ d = pop();
+ top() = (top() == d);
+ break;
+
+ case Cs::cIfelse:
+ CHECK_STACK(4);
+ if (top(1) > top(0))
+ top(3) = top(2);
+ pop(3);
+ break;
+
+ case Cs::cPop:
+ if (ps_size() < 1)
+ return error(errUnderflow, cmd);
+ push(ps_pop());
+ break;
+
+ case 15:
+ // this command is found with no explanation in JansonText-Roman
+ CHECK_STACK(2);
+ pop(2);
+ return true;
+
+ default:
+ return error(errUnimplemented, cmd);
+
+ }
+
+ return true;
+}
+
+bool
+CharstringInterp::callsubr_command()
+{
+ const int cmd = Cs::cCallsubr;
+ CHECK_STACK(1);
+ int which = (int)pop();
+
+ Charstring *subr_cs = get_subr(which);
+ if (!subr_cs)
+ return error(errSubr, which);
+
+ if (_subr_depth >= MAX_SUBR_DEPTH)
+ return error(errSubrDepth, which);
+ _subr_depth++;
+
+ subr_cs->process(*this);
+
+ _subr_depth--;
+ if (_error != errOK)
+ return false;
+ return !done();
+}
+
+bool
+CharstringInterp::callgsubr_command()
+{
+ const int cmd = Cs::cCallgsubr;
+ CHECK_STACK(1);
+ int which = (int)pop();
+
+ Charstring *subr_cs = get_gsubr(which);
+ if (!subr_cs)
+ return error(errSubr, which);
+
+ if (_subr_depth >= MAX_SUBR_DEPTH)
+ return error(errSubrDepth, which);
+ _subr_depth++;
+
+ subr_cs->process(*this);
+
+ _subr_depth--;
+ if (_error != errOK)
+ return false;
+ return !done();
+}
+
+bool
+CharstringInterp::mm_command(int command, int on_stack)
+{
+ ensure_weight_vector();
+ if (!_weight_vector.size())
+ return error(errVector, command);
+
+ int nargs;
+ switch (command) {
+ case Cs::othcMM1: nargs = 1; break;
+ case Cs::othcMM2: nargs = 2; break;
+ case Cs::othcMM3: nargs = 3; break;
+ case Cs::othcMM4: nargs = 4; break;
+ case Cs::othcMM6: nargs = 6; break;
+ default: return error(errInternal, command);
+ }
+
+ int nmasters = _weight_vector.size();
+ if (size() < nargs * nmasters
+ || on_stack != nargs * nmasters)
+ return error(errMultipleMaster, command);
+
+ int base = size() - on_stack;
+
+ int off = base + nargs;
+ for (int j = 0; j < nargs; j++) {
+ double &val = at(base + j);
+ for (int i = 1; i < nmasters; i++, off++)
+ val += _weight_vector.at_u(i) * at(off);
+ }
+
+ for (int i = nargs - 1; i >= 0; i--)
+ ps_push(at(base + i));
+
+ pop(on_stack);
+ return true;
+}
+
+bool
+CharstringInterp::itc_command(int command, int on_stack)
+{
+ ensure_weight_vector();
+ if (!_weight_vector.size())
+ return error(errVector, command);
+
+ int base = size() - on_stack;
+ switch (command) {
+
+ case Cs::othcITC_load: {
+ if (on_stack != 1)
+ return error(errOthersubr, command);
+ int offset = (int)at(base);
+ for (int i = 0; i < _weight_vector.size(); i++)
+ vec(&_scratch_vector, offset+i) = _weight_vector.at_u(i);
+ break;
+ }
+
+ case Cs::othcITC_put: {
+ if (on_stack != 2)
+ return error(errOthersubr, command);
+ int offset = (int)at(base+1);
+ vec(&_scratch_vector, offset) = at(base);
+ break;
+ }
+
+ case Cs::othcITC_get: {
+ if (on_stack != 1)
+ return error(errOthersubr, command);
+ int offset = (int)at(base);
+ ps_push(vec(&_scratch_vector, offset));
+ break;
+ }
+
+ case Cs::othcITC_add: {
+ if (on_stack != 2)
+ return error(errOthersubr, command);
+ ps_push(at(base) + at(base+1));
+ break;
+ }
+
+ case Cs::othcITC_sub: {
+ if (on_stack != 2)
+ return error(errOthersubr, command);
+ ps_push(at(base) - at(base+1));
+ break;
+ }
+
+ case Cs::othcITC_mul: {
+ if (on_stack != 2)
+ return error(errOthersubr, command);
+ ps_push(at(base) * at(base+1));
+ break;
+ }
+
+ case Cs::othcITC_div: {
+ if (on_stack != 2)
+ return error(errOthersubr, command);
+ ps_push(at(base) / at(base+1));
+ break;
+ }
+
+ case Cs::othcITC_ifelse: {
+ if (on_stack != 4)
+ return error(errOthersubr, command);
+ if (at(base+2) <= at(base+3))
+ ps_push(at(base));
+ else
+ ps_push(at(base+1));
+ break;
+ }
+
+ default:
+ return error(errOthersubr, command);
+
+ }
+
+ pop(on_stack);
+ return true;
+}
+
+
+inline void
+CharstringInterp::actp_rmoveto(int /*cmd*/, double dx, double dy)
+{
+ _cp.shift(dx, dy);
+}
+
+inline void
+CharstringInterp::actp_rlineto(int cmd, double dx, double dy)
+{
+ Point p0(_cp);
+ _cp.shift(dx, dy);
+ act_line(cmd, p0, _cp);
+}
+
+void
+CharstringInterp::actp_rrcurveto(int cmd, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+{
+ Point p0(_cp);
+ Point p1(p0, dx1, dy1);
+ Point p2(p1, dx2, dy2);
+ _cp = p2.shifted(dx3, dy3);
+ act_curve(cmd, p0, p1, p2, _cp);
+}
+
+void
+CharstringInterp::actp_rrflex(int cmd, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3, double dx4, double dy4, double dx5, double dy5, double dx6, double dy6, double flex_depth)
+{
+ Point p0(_cp);
+ Point p1(p0, dx1, dy1);
+ Point p2(p1, dx2, dy2);
+ Point p3_4(p2, dx3, dy3);
+ Point p5(p3_4, dx4, dy4);
+ Point p6(p5, dx5, dy5);
+ _cp = p6.shifted(dx6, dy6);
+ act_flex(cmd, p0, p1, p2, p3_4, p5, p6, _cp, flex_depth);
+}
+
+
+bool
+CharstringInterp::callothersubr_command(int othersubrnum, int n)
+{
+ switch (othersubrnum) {
+
+ case Cs::othcFlexend:
+ if (n != 3)
+ goto unknown;
+ if (!_flex || ps_size() != 16)
+ return error(errFlex);
+ CHECK_PATH_START();
+ act_flex(Cs::cCallothersubr, Point(ps_at(0), ps_at(1)),
+ Point(ps_at(4), ps_at(5)), Point(ps_at(6), ps_at(7)),
+ Point(ps_at(8), ps_at(9)), Point(ps_at(10), ps_at(11)),
+ Point(ps_at(12), ps_at(13)), Point(ps_at(14), ps_at(15)),
+ top(2));
+ ps_clear();
+ ps_push(top(0));
+ ps_push(top(1));
+ _flex = false;
+ _state = S_PATH;
+ break;
+
+ case Cs::othcFlexbegin:
+ if (n != 0)
+ goto unknown;
+ if (_flex)
+ return error(errFlex);
+ ps_clear();
+ ps_push(_cp.x);
+ ps_push(_cp.y);
+ _flex = true;
+ _state = S_IPATH;
+ break;
+
+ case Cs::othcFlexmiddle:
+ if (n != 0)
+ goto unknown;
+ if (!_flex)
+ return error(errFlex);
+ ps_push(_cp.x);
+ ps_push(_cp.y);
+ break;
+
+ case Cs::othcReplacehints:
+ if (n != 1)
+ goto unknown;
+ ps_clear();
+ ps_push(top());
+ break;
+
+ case Cs::othcMM1:
+ case Cs::othcMM2:
+ case Cs::othcMM3:
+ case Cs::othcMM4:
+ case Cs::othcMM6:
+ return mm_command(othersubrnum, n);
+
+ case Cs::othcITC_load:
+ case Cs::othcITC_add:
+ case Cs::othcITC_sub:
+ case Cs::othcITC_mul:
+ case Cs::othcITC_div:
+ case Cs::othcITC_put:
+ case Cs::othcITC_get:
+ case Cs::othcITC_unknown:
+ case Cs::othcITC_ifelse:
+ case Cs::othcITC_random:
+ return itc_command(othersubrnum, n);
+
+ default: // unknown
+ unknown:
+ ps_clear();
+ for (int i = 0; i < n; i++)
+ ps_push(top(i));
+ break;
+
+ }
+
+ pop(n);
+ return true;
+}
+
+bool
+CharstringInterp::type1_command(int cmd)
+{
+ switch (cmd) {
+
+ case Cs::cReturn:
+ return false;
+
+ case Cs::cHsbw:
+ CHECK_STACK(2);
+ if (_state > S_SEAC && _careful)
+ return error(errOrdering, cmd);
+ else {
+ _lsb = _cp = _seac_origin.shifted(at(0), 0);
+ if (_state == S_INITIAL) {
+ act_sidebearing(cmd, _lsb);
+ act_width(cmd, Point(at(1), 0));
+ }
+ if (_state <= S_SEAC)
+ _state = S_SBW;
+ }
+ break;
+
+ case Cs::cSbw:
+ CHECK_STACK(4);
+ if (_state > S_SEAC && _careful)
+ return error(errOrdering, cmd);
+ else {
+ _lsb = _cp = _seac_origin.shifted(at(0), at(1));
+ if (_state == S_INITIAL) {
+ act_sidebearing(cmd, _lsb);
+ act_width(cmd, Point(at(2), at(3)));
+ }
+ if (_state <= S_SEAC)
+ _state = S_SBW;
+ }
+ break;
+
+ case Cs::cSeac:
+ CHECK_STACK(5);
+ if (_state > S_SBW)
+ return error(errOrdering, cmd);
+ act_seac(cmd, at(0), at(1), at(2), (int)at(3), (int)at(4));
+ clear();
+ return false;
+
+ case Cs::cCallsubr:
+ return callsubr_command();
+
+ case Cs::cCallothersubr: {
+ CHECK_STACK(2);
+ int othersubrnum = (int)top(0);
+ int n = (int)top(1);
+ pop(2);
+ if (othersubrnum < 0 || size() < n)
+ return error(errOthersubr, cmd);
+ return callothersubr_command(othersubrnum, n);
+ }
+
+ case Cs::cPut:
+ case Cs::cGet:
+ case Cs::cStore:
+ case Cs::cLoad:
+ return vector_command(cmd);
+
+ case Cs::cBlend:
+ case Cs::cAbs:
+ case Cs::cAdd:
+ case Cs::cSub:
+ case Cs::cDiv:
+ case Cs::cNeg:
+ case Cs::cRandom:
+ case Cs::cMul:
+ case Cs::cSqrt:
+ case Cs::cDrop:
+ case Cs::cExch:
+ case Cs::cIndex:
+ case Cs::cRoll:
+ case Cs::cDup:
+ case Cs::cAnd:
+ case Cs::cOr:
+ case Cs::cNot:
+ case Cs::cEq:
+ case Cs::cIfelse:
+ case Cs::cPop:
+ return arith_command(cmd);
+
+ case Cs::cHlineto:
+ CHECK_STACK(1);
+ CHECK_PATH_START();
+ actp_rlineto(cmd, at(0), 0);
+ break;
+
+ case Cs::cHmoveto:
+ CHECK_STACK(1);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, at(0), 0);
+ break;
+
+ case Cs::cHvcurveto:
+ CHECK_STACK(4);
+ CHECK_PATH_START();
+ actp_rrcurveto(cmd, at(0), 0, at(1), at(2), 0, at(3));
+ break;
+
+ case Cs::cRlineto:
+ CHECK_STACK(2);
+ CHECK_PATH_START();
+ actp_rlineto(cmd, at(0), at(1));
+ break;
+
+ case Cs::cRmoveto:
+ CHECK_STACK(2);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, at(0), at(1));
+ break;
+
+ case Cs::cRrcurveto:
+ CHECK_STACK(6);
+ CHECK_PATH_START();
+ actp_rrcurveto(cmd, at(0), at(1), at(2), at(3), at(4), at(5));
+ break;
+
+ case Cs::cVhcurveto:
+ CHECK_STACK(4);
+ CHECK_PATH_START();
+ actp_rrcurveto(cmd, 0, at(0), at(1), at(2), at(3), 0);
+ break;
+
+ case Cs::cVlineto:
+ CHECK_STACK(1);
+ CHECK_PATH_START();
+ actp_rlineto(cmd, 0, at(0));
+ break;
+
+ case Cs::cVmoveto:
+ CHECK_STACK(1);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, 0, at(0));
+ break;
+
+ case Cs::cDotsection:
+ break;
+
+ case Cs::cHstem:
+ CHECK_STACK(2);
+ act_hstem(cmd, _lsb.y + at(0), at(1));
+ break;
+
+ case Cs::cHstem3:
+ CHECK_STACK(6);
+ act_hstem3(cmd, _lsb.y + at(0), at(1), _lsb.y + at(2), at(3), _lsb.y + at(4), at(5));
+ break;
+
+ case Cs::cVstem:
+ CHECK_STACK(2);
+ act_vstem(cmd, _lsb.x + at(0), at(1));
+ break;
+
+ case Cs::cVstem3:
+ CHECK_STACK(6);
+ act_vstem3(cmd, _lsb.x + at(0), at(1), _lsb.x + at(2), at(3), _lsb.x + at(4), at(5));
+ break;
+
+ case Cs::cSetcurrentpoint:
+ CHECK_STACK(2);
+ _cp = Point(at(0), at(1));
+ break;
+
+ case Cs::cClosepath:
+ CHECK_PATH_END();
+ break;
+
+ case Cs::cEndchar:
+ CHECK_PATH_END();
+ set_done();
+ return false;
+
+ case Cs::cError:
+ default:
+ return error(errUnimplemented, cmd);
+
+ }
+
+ clear();
+ return error() >= 0;
+}
+
+
+#undef DEBUG_TYPE2
+
+int
+CharstringInterp::type2_handle_width(int cmd, bool have_width)
+{
+ _cp = _lsb = _seac_origin;
+ if (_state != S_INITIAL)
+ /* ignore width */;
+ else if (have_width)
+ act_nominal_width_delta(cmd, at(0));
+ else
+ act_default_width(cmd);
+ return (have_width ? 1 : 0);
+}
+
+bool
+CharstringInterp::type2_command(int cmd, const uint8_t *data, int *left)
+{
+ int bottom = 0;
+
+#ifdef DEBUG_TYPE2
+ fprintf(stderr, "%s [%d/%d]\n", Charstring::command_name(cmd).c_str(), _t2nhints, size());
+#endif
+
+ switch (cmd) {
+
+ case Cs::cHstem:
+ case Cs::cHstemhm:
+ CHECK_STACK(2);
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, (size() % 2) == 1);
+ if (_state > S_HSTEM)
+ return error(errOrdering, cmd);
+ _state = S_HSTEM;
+ for (double pos = 0; bottom + 1 < size(); bottom += 2) {
+ _t2nhints++;
+ act_hstem(cmd, pos + at(bottom), at(bottom + 1));
+ pos += at(bottom) + at(bottom + 1);
+ }
+ break;
+
+ case Cs::cVstem:
+ case Cs::cVstemhm:
+ CHECK_STACK(2);
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, (size() % 2) == 1);
+ if (_state > S_VSTEM)
+ return error(errOrdering, cmd);
+ _state = S_VSTEM;
+ for (double pos = 0; bottom + 1 < size(); bottom += 2) {
+ _t2nhints++;
+ act_vstem(cmd, pos + at(bottom), at(bottom + 1));
+ pos += at(bottom) + at(bottom + 1);
+ }
+ break;
+
+ case Cs::cHintmask:
+ case Cs::cCntrmask:
+ if (_state <= S_SEAC && size() >= 1) {
+ bottom = type2_handle_width(cmd, (size() % 2) == 1);
+ for (double pos = 0; bottom + 1 < size(); bottom += 2) {
+ _t2nhints++;
+ act_hstem(cmd, pos + at(bottom), at(bottom + 1));
+ pos += at(bottom) + at(bottom + 1);
+ }
+ }
+ if ((_state == S_HSTEM || _state == S_VSTEM) && size() >= 2)
+ for (double pos = 0; bottom + 1 < size(); bottom += 2) {
+ _t2nhints++;
+ act_vstem(cmd, pos + at(bottom), at(bottom + 1));
+ pos += at(bottom) + at(bottom + 1);
+ }
+ if (_state < S_HINTMASK)
+ _state = S_HINTMASK;
+ if (_t2nhints == 0)
+ return error(errHintmask, cmd);
+ if (!data || !left)
+ return error(errInternal, cmd);
+ if (((_t2nhints - 1) >> 3) + 1 > *left)
+ return error(errRunoff, cmd);
+ act_hintmask(cmd, data, _t2nhints);
+ *left -= ((_t2nhints - 1) >> 3) + 1;
+ break;
+
+ case Cs::cRmoveto:
+ CHECK_STACK(2);
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, size() > 2);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, at(bottom), at(bottom + 1));
+#if DEBUG_TYPE2
+ bottom += 2;
+#endif
+ break;
+
+ case Cs::cHmoveto:
+ CHECK_STACK(1);
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, size() > 1);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, at(bottom), 0);
+#if DEBUG_TYPE2
+ bottom++;
+#endif
+ break;
+
+ case Cs::cVmoveto:
+ CHECK_STACK(1);
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, size() > 1);
+ CHECK_PATH_END();
+ actp_rmoveto(cmd, 0, at(bottom));
+#if DEBUG_TYPE2
+ bottom++;
+#endif
+ break;
+
+ case Cs::cRlineto:
+ CHECK_STACK(2);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ for (; bottom + 1 < size(); bottom += 2)
+ actp_rlineto(cmd, at(bottom), at(bottom + 1));
+ break;
+
+ case Cs::cHlineto:
+ CHECK_STACK(1);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ while (bottom < size()) {
+ actp_rlineto(cmd, at(bottom++), 0);
+ if (bottom < size())
+ actp_rlineto(cmd, 0, at(bottom++));
+ }
+ break;
+
+ case Cs::cVlineto:
+ CHECK_STACK(1);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ while (bottom < size()) {
+ actp_rlineto(cmd, 0, at(bottom++));
+ if (bottom < size())
+ actp_rlineto(cmd, at(bottom++), 0);
+ }
+ break;
+
+ case Cs::cRrcurveto:
+ CHECK_STACK(6);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ for (; bottom + 5 < size(); bottom += 6)
+ actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
+ break;
+
+ case Cs::cHhcurveto:
+ CHECK_STACK(4);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ if (size() % 2 == 1) {
+ actp_rrcurveto(cmd, at(bottom + 1), at(bottom), at(bottom + 2), at(bottom + 3), at(bottom + 4), 0);
+ bottom += 5;
+ }
+ for (; bottom + 3 < size(); bottom += 4)
+ actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), at(bottom + 3), 0);
+ break;
+
+ case Cs::cHvcurveto:
+ CHECK_STACK(4);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ while (bottom + 3 < size()) {
+ double dx3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
+ actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), dx3, at(bottom + 3));
+ bottom += 4;
+ if (bottom + 3 < size()) {
+ double dy3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
+ actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), dy3);
+ bottom += 4;
+ }
+ }
+#if DEBUG_TYPE2
+ if (bottom + 1 == size())
+ bottom++;
+#endif
+ break;
+
+ case Cs::cRcurveline:
+ CHECK_STACK(8);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ for (; bottom + 7 < size(); bottom += 6)
+ actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
+ actp_rlineto(cmd, at(bottom), at(bottom + 1));
+#if DEBUG_TYPE2
+ bottom += 2;
+#endif
+ break;
+
+ case Cs::cRlinecurve:
+ CHECK_STACK(8);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ for (; bottom + 7 < size(); bottom += 2)
+ actp_rlineto(cmd, at(bottom), at(bottom + 1));
+ actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), at(bottom + 4), at(bottom + 5));
+#if DEBUG_TYPE2
+ bottom += 6;
+#endif
+ break;
+
+ case Cs::cVhcurveto:
+ CHECK_STACK(4);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ while (bottom + 3 < size()) {
+ double dy3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
+ actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), dy3);
+ bottom += 4;
+ if (bottom + 3 < size()) {
+ double dx3 = (bottom + 5 == size() ? at(bottom + 4) : 0);
+ actp_rrcurveto(cmd, at(bottom), 0, at(bottom + 1), at(bottom + 2), dx3, at(bottom + 3));
+ bottom += 4;
+ }
+ }
+#if DEBUG_TYPE2
+ if (bottom + 1 == size())
+ bottom++;
+#endif
+ break;
+
+ case Cs::cVvcurveto:
+ CHECK_STACK(4);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ if (size() % 2 == 1) {
+ actp_rrcurveto(cmd, at(bottom), at(bottom + 1), at(bottom + 2), at(bottom + 3), 0, at(bottom + 4));
+ bottom += 5;
+ }
+ for (; bottom + 3 < size(); bottom += 4)
+ actp_rrcurveto(cmd, 0, at(bottom), at(bottom + 1), at(bottom + 2), 0, at(bottom + 3));
+ break;
+
+ case Cs::cFlex:
+ CHECK_STACK(13);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ assert(bottom == 0);
+ actp_rrflex(cmd,
+ at(0), at(1), at(2), at(3), at(4), at(5),
+ at(6), at(7), at(8), at(9), at(10), at(11),
+ at(12));
+#if DEBUG_TYPE2
+ bottom += 13;
+#endif
+ break;
+
+ case Cs::cHflex:
+ CHECK_STACK(7);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ assert(bottom == 0);
+ actp_rrflex(cmd,
+ at(0), 0, at(1), at(2), at(3), 0,
+ at(4), 0, at(5), -at(2), at(6), 0,
+ 50);
+#if DEBUG_TYPE2
+ bottom += 7;
+#endif
+ break;
+
+ case Cs::cHflex1:
+ CHECK_STACK(9);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ assert(bottom == 0);
+ actp_rrflex(cmd,
+ at(0), at(1), at(2), at(3), at(4), 0,
+ at(5), 0, at(6), at(7), at(8), -(at(1) + at(3) + at(7)),
+ 50);
+#if DEBUG_TYPE2
+ bottom += 9;
+#endif
+ break;
+
+ case Cs::cFlex1: {
+ CHECK_STACK(11);
+ CHECK_STATE();
+ CHECK_PATH_START();
+ assert(bottom == 0);
+ double dx = at(0) + at(2) + at(4) + at(6) + at(8);
+ double dy = at(1) + at(3) + at(5) + at(7) + at(9);
+ if (fabs(dx) > fabs(dy))
+ actp_rrflex(cmd,
+ at(0), at(1), at(2), at(3), at(4), at(5),
+ at(6), at(7), at(8), at(9), at(10), -dy,
+ 50);
+ else
+ actp_rrflex(cmd,
+ at(0), at(1), at(2), at(3), at(4), at(5),
+ at(6), at(7), at(8), at(9), -dx, at(10),
+ 50);
+ break;
+#if DEBUG_TYPE2
+ bottom += 11;
+#endif
+ }
+
+ case Cs::cEndchar:
+ if (_state <= S_SEAC)
+ bottom = type2_handle_width(cmd, size() > 0 && size() != 4);
+ if (bottom + 3 < size() && _state == S_INITIAL)
+ act_seac(cmd, 0, at(bottom), at(bottom + 1), (int)at(bottom + 2), (int)at(bottom + 3));
+ CHECK_PATH_END();
+ set_done();
+ clear();
+ return false;
+
+ case Cs::cReturn:
+ return false;
+
+ case Cs::cCallsubr:
+ return callsubr_command();
+
+ case Cs::cCallgsubr:
+ return callgsubr_command();
+
+ case Cs::cPut:
+ case Cs::cGet:
+ case Cs::cStore:
+ case Cs::cLoad:
+ return vector_command(cmd);
+
+ case Cs::cBlend:
+ case Cs::cAbs:
+ case Cs::cAdd:
+ case Cs::cSub:
+ case Cs::cDiv:
+ case Cs::cNeg:
+ case Cs::cRandom:
+ case Cs::cMul:
+ case Cs::cSqrt:
+ case Cs::cDrop:
+ case Cs::cExch:
+ case Cs::cIndex:
+ case Cs::cRoll:
+ case Cs::cDup:
+ case Cs::cAnd:
+ case Cs::cOr:
+ case Cs::cNot:
+ case Cs::cEq:
+ case Cs::cIfelse:
+ case Cs::cPop:
+ return arith_command(cmd);
+
+ case Cs::cDotsection:
+ break;
+
+ case Cs::cError:
+ default:
+ return error(errUnimplemented, cmd);
+
+ }
+
+#if DEBUG_TYPE2
+ if (bottom != size())
+ fprintf(stderr, "[left %d on stack] ", size() - bottom);
+#endif
+
+ clear();
+ return error() >= 0;
+}
+
+
+void
+CharstringInterp::act_sidebearing(int, const Point &)
+{
+ /* do nothing */
+}
+
+void
+CharstringInterp::act_width(int, const Point &)
+{
+ /* do nothing */
+}
+
+void
+CharstringInterp::act_default_width(int cmd)
+{
+ double d = (_program ? _program->global_width_x(false) : UNKDOUBLE);
+ if (KNOWN(d))
+ act_width(cmd, Point(d, 0));
+}
+
+void
+CharstringInterp::act_nominal_width_delta(int cmd, double delta)
+{
+ double d = (_program ? _program->global_width_x(true) : UNKDOUBLE);
+ if (KNOWN(d))
+ act_width(cmd, Point(d + delta, 0));
+}
+
+void
+CharstringInterp::act_seac(int cmd, double asb, double adx, double ady, int bchar, int achar)
+{
+ Charstring *acs = 0, *bcs = 0;
+ if (achar < 0 || achar >= 256 || bchar < 0 || bchar >= 256
+ || !_program || _program->parent_program()
+ || !(acs = get_glyph(Charstring::standard_encoding[achar]))
+ || !(bcs = get_glyph(Charstring::standard_encoding[bchar]))) {
+ error(errGlyph, cmd);
+ return;
+ }
+
+ Point apos = Point(adx + _lsb.x - asb, ady + _lsb.y);
+ Point save_lsb = _lsb;
+ Point save_seac_origin = _seac_origin;
+
+ CharstringInterp::initialize();
+ _seac_origin = apos;
+ _state = S_SEAC;
+ acs->process(*this);
+ if (error() == errOK) {
+ CharstringInterp::initialize();
+ _seac_origin = save_seac_origin;
+ _state = S_SEAC;
+ bcs->process(*this);
+ }
+
+ _lsb = save_lsb;
+}
+
+void
+CharstringInterp::act_line(int cmd, const Point &p0, const Point &p1)
+{
+ act_curve(cmd, p0, p0, p1, p1);
+}
+
+void
+CharstringInterp::act_curve(int cmd, const Point &, const Point &, const Point &, const Point &)
+{
+ error(errUnimplemented, cmd);
+}
+
+void
+CharstringInterp::act_flex(int cmd, const Point &p0, const Point &p1, const Point &p2, const Point &p3_4, const Point &p5, const Point &p6, const Point &p7, double flex_depth)
+{
+ (void) flex_depth;
+ act_curve(cmd, p0, p1, p2, p3_4);
+ act_curve(cmd, p3_4, p5, p6, p7);
+}
+
+void
+CharstringInterp::act_closepath(int)
+{
+ /* do nothing */
+}
+
+void
+CharstringInterp::act_hstem(int, double, double)
+{
+ /* do nothing */
+}
+
+void
+CharstringInterp::act_vstem(int, double, double)
+{
+ /* do nothing */
+}
+
+void
+CharstringInterp::act_hstem3(int cmd, double y0, double dy0, double y1, double dy1, double y2, double dy2)
+{
+ act_hstem(cmd, y0, dy0);
+ act_hstem(cmd, y1, dy1);
+ act_hstem(cmd, y2, dy2);
+}
+
+void
+CharstringInterp::act_vstem3(int cmd, double x0, double dx0, double x1, double dx1, double x2, double dx2)
+{
+ act_vstem(cmd, x0, dx0);
+ act_vstem(cmd, x1, dx1);
+ act_vstem(cmd, x2, dx2);
+}
+
+void
+CharstringInterp::act_hintmask(int, const uint8_t *, int)
+{
+ /* do nothing */
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1item.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1item.cc
index 5e169b66f13..96f7f8b8e41 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1item.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1item.cc
@@ -60,7 +60,7 @@ void
Type1EexecItem::gen(Type1Writer &w)
{
if (_eexec_on)
- w << "currentfile eexec\n";
+ w << "currentfile eexec\n";
w.switch_eexec(_eexec_on);
}
@@ -75,7 +75,7 @@ typedef Vector<double> NumVector;
Type1Definition::Type1Definition(PermString n, const String &v, PermString d)
: _name(n), _val(v), _definer(d)
{
- _val.c_str(); // ensure it ends with '\0'
+ _val.c_str(); // ensure it ends with '\0'
}
Type1Definition *
@@ -93,19 +93,19 @@ Type1Definition::slurp_string(StringAccum &accum, int pos, Type1Reader *reader)
char *s = accum.data() + pos;
do {
- switch (*s++) {
- case '(': paren_level++; break;
- case ')': paren_level--; break;
- case '\\': if (paren_level && *s) s++; break;
- case 0:
- if (!reader) return -1;
- pos = s - accum.data();
- accum.append('\n'); // add \n
- if (!reader->next_line(accum)) return -1;
- accum.c_str(); // ensure null termination
- s = accum.data() + pos;
- break;
- }
+ switch (*s++) {
+ case '(': paren_level++; break;
+ case ')': paren_level--; break;
+ case '\\': if (paren_level && *s) s++; break;
+ case 0:
+ if (!reader) return -1;
+ pos = s - accum.data();
+ accum.append('\n'); // add \n
+ if (!reader->next_line(accum)) return -1;
+ accum.c_str(); // ensure null termination
+ s = accum.data() + pos;
+ break;
+ }
} while (paren_level);
return s - accum.data();
@@ -119,26 +119,26 @@ Type1Definition::slurp_proc(StringAccum &accum, int pos, Type1Reader *reader)
char *s = accum.data() + pos;
do {
- switch (*s++) {
- case '{': if (!paren_level) brace_level++; break;
- case '}': if (!paren_level) brace_level--; break;
- case '(': paren_level++; break;
- case ')': paren_level--; break;
- case '\\': if (paren_level && *s) s++; break;
- case '%':
- if (!paren_level)
- while (*s != '\n' && *s != '\r' && *s)
- s++;
- break;
- case 0:
- if (!reader) return -1;
- pos = s - accum.data();
- accum.append('\n'); // add \n
- if (!reader->next_line(accum)) return -1;
- accum.c_str(); // ensure null termination
- s = accum.data() + pos;
- break;
- }
+ switch (*s++) {
+ case '{': if (!paren_level) brace_level++; break;
+ case '}': if (!paren_level) brace_level--; break;
+ case '(': paren_level++; break;
+ case ')': paren_level--; break;
+ case '\\': if (paren_level && *s) s++; break;
+ case '%':
+ if (!paren_level)
+ while (*s != '\n' && *s != '\r' && *s)
+ s++;
+ break;
+ case 0:
+ if (!reader) return -1;
+ pos = s - accum.data();
+ accum.append('\n'); // add \n
+ if (!reader->next_line(accum)) return -1;
+ accum.c_str(); // ensure null termination
+ s = accum.data() + pos;
+ break;
+ }
} while (brace_level);
return s - accum.data();
@@ -146,65 +146,65 @@ Type1Definition::slurp_proc(StringAccum &accum, int pos, Type1Reader *reader)
Type1Definition *
Type1Definition::make(StringAccum &accum, Type1Reader *reader,
- bool force_definition)
+ bool force_definition)
{
char *s = accum.data();
while (isspace((unsigned char) *s))
- s++;
+ s++;
if (*s != '/')
- return 0;
+ return 0;
s++;
int name_start_pos = s - accum.data();
// find NAME LENGTH
while (!isspace((unsigned char) *s) && *s != '[' && *s != '{' && *s != '('
- && *s != ']' && *s != '}' && *s != ')' && *s)
- s++;
+ && *s != ']' && *s != '}' && *s != ')' && *s)
+ s++;
if (!*s)
- return 0;
+ return 0;
int name_end_pos = s - accum.data();
while (isspace((unsigned char) *s))
- s++;
+ s++;
int val_pos = s - accum.data();
int val_end_pos = -1;
bool check_def = false;
if (*s == '}' || *s == ']' || *s == ')' || *s == 0)
- return 0;
+ return 0;
else if (*s == '(')
- val_end_pos = slurp_string(accum, val_pos, reader);
+ val_end_pos = slurp_string(accum, val_pos, reader);
else if (*s == '{')
- val_end_pos = slurp_proc(accum, val_pos, reader);
+ val_end_pos = slurp_proc(accum, val_pos, reader);
else if (*s == '[') {
- int brack_level = 0;
- do {
- switch (*s++) {
- case '[': brack_level++; break;
- case ']': brack_level--; break;
- case '(': case ')': case 0: return 0;
- }
- } while (brack_level);
- val_end_pos = s - accum.data();
+ int brack_level = 0;
+ do {
+ switch (*s++) {
+ case '[': brack_level++; break;
+ case ']': brack_level--; break;
+ case '(': case ')': case 0: return 0;
+ }
+ } while (brack_level);
+ val_end_pos = s - accum.data();
} else {
- while (!isspace((unsigned char) *s) && *s)
- s++;
- val_end_pos = s - accum.data();
- if (!force_definition) check_def = true;
+ while (!isspace((unsigned char) *s) && *s)
+ s++;
+ val_end_pos = s - accum.data();
+ if (!force_definition) check_def = true;
}
if (val_end_pos < 0)
- return 0;
+ return 0;
s = accum.data() + val_end_pos;
while (isspace((unsigned char) *s))
- s++;
+ s++;
if (check_def && (s[0] != 'd' || s[1] != 'e' || s[2] != 'f'))
- if (strncmp(s, "dict def", 8) != 0)
- return 0;
+ if (strncmp(s, "dict def", 8) != 0)
+ return 0;
PermString name(accum.data()+name_start_pos, name_end_pos - name_start_pos);
PermString def(s, accum.length() - (s - accum.data()));
@@ -229,13 +229,13 @@ bool
Type1Definition::value_bool(bool &b) const
{
if (_val == "true") {
- b = true;
- return true;
+ b = true;
+ return true;
} else if (_val == "false") {
- b = false;
- return true;
+ b = false;
+ return true;
} else
- return false;
+ return false;
}
bool
@@ -258,57 +258,57 @@ bool
Type1Definition::value_string(String &str) const
{
if (_val.length() == 0 || _val[0] != '(' || _val.back() != ')')
- return false;
+ return false;
StringAccum sa;
int pos, first_pos = 1, len = _val.length() - 1;
for (pos = 1; pos < len; pos++)
- if (_val[pos] == '\\') {
- sa.append(_val.data() + first_pos, pos - first_pos);
- pos++;
- switch (pos < len ? _val[pos] : -1) {
- case '\r':
- pos++;
- if (pos < len && _val[pos] == '\n')
- pos++;
- break;
- case '\n':
- pos++;
- break;
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7': {
- int c = _val[pos++] - '0';
- for (int i = 1; pos < len && i < 3 && _val[pos] >= '0' && _val[pos] <= '7'; i++, pos++)
- c = (c << 3) | (_val[pos] - '0');
- sa.append((char) c);
- break;
- }
- case 'n':
- sa << '\n';
- pos++;
- break;
- case 'r':
- sa << '\r';
- pos++;
- break;
- case 't':
- sa << '\t';
- pos++;
- break;
- case 'b':
- sa << '\b';
- pos++;
- break;
- case 'f':
- sa << '\f';
- pos++;
- break;
- default:
- sa << _val[pos];
- pos++;
- break;
- }
- first_pos = pos;
- }
+ if (_val[pos] == '\\') {
+ sa.append(_val.data() + first_pos, pos - first_pos);
+ pos++;
+ switch (pos < len ? _val[pos] : -1) {
+ case '\r':
+ pos++;
+ if (pos < len && _val[pos] == '\n')
+ pos++;
+ break;
+ case '\n':
+ pos++;
+ break;
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7': {
+ int c = _val[pos++] - '0';
+ for (int i = 1; pos < len && i < 3 && _val[pos] >= '0' && _val[pos] <= '7'; i++, pos++)
+ c = (c << 3) | (_val[pos] - '0');
+ sa.append((char) c);
+ break;
+ }
+ case 'n':
+ sa << '\n';
+ pos++;
+ break;
+ case 'r':
+ sa << '\r';
+ pos++;
+ break;
+ case 't':
+ sa << '\t';
+ pos++;
+ break;
+ case 'b':
+ sa << '\b';
+ pos++;
+ break;
+ case 'f':
+ sa << '\f';
+ pos++;
+ break;
+ default:
+ sa << _val[pos];
+ pos++;
+ break;
+ }
+ first_pos = pos;
+ }
sa.append(_val.data() + first_pos, len - first_pos);
str = sa.take_string();
return true;
@@ -318,11 +318,11 @@ bool
Type1Definition::value_name(PermString &str) const
{
if (_val.length() == 0 || _val[0] != '/')
- return false;
+ return false;
int pos;
for (pos = 1; pos < _val.length(); pos++)
- if (isspace((unsigned char) _val[pos]) || _val[pos] == '/')
- return false;
+ if (isspace((unsigned char) _val[pos]) || _val[pos] == '/')
+ return false;
str = PermString(_val.data() + 1, pos - 1);
return true;
}
@@ -333,18 +333,18 @@ strtonumvec(const char *f, const char **endf, NumVector &v)
v.clear();
char *s = (char *)f;
if (*s != '[' && *s != '{')
- return false;
+ return false;
s++;
while (1) {
- while (isspace((unsigned char) *s))
- s++;
- if (isdigit((unsigned char) *s) || *s == '.' || *s == '-')
- v.push_back( strtonumber(s, &s) );
- else {
- if (endf)
- *endf = s + 1;
- return (*s == ']' || *s == '}');
- }
+ while (isspace((unsigned char) *s))
+ s++;
+ if (isdigit((unsigned char) *s) || *s == '.' || *s == '-')
+ v.push_back( strtonumber(s, &s) );
+ else {
+ if (endf)
+ *endf = s + 1;
+ return (*s == ']' || *s == '}');
+ }
}
}
@@ -360,21 +360,21 @@ strtonumvec_vec(const char *f, const char **endf, Vector<NumVector> &v)
v.clear();
const char *s = f;
if (*s != '[' && *s != '{')
- return false;
+ return false;
s++;
while (1) {
- while (isspace((unsigned char) *s))
- s++;
- if (*s == '[' || *s == '{') {
- NumVector subv;
- if (!strtonumvec(s, &s, subv))
- return false;
- v.push_back(subv);
- } else {
- if (endf)
- *endf = s + 1;
- return (*s == ']' || *s == '}');
- }
+ while (isspace((unsigned char) *s))
+ s++;
+ if (*s == '[' || *s == '{') {
+ NumVector subv;
+ if (!strtonumvec(s, &s, subv))
+ return false;
+ v.push_back(subv);
+ } else {
+ if (endf)
+ *endf = s + 1;
+ return (*s == ']' || *s == '}');
+ }
}
}
@@ -386,33 +386,33 @@ Type1Definition::value_numvec_vec(Vector<NumVector> &v) const
bool
Type1Definition::value_normalize(Vector<NumVector> &in,
- Vector<NumVector> &out) const
+ Vector<NumVector> &out) const
{
in.clear();
out.clear();
const char *s = _val.data();
if (*s++ != '[')
- return false;
+ return false;
while (1) {
- while (isspace((unsigned char) *s))
- s++;
- if (*s == '[') {
- Vector<NumVector> sub;
- if (!strtonumvec_vec(s, &s, sub))
- return false;
-
- NumVector subin;
- NumVector subout;
- for (int i = 0; i < sub.size(); i++)
- if (sub[i].size() == 2) {
- subin.push_back(sub[i][0]);
- subout.push_back(sub[i][1]);
- } else
- return false;
- in.push_back(subin);
- out.push_back(subout);
- } else
- return (*s == ']');
+ while (isspace((unsigned char) *s))
+ s++;
+ if (*s == '[') {
+ Vector<NumVector> sub;
+ if (!strtonumvec_vec(s, &s, sub))
+ return false;
+
+ NumVector subin;
+ NumVector subout;
+ for (int i = 0; i < sub.size(); i++)
+ if (sub[i].size() == 2) {
+ subin.push_back(sub[i][0]);
+ subout.push_back(sub[i][1]);
+ } else
+ return false;
+ in.push_back(subin);
+ out.push_back(subout);
+ } else
+ return (*s == ']');
}
}
@@ -422,19 +422,19 @@ Type1Definition::value_namevec(Vector<PermString> &v) const
v.clear();
const char *s = _val.data();
if (*s++ != '[')
- return false;
+ return false;
while (1) {
- while (isspace((unsigned char) *s))
- s++;
- if (*s == '/')
- s++;
- if (isalnum((unsigned char) *s)) {
- const char *start = s;
- while (*s && !isspace((unsigned char) *s) && *s != ']' && *s != '/')
- s++;
- v.push_back(PermString(start, s - start));
- } else
- return (*s == ']');
+ while (isspace((unsigned char) *s))
+ s++;
+ if (*s == '/')
+ s++;
+ if (isalnum((unsigned char) *s)) {
+ const char *start = s;
+ while (*s && !isspace((unsigned char) *s) && *s != ']' && *s != '/')
+ s++;
+ v.push_back(PermString(start, s - start));
+ } else
+ return (*s == ']');
}
}
@@ -466,14 +466,14 @@ Type1Definition::set_string(const String &v)
StringAccum sa;
sa << '(';
for (int pos = 0; pos < len; pos++)
- if ((s[pos] < ' ' && !isspace((unsigned char) s[pos])) || ((unsigned char)s[pos]) > 0176 || s[pos] == '(' || s[pos] == ')' || s[pos] == '\\') {
- sa << v.substring(left, pos - left) << '\\';
- if (s[pos] == '(' || s[pos] == ')' || s[pos] == '\\')
- sa << s[pos];
- else
- sprintf(sa.reserve(8), "%03o", (unsigned char) (s[pos]));
- left = pos + 1;
- }
+ if ((s[pos] < ' ' && !isspace((unsigned char) s[pos])) || ((unsigned char)s[pos]) > 0176 || s[pos] == '(' || s[pos] == ')' || s[pos] == '\\') {
+ sa << v.substring(left, pos - left) << '\\';
+ if (s[pos] == '(' || s[pos] == ')' || s[pos] == '\\')
+ sa << s[pos];
+ else
+ sprintf(sa.reserve(8), "%03o", (unsigned char) (s[pos]));
+ left = pos + 1;
+ }
sa << v.substring(left) << ')';
_val = sa.take_string();
}
@@ -483,7 +483,7 @@ Type1Definition::set_name(PermString str, bool name)
{
StringAccum sa;
if (name)
- sa << '/';
+ sa << '/';
sa << str;
set_val(sa);
}
@@ -493,7 +493,7 @@ accum_numvec(StringAccum &sa, const NumVector &nv, bool executable)
{
char open = (executable ? '{' : '[');
for (int i = 0; i < nv.size(); i++)
- sa << (i ? ' ' : open) << nv[i];
+ sa << (i ? ' ' : open) << nv[i];
sa << (executable ? '}' : ']');
}
@@ -511,24 +511,24 @@ Type1Definition::set_numvec_vec(const Vector<NumVector> &nv)
StringAccum sa;
sa << '[';
for (int i = 0; i < nv.size(); i++)
- accum_numvec(sa, nv[i], false);
+ accum_numvec(sa, nv[i], false);
sa << ']';
set_val(sa);
}
void
Type1Definition::set_normalize(const Vector<NumVector> &vin,
- const Vector<NumVector> &vout)
+ const Vector<NumVector> &vout)
{
StringAccum sa;
sa << '[';
for (int i = 0; i < vin.size(); i++) {
- const NumVector &vini = vin[i];
- const NumVector &vouti = vout[i];
- sa << '[';
- for (int j = 0; j < vini.size(); j++)
- sa << '[' << vini[j] << ' ' << vouti[j] << ']';
- sa << ']';
+ const NumVector &vini = vin[i];
+ const NumVector &vouti = vout[i];
+ sa << '[';
+ for (int j = 0; j < vini.size(); j++)
+ sa << '[' << vini[j] << ' ' << vouti[j] << ']';
+ sa << ']';
}
sa << ']';
set_val(sa);
@@ -540,9 +540,9 @@ Type1Definition::set_namevec(const Vector<PermString> &v, bool executable)
StringAccum sa;
sa << '[';
for (int i = 0; i < v.size(); i++) {
- if (i) sa << ' ';
- if (executable) sa << '/';
- sa << v[i];
+ if (i) sa << ' ';
+ if (executable) sa << '/';
+ sa << v[i];
}
sa << ']';
set_val(sa);
@@ -561,20 +561,20 @@ Type1Encoding::Type1Encoding()
: _v(new PermString[256]), _copy_of(0), _definer("readonly def")
{
for (int i = 0; i < 256; i++)
- _v[i] = dot_notdef;
+ _v[i] = dot_notdef;
}
Type1Encoding::Type1Encoding(const Type1Encoding &o)
: Type1Item(), _definer(o._definer)
{
if (o._copy_of) {
- _v = o._v;
- _copy_of = o._copy_of;
+ _v = o._v;
+ _copy_of = o._copy_of;
} else {
- _v = new PermString[256];
- _copy_of = 0;
- for (int i = 0; i < 256; i++)
- _v[i] = o._v[i];
+ _v = new PermString[256];
+ _copy_of = 0;
+ for (int i = 0; i < 256; i++)
+ _v[i] = o._v[i];
}
}
@@ -586,17 +586,17 @@ Type1Encoding::Type1Encoding(Type1Encoding *copy_of)
Type1Encoding::~Type1Encoding()
{
if (!_copy_of)
- delete[] _v;
+ delete[] _v;
}
void
Type1Encoding::unshare()
{
if (_copy_of) {
- PermString *new_v = new PermString[256];
- memcpy(new_v, _v, sizeof(PermString) * 256);
- _v = new_v;
- _copy_of = 0;
+ PermString *new_v = new PermString[256];
+ memcpy(new_v, _v, sizeof(PermString) * 256);
+ _v = new_v;
+ _copy_of = 0;
}
}
@@ -605,7 +605,7 @@ Type1Encoding::clear()
{
unshare();
for (int i = 0; i < 256; i++)
- _v[i] = dot_notdef;
+ _v[i] = dot_notdef;
}
@@ -615,10 +615,10 @@ Type1Encoding *
Type1Encoding::standard_encoding()
{
if (!canonical_standard_encoding) {
- canonical_standard_encoding = new Type1Encoding;
- for (int i = 0; i < 256; i++)
- if (Charstring::standard_encoding[i])
- canonical_standard_encoding->put(i, Charstring::standard_encoding[i]);
+ canonical_standard_encoding = new Type1Encoding;
+ for (int i = 0; i < 256; i++)
+ if (Charstring::standard_encoding[i])
+ canonical_standard_encoding->put(i, Charstring::standard_encoding[i]);
}
// Return a copy of the cached encoding. When it's deleted, we won't be.
return new Type1Encoding(canonical_standard_encoding);
@@ -629,13 +629,13 @@ void
Type1Encoding::gen(Type1Writer &w)
{
if (_copy_of && _copy_of == canonical_standard_encoding)
- w << "/Encoding StandardEncoding def\n";
+ w << "/Encoding StandardEncoding def\n";
else {
- w << "/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n";
- for (int i = 0; i < 256; i++)
- if (_v[i] != dot_notdef)
- w << "dup " << i << " /" << _v[i] << " put\n";
- w << _definer << '\n';
+ w << "/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n";
+ for (int i = 0; i < 256; i++)
+ if (_v[i] != dot_notdef)
+ w << "dup " << i << " /" << _v[i] << " put\n";
+ w << _definer << '\n';
}
}
@@ -645,13 +645,13 @@ Type1Encoding::gen(Type1Writer &w)
**/
Type1Subr::Type1Subr(PermString n, int num, PermString definer,
- int lenIV, const String &s)
+ int lenIV, const String &s)
: _name(n), _subrno(num), _definer(definer), _cs(lenIV, s)
{
}
Type1Subr::Type1Subr(PermString n, int num, PermString definer,
- const Type1Charstring &t1cs)
+ const Type1Charstring &t1cs)
: _name(n), _subrno(num), _definer(definer), _cs(t1cs)
{
}
@@ -672,17 +672,17 @@ Type1Subr::make(const char *s_in, int s_len, int cs_pos, int cs_len, int lenIV)
// Force literal spaces rather than isspace().
if (*s == '/') {
- const char *nstart = ++s;
- while (!isspace((unsigned char) *s) && *s)
- s++;
- name = PermString(nstart, s - nstart);
+ const char *nstart = ++s;
+ while (!isspace((unsigned char) *s) && *s)
+ s++;
+ name = PermString(nstart, s - nstart);
} else {
- // dup [subrno] ...
- s += 3;
- while (isspace((unsigned char) *s))
- s++;
- subrno = strtol(s, (char **)&s, 10);
+ // dup [subrno] ...
+ s += 3;
+ while (isspace((unsigned char) *s))
+ s++;
+ subrno = strtol(s, (char **)&s, 10);
}
s = s_in + cs_pos;
@@ -712,35 +712,35 @@ Type1Subr::gen(Type1Writer &w)
const unsigned char *data = _cs.data();
if (is_subr())
- w << "dup " << _subrno << ' ' << len + w.lenIV() << w.charstring_start();
+ w << "dup " << _subrno << ' ' << len + w.lenIV() << w.charstring_start();
else
- w << '/' << _name << ' ' << len + w.lenIV() << w.charstring_start();
+ w << '/' << _name << ' ' << len + w.lenIV() << w.charstring_start();
if (w.lenIV() < 0) {
- // lenIV < 0 means charstrings are unencrypted
- w.print((const char *)data, len);
+ // lenIV < 0 means charstrings are unencrypted
+ w.print((const char *)data, len);
} else {
- // PERFORMANCE NOTE: Putting the charstring in a buffer of known length
- // and printing that buffer rather than one char at a time is an OK
- // optimization. (around 10%)
- unsigned char *buf = new unsigned char[len + w.lenIV()];
- unsigned char *t = buf;
-
- int r = t1R_cs;
- for (int i = 0; i < w.lenIV(); i++) {
- unsigned char c = (unsigned char)(r >> 8);
- *t++ = c;
- r = ((c + r) * t1C1 + t1C2) & 0xFFFF;
- }
- for (int i = 0; i < len; i++, data++) {
- unsigned char c = (*data ^ (r >> 8));
- *t++ = c;
- r = ((c + r) * t1C1 + t1C2) & 0xFFFF;
- }
-
- w.print((char *)buf, len + w.lenIV());
- delete[] buf;
+ // PERFORMANCE NOTE: Putting the charstring in a buffer of known length
+ // and printing that buffer rather than one char at a time is an OK
+ // optimization. (around 10%)
+ unsigned char *buf = new unsigned char[len + w.lenIV()];
+ unsigned char *t = buf;
+
+ int r = t1R_cs;
+ for (int i = 0; i < w.lenIV(); i++) {
+ unsigned char c = (unsigned char)(r >> 8);
+ *t++ = c;
+ r = ((c + r) * t1C1 + t1C2) & 0xFFFF;
+ }
+ for (int i = 0; i < len; i++, data++) {
+ unsigned char c = (*data ^ (r >> 8));
+ *t++ = c;
+ r = ((c + r) * t1C1 + t1C2) & 0xFFFF;
+ }
+
+ w.print((char *)buf, len + w.lenIV());
+ delete[] buf;
}
w << _definer << '\n';
@@ -774,34 +774,34 @@ Type1SubrGroupItem::gen(Type1Writer &w)
int pos = _value.find_left(_is_subrs ? " array" : " dict");
if (pos >= 1 && isdigit((unsigned char) _value[pos - 1])) {
- int numpos = pos - 1;
- while (numpos >= 1 && isdigit((unsigned char) _value[numpos - 1]))
- numpos--;
-
- int n;
- if (_is_subrs) {
- n = font->nsubrs();
- while (n && !font->subr(n - 1))
- n--;
- } else
- n = font->nglyphs();
-
- w << _value.substring(0, numpos) << n << _value.substring(pos);
+ int numpos = pos - 1;
+ while (numpos >= 1 && isdigit((unsigned char) _value[numpos - 1]))
+ numpos--;
+
+ int n;
+ if (_is_subrs) {
+ n = font->nsubrs();
+ while (n && !font->subr(n - 1))
+ n--;
+ } else
+ n = font->nglyphs();
+
+ w << _value.substring(0, numpos) << n << _value.substring(pos);
} else
- w << _value;
+ w << _value;
w << '\n';
if (_is_subrs) {
- int count = font->nsubrs();
- for (int i = 0; i < count; i++)
- if (Type1Subr *g = font->subr_x(i))
- g->gen(w);
+ int count = font->nsubrs();
+ for (int i = 0; i < count; i++)
+ if (Type1Subr *g = font->subr_x(i))
+ g->gen(w);
} else {
- int count = font->nglyphs();
- for (int i = 0; i < count; i++)
- if (Type1Subr *g = font->glyph_x(i))
- g->gen(w);
+ int count = font->nglyphs();
+ for (int i = 0; i < count; i++)
+ if (Type1Subr *g = font->glyph_x(i))
+ g->gen(w);
}
w << _end_text;
@@ -826,7 +826,7 @@ Type1IncludedFont::gen(Type1Writer &w)
{
FILE *f = tmpfile();
if (!f)
- return;
+ return;
// write included font
Type1PFAWriter new_w(f);
@@ -849,10 +849,10 @@ Type1IncludedFont::gen(Type1Writer &w)
rewind(f);
char str[2048];
while (1) {
- int r = fread(str, 1, 2048, f);
- if (r <= 0)
- break;
- w.print(str, r);
+ int r = fread(str, 1, 2048, f);
+ if (r <= 0)
+ break;
+ w.print(str, r);
}
fclose(f);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1mm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1mm.cc
index e6fc7dd57d4..c15d103d94c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1mm.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1mm.cc
@@ -41,7 +41,7 @@ MultipleMasterSpace::set_master_positions(const Vector<NumVector> &mp)
void
MultipleMasterSpace::set_normalize(const Vector<NumVector> &nin,
- const Vector<NumVector> &nout)
+ const Vector<NumVector> &nout)
{
_normalize_in = nin;
_normalize_out = nout;
@@ -76,15 +76,15 @@ PermString
MultipleMasterSpace::axis_abbreviation(PermString atype)
{
if (atype == "Weight")
- return "wt";
+ return "wt";
else if (atype == "Width")
- return "wd";
+ return "wd";
else if (atype == "OpticalSize")
- return "op";
+ return "op";
else if (atype == "Style")
- return "st";
+ return "st";
else
- return atype;
+ return atype;
}
@@ -92,14 +92,14 @@ bool
MultipleMasterSpace::error(ErrorHandler *errh, const char *s, ...) const
{
if (errh) {
- char buf[1024];
- va_list val;
- va_start(val, s);
- assert(strlen(s) < 800);
- sprintf(buf, (s[0] == ' ' ? "%.200s%s" : "%.200s: %s"),
- _font_name.c_str(), s);
- errh->vxmessage(ErrorHandler::e_error, buf, val);
- va_end(val);
+ char buf[1024];
+ va_list val;
+ va_start(val, s);
+ assert(strlen(s) < 800);
+ sprintf(buf, (s[0] == ' ' ? "%.200s%s" : "%.200s: %s"),
+ _font_name.c_str(), s);
+ errh->vxmessage(ErrorHandler::e_error, buf, val);
+ va_end(val);
}
return false;
}
@@ -109,44 +109,44 @@ bool
MultipleMasterSpace::check(ErrorHandler *errh)
{
if (_ok)
- return true;
+ return true;
if (_nmasters <= 0 || _nmasters > 16)
- return error(errh, "number of masters must be between 1 and 16");
+ return error(errh, "number of masters must be between 1 and 16");
if (_naxes <= 0 || _naxes > 4)
- return error(errh, "number of axes must be between 1 and 4");
+ return error(errh, "number of axes must be between 1 and 4");
if (_master_positions.size() != _nmasters)
- return error(errh, "bad BlendDesignPositions");
+ return error(errh, "bad BlendDesignPositions");
for (int i = 0; i < _nmasters; i++)
- if (_master_positions[i].size() != _naxes)
- return error(errh, "inconsistent BlendDesignPositions");
+ if (_master_positions[i].size() != _naxes)
+ return error(errh, "inconsistent BlendDesignPositions");
if (_normalize_in.size() != _naxes || _normalize_out.size() != _naxes)
- return error(errh, "bad BlendDesignMap");
+ return error(errh, "bad BlendDesignMap");
for (int i = 0; i < _naxes; i++)
- if (_normalize_in[i].size() != _normalize_out[i].size())
- return error(errh, "bad BlendDesignMap");
+ if (_normalize_in[i].size() != _normalize_out[i].size())
+ return error(errh, "bad BlendDesignMap");
if (!_axis_types.size())
- _axis_types.assign(_naxes, PermString());
+ _axis_types.assign(_naxes, PermString());
if (_axis_types.size() != _naxes)
- return error(errh, "bad BlendAxisTypes");
+ return error(errh, "bad BlendAxisTypes");
if (!_axis_labels.size())
- _axis_labels.assign(_naxes, PermString());
+ _axis_labels.assign(_naxes, PermString());
if (_axis_labels.size() != _naxes)
- return error(errh, "bad axis labels");
+ return error(errh, "bad axis labels");
if (!_default_design_vector.size())
- _default_design_vector.assign(_naxes, UNKDOUBLE);
+ _default_design_vector.assign(_naxes, UNKDOUBLE);
if (_default_design_vector.size() != _naxes)
- return error(errh, "inconsistent design vector");
+ return error(errh, "inconsistent design vector");
if (!_default_weight_vector.size())
- _default_weight_vector.assign(_nmasters, UNKDOUBLE);
+ _default_weight_vector.assign(_nmasters, UNKDOUBLE);
if (_default_weight_vector.size() != _nmasters)
- return error(errh, "inconsistent weight vector");
+ return error(errh, "inconsistent weight vector");
_ok = true;
return true;
@@ -156,16 +156,16 @@ bool
MultipleMasterSpace::check_intermediate(ErrorHandler *errh)
{
if (!_ok || _cdv)
- return true;
+ return true;
for (int a = 0; a < _naxes; a++)
- for (int m = 0; m < _nmasters; m++)
- if (_master_positions[m][a] != 0 && _master_positions[m][a] != 1) {
- if (errh)
- errh->warning("%s requires intermediate master conversion programs",
- _font_name.c_str());
- return false;
- }
+ for (int m = 0; m < _nmasters; m++)
+ if (_master_positions[m][a] != 0 && _master_positions[m][a] != 1) {
+ if (errh)
+ errh->warning("%s requires intermediate master conversion programs",
+ _font_name.c_str());
+ return false;
+ }
return true;
}
@@ -175,8 +175,8 @@ int
MultipleMasterSpace::axis(PermString ax) const
{
for (int a = 0; a < _naxes; a++)
- if (_axis_types[a] == ax || _axis_labels[a] == ax)
- return a;
+ if (_axis_types[a] == ax || _axis_labels[a] == ax)
+ return a;
return -1;
}
@@ -201,22 +201,22 @@ MultipleMasterSpace::empty_design_vector() const
bool
MultipleMasterSpace::set_design(NumVector &design_vector, int ax, double value,
- ErrorHandler *errh) const
+ ErrorHandler *errh) const
{
if (ax < 0 || ax >= _naxes)
- return error(errh, " has only %d axes", _naxes);
+ return error(errh, " has only %d axes", _naxes);
if (value < axis_low(ax)) {
- value = axis_low(ax);
- if (errh)
- errh->warning("raising %s's %s to %g", _font_name.c_str(),
- _axis_types[ax].c_str(), value);
+ value = axis_low(ax);
+ if (errh)
+ errh->warning("raising %s's %s to %g", _font_name.c_str(),
+ _axis_types[ax].c_str(), value);
}
if (value > axis_high(ax)) {
- value = axis_high(ax);
- if (errh)
- errh->warning("lowering %s's %s to %g", _font_name.c_str(),
- _axis_types[ax].c_str(), value);
+ value = axis_high(ax);
+ if (errh)
+ errh->warning("lowering %s's %s to %g", _font_name.c_str(),
+ _axis_types[ax].c_str(), value);
}
design_vector[ax] = value;
@@ -225,13 +225,13 @@ MultipleMasterSpace::set_design(NumVector &design_vector, int ax, double value,
bool
MultipleMasterSpace::set_design(NumVector &design_vector, PermString ax_name,
- double val, ErrorHandler *errh) const
+ double val, ErrorHandler *errh) const
{
int ax = axis(ax_name);
if (ax < 0)
- return error(errh, " has no `%s' axis", ax_name.c_str());
+ return error(errh, " has no `%s' axis", ax_name.c_str());
else
- return set_design(design_vector, ax, val, errh);
+ return set_design(design_vector, ax, val, errh);
}
@@ -242,47 +242,47 @@ MultipleMasterSpace::normalize_vector(ErrorHandler *errh) const
NumVector &norm_design = *_norm_design_vector;
for (int a = 0; a < _naxes; a++)
- if (!KNOWN(design[a])) {
- if (errh)
- errh->error("must specify %s's %s coordinate", _font_name.c_str(), _axis_types[a].c_str());
- return false;
- }
+ if (!KNOWN(design[a])) {
+ if (errh)
+ errh->error("must specify %s's %s coordinate", _font_name.c_str(), _axis_types[a].c_str());
+ return false;
+ }
// Move to normalized design coordinates.
norm_design.assign(_naxes, UNKDOUBLE);
if (_ndv) {
- CharstringInterp ai;
- if (!ai.interpret(this, &_ndv))
- return error(errh, "%s in NDV program", ai.error_string().c_str());
+ CharstringInterp ai;
+ if (!ai.interpret(this, &_ndv))
+ return error(errh, "%s in NDV program", ai.error_string().c_str());
} else
- for (int a = 0; a < _naxes; a++) {
- double d = design[a];
- double nd = UNKDOUBLE;
- const Vector<double> &norm_in = _normalize_in[a];
- const Vector<double> &norm_out = _normalize_out[a];
-
- if (d < norm_in[0])
- nd = norm_out[0];
- for (int i = 1; i < norm_in.size(); i++)
- if (d >= norm_in[i-1] && d < norm_in[i]) {
- nd = norm_out[i-1]
- + ((d - norm_in[i-1])
- * (norm_out[i] - norm_out[i-1])
- / (norm_in[i] - norm_in[i-1]));
- goto done;
- }
- if (d >= norm_in.back())
- nd = norm_out.back();
-
- done:
- norm_design[a] = nd;
- }
+ for (int a = 0; a < _naxes; a++) {
+ double d = design[a];
+ double nd = UNKDOUBLE;
+ const Vector<double> &norm_in = _normalize_in[a];
+ const Vector<double> &norm_out = _normalize_out[a];
+
+ if (d < norm_in[0])
+ nd = norm_out[0];
+ for (int i = 1; i < norm_in.size(); i++)
+ if (d >= norm_in[i-1] && d < norm_in[i]) {
+ nd = norm_out[i-1]
+ + ((d - norm_in[i-1])
+ * (norm_out[i] - norm_out[i-1])
+ / (norm_in[i] - norm_in[i-1]));
+ goto done;
+ }
+ if (d >= norm_in.back())
+ nd = norm_out.back();
+
+ done:
+ norm_design[a] = nd;
+ }
for (int a = 0; a < _naxes; a++)
- if (!KNOWN(norm_design[a]))
- return error(errh, "bad normalization");
+ if (!KNOWN(norm_design[a]))
+ return error(errh, "bad normalization");
return true;
}
@@ -297,20 +297,20 @@ MultipleMasterSpace::convert_vector(ErrorHandler *errh) const
weight.assign(_nmasters, 1);
if (_cdv) {
- CharstringInterp ai;
- if (!ai.interpret(this, &_cdv))
- return error(errh, "%s in CDV program", ai.error_string().c_str());
+ CharstringInterp ai;
+ if (!ai.interpret(this, &_cdv))
+ return error(errh, "%s in CDV program", ai.error_string().c_str());
} else
- for (int a = 0; a < _naxes; a++)
- for (int m = 0; m < _nmasters; m++) {
- if (_master_positions[m][a] == 0)
- weight[m] *= 1 - norm_design[a];
- else if (_master_positions[m][a] == 1)
- weight[m] *= norm_design[a];
- else
- return error(errh, " requires intermediate master conversion programs");
- }
+ for (int a = 0; a < _naxes; a++)
+ for (int m = 0; m < _nmasters; m++) {
+ if (_master_positions[m][a] == 0)
+ weight[m] *= 1 - norm_design[a];
+ else if (_master_positions[m][a] == 1)
+ weight[m] *= norm_design[a];
+ else
+ return error(errh, " requires intermediate master conversion programs");
+ }
return true;
}
@@ -318,8 +318,8 @@ MultipleMasterSpace::convert_vector(ErrorHandler *errh) const
bool
MultipleMasterSpace::design_to_norm_design(const NumVector &design_in,
- NumVector &norm_design,
- ErrorHandler *errh) const
+ NumVector &norm_design,
+ ErrorHandler *errh) const
{
NumVector design(design_in);
NumVector weight;
@@ -328,7 +328,7 @@ MultipleMasterSpace::design_to_norm_design(const NumVector &design_in,
_norm_design_vector = &norm_design;
_weight_vector = &weight;
if (!normalize_vector(errh))
- return false;
+ return false;
_design_vector = _norm_design_vector = _weight_vector = 0;
return true;
@@ -343,33 +343,33 @@ MultipleMasterSpace::design_to_weight(const NumVector &design_in, NumVector &wei
bool dirty = false;
for (int i = 0; i < _naxes; i++)
- if (design[i] != _default_design_vector[i])
- dirty = true;
+ if (design[i] != _default_design_vector[i])
+ dirty = true;
if (dirty) {
- _design_vector = &design;
- _norm_design_vector = &norm_design;
- _weight_vector = &weight;
- if (!normalize_vector(errh))
- return false;
- if (!convert_vector(errh))
- return false;
- _design_vector = _norm_design_vector = _weight_vector = 0;
+ _design_vector = &design;
+ _norm_design_vector = &norm_design;
+ _weight_vector = &weight;
+ if (!normalize_vector(errh))
+ return false;
+ if (!convert_vector(errh))
+ return false;
+ _design_vector = _norm_design_vector = _weight_vector = 0;
} else
- weight = _default_weight_vector;
+ weight = _default_weight_vector;
double sum = 0;
for (int m = 0; m < _nmasters; m++)
- sum += weight[m];
+ sum += weight[m];
if (sum < 0.9999 || sum > 1.0001)
- return error(errh, "bad conversion: weight vector doesn't sum to 1");
+ return error(errh, "bad conversion: weight vector doesn't sum to 1");
// adjust weight vector to max 4 decimal digits of precision, and make it
// sum to exactly 1
sum = 0;
for (int m = 0; m < _nmasters - 1; m++) {
- weight[m] = floor(weight[m] * 10000. + 0.5) / 10000.;
- sum += weight[m];
+ weight[m] = floor(weight[m] * 10000. + 0.5) / 10000.;
+ sum += weight[m];
}
weight[_nmasters - 1] = 1 - sum;
@@ -381,13 +381,13 @@ Vector<double> *
MultipleMasterSpace::mm_vector(VectorType t, bool writable) const
{
if (t == VEC_WEIGHT)
- return _weight_vector;
+ return _weight_vector;
else if (t == VEC_NORM_DESIGN)
- return _norm_design_vector;
+ return _norm_design_vector;
else if (t == VEC_DESIGN && !writable)
- return _design_vector;
+ return _design_vector;
else
- return 0;
+ return 0;
}
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1rw.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1rw.cc
index 846297e6b67..2adff1e8ac8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1rw.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1rw.cc
@@ -31,7 +31,7 @@ void
Type1Reader::static_initialize()
{
if (xvalue['A'])
- return;
+ return;
// rely on static data being initialized to 0
xvalue['0'] = 0; xvalue['1'] = 1; xvalue['2'] = 2; xvalue['3'] = 3;
xvalue['4'] = 4; xvalue['5'] = 5; xvalue['6'] = 6; xvalue['7'] = 7;
@@ -66,26 +66,26 @@ void
Type1Reader::switch_eexec(bool on, unsigned char *data, int len)
{
if (on) {
- if (_pos < len + 3) {
- unsigned char *new_data = new unsigned char[len + 3 + DATA_SIZE];
- assert(_len <= DATA_SIZE);
- memcpy(new_data + len + 3, _data + _pos, _len - _pos);
- _len = len + 3 + _len - _pos;
- _pos = len + 3;
- delete[] _data;
- _data = new_data;
- }
- int original_pos = _pos;
- // don't forget _ungot!!
- if (_ungot >= 0)
- _data[--_pos] = _ungot, _ungot = -1;
- if (_crlf == 0 || _crlf == 2)
- _data[--_pos] = '\n';
- if (_crlf == 1 || _crlf == 2)
- _data[--_pos] = '\r';
- memcpy(_data + _pos - len, data, len);
- _pos -= len;
- start_eexec(original_pos - _pos);
+ if (_pos < len + 3) {
+ unsigned char *new_data = new unsigned char[len + 3 + DATA_SIZE];
+ assert(_len <= DATA_SIZE);
+ memcpy(new_data + len + 3, _data + _pos, _len - _pos);
+ _len = len + 3 + _len - _pos;
+ _pos = len + 3;
+ delete[] _data;
+ _data = new_data;
+ }
+ int original_pos = _pos;
+ // don't forget _ungot!!
+ if (_ungot >= 0)
+ _data[--_pos] = _ungot, _ungot = -1;
+ if (_crlf == 0 || _crlf == 2)
+ _data[--_pos] = '\n';
+ if (_crlf == 1 || _crlf == 2)
+ _data[--_pos] = '\r';
+ memcpy(_data + _pos - len, data, len);
+ _pos -= len;
+ start_eexec(original_pos - _pos);
}
_eexec = on;
}
@@ -97,9 +97,9 @@ Type1Reader::more_data()
_pos = 0;
_len = more_data(_data, DATA_SIZE);
if (_len < 0)
- return -1;
+ return -1;
else
- return _data[_pos++];
+ return _data[_pos++];
}
@@ -107,9 +107,9 @@ inline int
Type1Reader::get_base()
{
if (_pos >= _len)
- return more_data();
+ return more_data();
else
- return _data[_pos++];
+ return _data[_pos++];
}
@@ -127,13 +127,13 @@ Type1Reader::ascii_eexec_get()
{
int d1 = get_base();
while (isspace(d1))
- d1 = get_base();
+ d1 = get_base();
int d2 = get_base();
while (isspace(d2))
- d2 = get_base();
+ d2 = get_base();
if (d2 < 0)
- return -1;
+ return -1;
return eexec((xvalue[d1] << 4) | (xvalue[d2]));
}
@@ -143,14 +143,14 @@ inline int
Type1Reader::get()
{
if (!_eexec)
- return get_base();
+ return get_base();
else if (_binary_eexec) {
- int c = get_base();
- return c < 0 ? c : eexec(c);
+ int c = get_base();
+ return c < 0 ? c : eexec(c);
} else
- return ascii_eexec_get();
+ return ascii_eexec_get();
}
@@ -169,30 +169,30 @@ Type1Reader::start_eexec(int initial_ascii)
of PFB fonts; but it turns out some PFBs would be unreadable with that
pedantic rule. */
while (isspace(c) && (initial_ascii >= 0 || !preserve_whitespace()))
- c = get_base(), initial_ascii--;
+ c = get_base(), initial_ascii--;
/* Differentiate between ASCII eexec and binary eexec. */
int rand_bytes[4];
_binary_eexec = false;
for (int i = 0; i < 4; i++) {
- if (i)
- c = get_base();
- rand_bytes[i] = c;
- if (!isxdigit(c))
- _binary_eexec = true;
+ if (i)
+ c = get_base();
+ rand_bytes[i] = c;
+ if (!isxdigit(c))
+ _binary_eexec = true;
}
_r = t1R_ee;
if (_binary_eexec)
- for (int i = 0; i < 4; i++)
- eexec(rand_bytes[i]);
+ for (int i = 0; i < 4; i++)
+ eexec(rand_bytes[i]);
else {
- for (int i = 0; i < 2; i++) {
- c = xvalue[rand_bytes[i*2]] * 16 + xvalue[rand_bytes[i*2+1]];
- eexec(c);
- }
- ascii_eexec_get();
- ascii_eexec_get();
+ for (int i = 0; i < 2; i++) {
+ c = xvalue[rand_bytes[i*2]] * 16 + xvalue[rand_bytes[i*2+1]];
+ eexec(c);
+ }
+ ascii_eexec_get();
+ ascii_eexec_get();
}
}
@@ -204,38 +204,38 @@ Type1Reader::test_charstring(StringAccum &str)
more efficient cut time by about 40%. */
if (!_charstring_definer)
- return false;
+ return false;
if (_charstring_len >= 0)
- return str.length() <= _charstring_start + _charstring_len;
+ return str.length() <= _charstring_start + _charstring_len;
- str.append('\0'); // protect against running off end of string
+ str.append('\0'); // protect against running off end of string
char *s = str.data();
char *start;
while (*s == ' ')
- s++;
+ s++;
if (s[0] == '/')
- s++;
+ s++;
else if (s[0] == 'd' && s[1] == 'u' && s[2] == 'p' && isspace((unsigned char) s[3])) {
- s += 4;
- // 17.Jan.2000 -- some fonts have extra space here.
- while (isspace((unsigned char) *s))
- s++;
+ s += 4;
+ // 17.Jan.2000 -- some fonts have extra space here.
+ while (isspace((unsigned char) *s))
+ s++;
} else
- goto not_charstring;
+ goto not_charstring;
// Force one literal space rather than isspace().
// Why? Consistency: we force 1 literal space around _charstring_definer.
while (*s != ' ' && *s)
- s++;
+ s++;
if (*s++ != ' ' || !isdigit((unsigned char) *s))
- goto not_charstring;
+ goto not_charstring;
start = s;
s++;
while (*s != ' ' && *s)
- s++;
+ s++;
if (strncmp(s, _charstring_definer.c_str(), _charstring_definer.length()) != 0)
- goto not_charstring;
+ goto not_charstring;
_charstring_len = strtol(start, 0, 10);
_charstring_start = (s - str.data()) + _charstring_definer.length();
@@ -257,7 +257,7 @@ bool
Type1Reader::next_line(StringAccum &s)
{
if (_len < 0)
- return false;
+ return false;
// Can't be a charstring if incoming accumulator has nonzero length.
_charstring_start = 0;
@@ -267,33 +267,33 @@ Type1Reader::next_line(StringAccum &s)
_ungot = -1;
for (int c = first_char; c >= 0; c = get())
- switch (c) {
-
- case '\n':
- if (test_charstring(s))
- goto normal;
- else {
- _crlf = 0;
- goto done;
- }
-
- case '\r':
- // check for \r\n (counts as only one line ending)
- if (test_charstring(s))
- goto normal;
- c = get();
- if (c != '\n' || preserve_whitespace())
- _ungot = c, _crlf = 1;
- else
- _crlf = 2;
- goto done;
-
- normal:
- default:
- s.append((char)c);
- break;
-
- }
+ switch (c) {
+
+ case '\n':
+ if (test_charstring(s))
+ goto normal;
+ else {
+ _crlf = 0;
+ goto done;
+ }
+
+ case '\r':
+ // check for \r\n (counts as only one line ending)
+ if (test_charstring(s))
+ goto normal;
+ c = get();
+ if (c != '\n' || preserve_whitespace())
+ _ungot = c, _crlf = 1;
+ else
+ _crlf = 2;
+ goto done;
+
+ normal:
+ default:
+ s.append((char)c);
+ break;
+
+ }
done:
return true;
@@ -304,22 +304,22 @@ int
Type1Reader::get_data(unsigned char *data, int len)
{
if (_len < 0)
- return -1;
+ return -1;
if (len <= 0)
- return 0;
+ return 0;
int pos = 0;
if (_ungot >= 0) {
- *data++ = _ungot;
- pos++;
- _ungot = -1;
+ *data++ = _ungot;
+ pos++;
+ _ungot = -1;
}
for (; pos < len; pos++) {
- int c = get();
- if (c < 0)
- break;
- *data++ = c;
+ int c = get();
+ if (c < 0)
+ break;
+ *data++ = c;
}
return pos;
@@ -356,26 +356,26 @@ int
Type1PFBReader::more_data(unsigned char *data, int len)
{
while (_left == 0) {
- int c = getc(_f);
- if (c != 128)
- return -1;
-
- c = getc(_f);
- if (c == 3 || c < 1 || c > 3)
- return -1;
- _binary = (c == 2);
-
- _left = getc(_f);
- _left |= getc(_f) << 8;
- _left |= getc(_f) << 16;
- _left |= getc(_f) << 24;
+ int c = getc(_f);
+ if (c != 128)
+ return -1;
+
+ c = getc(_f);
+ if (c == 3 || c < 1 || c > 3)
+ return -1;
+ _binary = (c == 2);
+
+ _left = getc(_f);
+ _left |= getc(_f) << 8;
+ _left |= getc(_f) << 16;
+ _left |= getc(_f) << 24;
}
if (_left < 0)
- return -1;
+ return -1;
if (len > _left)
- len = _left;
+ len = _left;
_left -= len;
return fread(data, 1, len, _f);
@@ -401,12 +401,12 @@ int
Type1SubsetReader::more_data(unsigned char *data, int len)
{
if (_left <= 0)
- return -1;
+ return -1;
if (len > _left)
- len = _left;
+ len = _left;
int how_much = _reader->get_data(data, len);
if (how_much > 0)
- _left -= how_much;
+ _left -= how_much;
return how_much;
}
@@ -459,9 +459,9 @@ void
Type1Writer::local_flush()
{
if (_eexec_start >= 0 && _eexec_end < 0)
- _eexec_end = _pos;
+ _eexec_end = _pos;
for (int p = _eexec_start; p < _eexec_end; p++)
- _buf[p] = eexec(_buf[p]);
+ _buf[p] = eexec(_buf[p]);
print0(_buf, _pos);
_pos = 0;
_eexec_start = _eexec ? 0 : -1;
@@ -473,14 +473,14 @@ void
Type1Writer::print(const char *s, int n)
{
while (n > 0) {
- if (_pos >= BufSize)
- local_flush();
- int copy = BufSize - _pos;
- if (copy > n) copy = n;
- memcpy(_buf + _pos, s, copy);
- _pos += copy;
- s += copy;
- n -= copy;
+ if (_pos >= BufSize)
+ local_flush();
+ int copy = BufSize - _pos;
+ if (copy > n) copy = n;
+ memcpy(_buf + _pos, s, copy);
+ _pos += copy;
+ s += copy;
+ n -= copy;
}
}
@@ -510,11 +510,11 @@ Type1Writer::switch_eexec(bool on)
{
_eexec = on;
if (_eexec) {
- _eexec_start = _pos;
- _r = t1R_ee;
- print("SUCK", 4);
+ _eexec_start = _pos;
+ _r = t1R_ee;
+ print("SUCK", 4);
} else
- _eexec_end = _pos;
+ _eexec_end = _pos;
}
@@ -545,18 +545,18 @@ void
Type1PFAWriter::print0(const unsigned char *c, int l)
{
if (eexecing()) {
- const char *hex = "0123456789ABCDEF";
- for (; l; c++, l--) {
- putc(hex[*c / 16], _f);
- putc(hex[*c % 16], _f);
- if (++_hex_line == 39) {
- putc('\n', _f);
- _hex_line = 0;
- }
- }
+ const char *hex = "0123456789ABCDEF";
+ for (; l; c++, l--) {
+ putc(hex[*c / 16], _f);
+ putc(hex[*c % 16], _f);
+ if (++_hex_line == 39) {
+ putc('\n', _f);
+ _hex_line = 0;
+ }
+ }
} else {
- ssize_t result = fwrite(c, 1, l, _f);
- (void) result;
+ ssize_t result = fwrite(c, 1, l, _f);
+ (void) result;
}
}
@@ -582,16 +582,16 @@ Type1PFBWriter::flush()
{
Type1Writer::flush();
if (_save.length()) {
- fputc(128, _f);
- fputc(_binary ? 2 : 1, _f);
- long l = _save.length();
- fputc(l & 0xFF, _f);
- fputc((l >> 8) & 0xFF, _f);
- fputc((l >> 16) & 0xFF, _f);
- fputc((l >> 24) & 0xFF, _f);
- ssize_t result = fwrite(_save.data(), 1, _save.length(), _f);
- (void) result;
- _save.clear();
+ fputc(128, _f);
+ fputc(_binary ? 2 : 1, _f);
+ long l = _save.length();
+ fputc(l & 0xFF, _f);
+ fputc((l >> 8) & 0xFF, _f);
+ fputc((l >> 16) & 0xFF, _f);
+ fputc((l >> 24) & 0xFF, _f);
+ ssize_t result = fwrite(_save.data(), 1, _save.length(), _f);
+ (void) result;
+ _save.clear();
}
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1unparser.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1unparser.cc
index 993253deec9..e7714e34b03 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/t1unparser.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/t1unparser.cc
@@ -43,10 +43,10 @@ bool
CharstringUnparser::number(double n)
{
if (_start_of_line) {
- _sa << _indent;
- _start_of_line = false;
+ _sa << _indent;
+ _start_of_line = false;
} else
- _sa << ' ';
+ _sa << ' ';
_sa << n;
return true;
}
@@ -55,17 +55,17 @@ bool
CharstringUnparser::type1_command(int cmd)
{
if (_start_of_line) {
- _sa << _indent;
- _start_of_line = false;
+ _sa << _indent;
+ _start_of_line = false;
} else
- _sa << ' ';
+ _sa << ' ';
if (cmd >= 0 && cmd <= Cs::cLastCommand)
- _sa << Cs::command_names[cmd];
+ _sa << Cs::command_names[cmd];
else
- _sa << "UNKNOWN_12_" << (cmd - 32);
+ _sa << "UNKNOWN_12_" << (cmd - 32);
if (_one_command_per_line) {
- _sa << '\n';
- _start_of_line = true;
+ _sa << '\n';
+ _start_of_line = true;
}
return true;
}
@@ -74,26 +74,26 @@ bool
CharstringUnparser::type2_command(int cmd, const unsigned char *data, int *left)
{
if (_start_of_line) {
- _sa << _indent;
- _start_of_line = false;
+ _sa << _indent;
+ _start_of_line = false;
} else
- _sa << ' ';
+ _sa << ' ';
if (cmd >= 0 && cmd <= Cs::cLastCommand)
- _sa << Cs::command_names[cmd];
+ _sa << Cs::command_names[cmd];
else
- _sa << "UNKNOWN_12_" << (cmd - 32);
+ _sa << "UNKNOWN_12_" << (cmd - 32);
switch (cmd) {
case Cs::cHstem: case Cs::cHstemhm: case Cs::cVstem: case Cs::cVstemhm:
case Cs::cHintmask: case Cs::cCntrmask:
- CharstringInterp::type2_command(cmd, data, left);
- break;
+ CharstringInterp::type2_command(cmd, data, left);
+ break;
}
if (_one_command_per_line) {
- _sa << '\n';
- _start_of_line = true;
+ _sa << '\n';
+ _start_of_line = true;
}
return true;
@@ -104,7 +104,7 @@ CharstringUnparser::act_hintmask(int, const unsigned char *data, int nhints)
{
_sa << '[';
for (int i = 0; i < nhints; i++, data++)
- sprintf(_sa.extend(2), "%02X", *data);
+ sprintf(_sa.extend(2), "%02X", *data);
_sa << ']';
}
@@ -119,11 +119,11 @@ String
CharstringUnparser::unparse(const Charstring *cs)
{
if (cs) {
- CharstringUnparser u;
- u.interpret(0, cs);
- return u.value();
+ CharstringUnparser u;
+ u.interpret(0, cs);
+ return u.value();
} else
- return "(null)";
+ return "(null)";
}
String
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfcs.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfcs.cc
new file mode 100644
index 00000000000..7e204894df4
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfcs.cc
@@ -0,0 +1,232 @@
+// -*- related-file-name: "../include/efont/ttfcs.hh" -*-
+
+/* ttfcs.{cc,hh} -- TrueType "charstring" emulation
+ *
+ * Copyright (c) 2006-2014 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/ttfcs.hh>
+#include <efont/ttfhead.hh>
+#include <efont/t1csgen.hh>
+#include <efont/otfpost.hh>
+#include <efont/otfcmap.hh>
+#include <lcdf/hashmap.hh>
+#include <algorithm>
+namespace Efont {
+typedef OpenType::Glyph Glyph;
+
+TrueTypeBoundsCharstringProgram::TrueTypeBoundsCharstringProgram(const OpenType::Font* otf)
+ : CharstringProgram(otf->units_per_em()),
+ _otf(otf), _nglyphs(-1), _loca_long(false),
+ _loca(otf->table("loca")), _glyf(otf->table("glyf")),
+ _hmtx(otf->table("hmtx")), _got_glyph_names(false), _got_unicodes(false)
+{
+ OpenType::Data maxp(otf->table("maxp"));
+ if (maxp.length() >= 6)
+ _nglyphs = maxp.u16(4);
+
+ OpenType::Head head(otf->table("head"), 0);
+ if (head.ok())
+ _loca_long = head.index_to_loc_format() != 0;
+ if (_loca_long)
+ _loca.align_long();
+ int loca_onesize = (_loca_long ? 4 : 2);
+ if (_nglyphs >= _loca.length() / loca_onesize)
+ _nglyphs = (_loca.length() / loca_onesize) - 1;
+
+ // horizontal metrics
+ OpenType::Data hhea(_otf->table("hhea"));
+ // HHEA format:
+ // 0 Fixed Table version number 0x00010000 for version 1.0.
+ // 4 FWORD Ascender
+ // 6 FWORD Descender
+ // 8 FWORD LineGap
+ // 10 UFWORD advanceWidthMax
+ // 12 FWORD minLeftSideBearing
+ // 14 FWORD minRightSideBearing
+ // 16 FWORD xMaxExtent
+ // 18 SHORT caretSlopeRise
+ // 20 SHORT caretSlopeRun
+ // 22 SHORT caretOffset
+ // 24 SHORT (reserved)
+ // 26 SHORT (reserved)
+ // 28 SHORT (reserved)
+ // 30 SHORT (reserved)
+ // 32 SHORT metricDataFormat
+ // 34 USHORT numberOfHMetrics
+ if (hhea.length() >= 36
+ && hhea.u32(0) == 0x10000)
+ _nhmtx = hhea.u16(34);
+ if (_nhmtx * 4 > _hmtx.length())
+ _nhmtx = _hmtx.length() / 4;
+}
+
+TrueTypeBoundsCharstringProgram::~TrueTypeBoundsCharstringProgram()
+{
+ for (Charstring **cs = _charstrings.begin(); cs < _charstrings.end(); cs++)
+ delete *cs;
+}
+
+void TrueTypeBoundsCharstringProgram::font_matrix(double matrix[6]) const {
+ matrix[0] = matrix[3] = 1.0 / _otf->units_per_em();
+ matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
+}
+
+int
+TrueTypeBoundsCharstringProgram::nglyphs() const
+{
+ return _nglyphs;
+}
+
+PermString
+TrueTypeBoundsCharstringProgram::glyph_name(int gi) const
+{
+ // generate glyph names based on what pdftex can understand
+ if (gi == 0)
+ return PermString(".notdef");
+
+ // try 'post' table glyph names
+ if (!_got_glyph_names) {
+ OpenType::Post post(_otf->table("post"));
+ if (post.ok())
+ post.glyph_names(_glyph_names);
+ HashMap<PermString, int> name2glyph(-1);
+ // some 'post' tables are bogus, reject multiply-encoded names
+ for (int gi = 0; gi < _glyph_names.size(); ++gi) {
+ int& xgi = name2glyph.find_force(_glyph_names[gi]);
+ if (xgi == -1)
+ xgi = gi;
+ else if (xgi == 0)
+ _glyph_names[gi] = PermString();
+ else
+ _glyph_names[gi] = _glyph_names[xgi] = PermString();
+ }
+ _got_glyph_names = true;
+ }
+ if (gi >= 0 && gi < _glyph_names.size() && _glyph_names[gi])
+ return _glyph_names[gi];
+
+ // try 'uniXXXX' names
+ if (!_got_unicodes) {
+ OpenType::Cmap cmap(_otf->table("cmap"));
+ if (cmap.ok()) {
+ Vector<std::pair<uint32_t, Glyph> > ugp;
+ cmap.unmap_all(ugp);
+ std::sort(ugp.begin(), ugp.end());
+ for (Vector<std::pair<uint32_t, Glyph> >::iterator it = ugp.begin();
+ it != ugp.end(); ) {
+ Vector<std::pair<uint32_t, Glyph> >::iterator nit = it + 1;
+ // ignore code points with multiple glyph mappings
+ if (nit == ugp.end() || nit->first != it->first) {
+ if (it->second >= _unicodes.size())
+ _unicodes.resize(it->second + 1, 0);
+ if (!_unicodes[it->second])
+ _unicodes[it->second] = it->first;
+ } else
+ while (nit != ugp.end() && nit->first == it->first)
+ ++nit;
+ it = nit;
+ }
+ }
+ _got_unicodes = true;
+ }
+
+ if (gi >= 0 && gi < _unicodes.size() && _unicodes[gi] > 0 && _unicodes[gi] <= 0xFFFF) {
+ char buf[10];
+ sprintf(buf, "uni%04X", _unicodes[gi]);
+ return PermString(buf);
+ } else
+ return permprintf("index%d", gi);
+}
+
+void
+TrueTypeBoundsCharstringProgram::glyph_names(Vector<PermString> &gn) const
+{
+ gn.clear();
+ for (int gi = 0; gi < _nglyphs; gi++)
+ gn.push_back(glyph_name(gi));
+}
+
+Charstring *
+TrueTypeBoundsCharstringProgram::glyph(int gi) const
+{
+ if (gi < 0 || gi >= _nglyphs)
+ return 0;
+ if (_charstrings.size() <= gi)
+ _charstrings.resize(gi + 1, (Charstring *) 0);
+ if (!_charstrings[gi]) {
+ // calculate glyf offsets
+ uint32_t offset, end_offset;
+ if (_loca_long) {
+ offset = _loca.u32(gi * 4);
+ end_offset = _loca.u32(gi * 4 + 4);
+ } else {
+ offset = _loca.u16(gi * 2) * 2;
+ end_offset = _loca.u16(gi * 2 + 2) * 2;
+ }
+
+ // fetch bounding box from glyf
+ int ncontours, xmin, ymin, xmax, ymax;
+ if (offset != end_offset) {
+ if (offset > end_offset || offset + 10 > end_offset
+ || end_offset > (uint32_t) _glyf.length())
+ return 0;
+
+ ncontours = _glyf.s16(offset);
+ xmin = _glyf.s16(offset + 2);
+ ymin = _glyf.s16(offset + 4);
+ xmax = _glyf.s16(offset + 6);
+ ymax = _glyf.s16(offset + 8);
+ } else
+ ncontours = xmin = ymin = xmax = ymax = 0;
+
+ // fetch horizontal metrics
+ int advance_width, lsb;
+ if (gi >= _nhmtx) {
+ advance_width = (_nhmtx ? _hmtx.u16((_nhmtx - 1) * 4) : 0);
+ int hmtx_offset = _nhmtx * 4 + (gi - _nhmtx) * 2;
+ lsb = (hmtx_offset + 2 <= _hmtx.length() ? _hmtx.s16(hmtx_offset) : 0);
+ } else {
+ advance_width = _hmtx.u16(gi * 4);
+ lsb = _hmtx.s16(gi * 4 + 2);
+ }
+
+ // make charstring
+ Type1CharstringGen gen;
+ if (ncontours == 0) {
+ gen.gen_number(0, 'X');
+ gen.gen_number(advance_width);
+ gen.gen_command(Charstring::cHsbw);
+ } else {
+ gen.gen_number(lsb, 'X');
+ gen.gen_number(advance_width);
+ gen.gen_command(Charstring::cHsbw);
+ gen.gen_moveto(Point(xmin, ymin), false, false);
+ if (xmax != xmin || ymax == ymin)
+ gen.gen_number(xmax - xmin, 'x');
+ if (ymax != ymin)
+ gen.gen_number(ymax - ymin, 'y');
+ gen.gen_command(ymax == ymin ? Charstring::cHlineto
+ : (xmax == xmin ? Charstring::cVlineto
+ : Charstring::cRlineto));
+ gen.gen_command(Charstring::cClosepath);
+ }
+ gen.gen_command(Charstring::cEndchar);
+
+ _charstrings[gi] = gen.output();
+ }
+ return _charstrings[gi];
+}
+
+}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfhead.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfhead.cc
index 5be8676c64c..d80f306d340 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfhead.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfhead.cc
@@ -36,33 +36,33 @@ int
Head::parse_header(ErrorHandler *errh)
{
// HEAD format:
- // 0 Fixed Table version number 0x00010000 (ver. 1.0)
- // 4 Fixed fontRevision
- // 8 ULONG checkSumAdjustment
- // 12 ULONG magicNumber Set to 0x5F0F3CF5
- // 16 USHORT flags
- // 18 USHORT unitsPerEm
- // 20 LONGDATETIME created
- // 28 LONGDATETIME modified
- // 36 USHORT xMin
- // 38 SHORT yMin
- // 40 SHORT xMax
- // 42 SHORT yMax
- // 44 USHORT macStyle
- // 46 USHORT lowestRecPPEM
- // 48 SHORT fontDirectionHint
- // 50 SHORT indexToLocFormat
- // 52 SHORT glyphDataFormat
+ // 0 Fixed Table version number 0x00010000 (ver. 1.0)
+ // 4 Fixed fontRevision
+ // 8 ULONG checkSumAdjustment
+ // 12 ULONG magicNumber Set to 0x5F0F3CF5
+ // 16 USHORT flags
+ // 18 USHORT unitsPerEm
+ // 20 LONGDATETIME created
+ // 28 LONGDATETIME modified
+ // 36 USHORT xMin
+ // 38 SHORT yMin
+ // 40 SHORT xMax
+ // 42 SHORT yMax
+ // 44 USHORT macStyle
+ // 46 USHORT lowestRecPPEM
+ // 48 SHORT fontDirectionHint
+ // 50 SHORT indexToLocFormat
+ // 52 SHORT glyphDataFormat
int len = _d.length();
const uint8_t *data = _d.udata();
if (len == 0)
- return errh->error("font has no 'head' table"), -EFAULT;
+ return errh->error("font has no 'head' table"), -EFAULT;
if (54 > len)
- return errh->error("'head' table too small"), -EFAULT;
+ return errh->error("'head' table too small"), -EFAULT;
if (!(data[0] == '\000' && data[1] == '\001'))
- return errh->error("bad 'head' version number"), -ERANGE;
+ return errh->error("bad 'head' version number"), -ERANGE;
if (_d.u32(12) != 0x5F0F3CF5)
- return errh->error("bad 'head' magic number"), -ERANGE;
+ return errh->error("bad 'head' magic number"), -ERANGE;
return 0;
}
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfkern.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfkern.cc
index 824922457ac..40fda22a7ed 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/libefont/ttfkern.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/libefont/ttfkern.cc
@@ -31,13 +31,13 @@ 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);
+ if (_d.u16(off) != 0)
+ throw new Format("kern subtable");
+ len = _d.u16(off + 2);
} else
- len = _d.u32(off);
+ len = _d.u32(off);
if (len < 6 || off + len > (uint32_t) _d.length())
- throw new Bounds();
+ throw new Bounds();
off_in_out = off + len;
return _d.substring(off, len);
}
@@ -45,25 +45,25 @@ KernTable::subtable(uint32_t &off_in_out) const throw (Error)
KernTable::KernTable(const Data &d, ErrorHandler *) throw (Error)
: _d(d), _error(-1)
{
- // USHORT Version
- // USHORT nTables
+ // USHORT Version
+ // USHORT nTables
if (d.length() == 0)
- throw BlankTable("kern");
+ throw BlankTable("kern");
uint32_t ntables, off;
if (d.u16(0) == 0) {
- ntables = d.u16(2);
- _version = 0;
- off = 4;
+ ntables = d.u16(2);
+ _version = 0;
+ off = 4;
} else if (d.u16(0) == 1) {
- ntables = d.u32(4);
- _version = 1;
- off = 8;
+ ntables = d.u32(4);
+ _version = 1;
+ off = 8;
} else
- throw Format("kern");
+ throw Format("kern");
for (uint32_t i = 0; i < ntables; ++i)
- (void) subtable(off);
+ (void) subtable(off);
_error = 0;
}
@@ -75,37 +75,37 @@ KernTable::unparse_automatics(Vector<Positioning> &v, ErrorHandler *errh) const
uint32_t off = first_offset();
int success = 0;
if (_error < 0)
- return false;
+ return false;
for (uint16_t i = 0; i < ntables; ++i) {
- Data subt = _d.subtable(off);
- uint16_t coverage = subt.u16(4);
+ 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;
- }
+ 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());
- }
+ 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;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.am
index f096b1c41bf..f096b1c41bf 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.in
index b64fe969ad2..a7bf4cf2dbe 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@FIXLIBC_TRUE@am__append_1 = fixlibc.c
-subdir = lcdf-typetools-2.104/liblcdf
+subdir = lcdf-typetools-2.105/liblcdf
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -371,9 +371,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/liblcdf/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/liblcdf/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/liblcdf/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/liblcdf/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/bezier.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/bezier.cc
index 95c8d8b9fb0..95c8d8b9fb0 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/bezier.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/bezier.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/clp.c b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/clp.c
index a797ac26967..a797ac26967 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/clp.c
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/clp.c
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/error.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/error.cc
index 8fe054b21ab..75291f1da70 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/error.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/error.cc
@@ -319,8 +319,14 @@ ErrorHandler::clean_landmark(const String &landmark, bool with_colon)
#define NUMBUF_SIZE 128
#define ErrH ErrorHandler
-static char *
-do_number(uintptr_t num, char *after_last, int base, int flags)
+#if SIZEOF_UNSIGNED_LONG >= SIZEOF_VOID_P
+typedef unsigned long do_number_t;
+#else
+typedef uintptr_t do_number_t;
+#endif
+
+static char*
+do_number(do_number_t num, char *after_last, int base, int flags)
{
const char *digits =
((flags & ErrH::cf_uppercase) ? "0123456789ABCDEF" : "0123456789abcdef");
@@ -666,11 +672,10 @@ ErrorHandler::vxformat(int default_flags, const char *s, va_list val)
if (*s2 == '}')
goto braces;
}
- void *v = va_arg(val, void *);
+ void* v = va_arg(val, void*);
s2 = numbuf + NUMBUF_SIZE;
- s1 = do_number((uintptr_t)v, (char *)s2, 16, flags);
- s1 = do_number_flags((char *)s1, (char *)s2, 16, flags | cf_alternate_form,
- precision, field_width);
+ s1 = do_number((uintptr_t) v, (char*) s2, 16, flags);
+ s1 = do_number_flags((char*) s1, (char*) s2, 16, flags | cf_alternate_form, precision, field_width);
break;
}
@@ -811,14 +816,14 @@ ErrorHandler::error(const char *fmt, ...)
return r;
}
-int
+void
ErrorHandler::fatal(const char *fmt, ...)
{
va_list val;
va_start(val, fmt);
int r = vxmessage(String::make_stable(e_fatal, 4), fmt, val);
va_end(val);
- return r;
+ abort();
}
void
@@ -863,7 +868,7 @@ ErrorHandler::lerror(const String &landmark, const char *fmt, ...)
return r;
}
-int
+void
ErrorHandler::lfatal(const String &landmark, const char *fmt, ...)
{
va_list val;
@@ -871,7 +876,7 @@ ErrorHandler::lfatal(const String &landmark, const char *fmt, ...)
String l = make_landmark_anno(landmark);
int r = vxmessage(String::make_stable(e_fatal, 4) + l, fmt, val);
va_end(val);
- return r;
+ abort();
}
int
@@ -915,6 +920,19 @@ ErrorHandler::emit(const String &, void *user_data, bool)
return user_data;
}
+void
+ErrorHandler::account(int level)
+{
+ if (level <= el_error)
+ ++_nerrors;
+#ifndef __KERNEL__
+ if (level <= el_abort)
+ abort();
+ else if (level <= el_fatal)
+ exit(-level);
+#endif
+}
+
#ifndef __KERNEL__
//
@@ -956,16 +974,6 @@ FileErrorHandler::emit(const String &str, void *, bool)
return 0;
}
-void
-FileErrorHandler::account(int level)
-{
- ErrorHandler::account(level);
- if (level <= el_abort)
- abort();
- else if (level <= el_fatal)
- exit(-level);
-}
-
#endif
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/filename.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/filename.cc
index 396e81cd3c5..396e81cd3c5 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/filename.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/filename.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/fixlibc.c b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/fixlibc.c
index d41238daf85..d41238daf85 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/fixlibc.c
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/fixlibc.c
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/globmatch.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/globmatch.cc
index dcd7afc135c..dcd7afc135c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/globmatch.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/globmatch.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/landmark.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/landmark.cc
index 68511055ddc..68511055ddc 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/landmark.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/landmark.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/md5.c b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/md5.c
index c8508865c20..c8508865c20 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/md5.c
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/md5.c
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/permstr.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/permstr.cc
index c6aebab31e7..c6aebab31e7 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/permstr.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/permstr.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/point.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/point.cc
index 8b23fdcb571..8b23fdcb571 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/point.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/point.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/slurper.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/slurper.cc
index e089617705d..e089617705d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/slurper.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/slurper.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/straccum.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/straccum.cc
index f31b9e216fc..f31b9e216fc 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/straccum.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/straccum.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/string.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/string.cc
index 3561bca38aa..3561bca38aa 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/string.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/string.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/strtonum.c b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/strtonum.c
index 36898c5a7ad..36898c5a7ad 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/strtonum.c
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/strtonum.c
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/transform.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/transform.cc
index 5193cd062d0..5193cd062d0 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/transform.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/transform.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/vectorv.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/vectorv.cc
index f5f12b52c90..f5f12b52c90 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/liblcdf/vectorv.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/liblcdf/vectorv.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/m4/lcdf-typetools.m4 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/m4/lcdf-typetools.m4
index 7aaff4c33af..7aaff4c33af 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/m4/lcdf-typetools.m4
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/m4/lcdf-typetools.m4
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.am
index acabc098098..acabc098098 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.in
index 4ad2ac4e151..e036e80a21f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = mmafm$(EXEEXT)
-subdir = lcdf-typetools-2.104/mmafm
+subdir = lcdf-typetools-2.105/mmafm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -366,9 +366,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/mmafm/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/mmafm/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/mmafm/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/mmafm/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/main.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/main.cc
index d3dd50b20b6..d3dd50b20b6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/main.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/main.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/mmafm.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/mmafm.1
index fa357a30589..b81e0891735 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmafm/mmafm.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmafm/mmafm.1
@@ -1,5 +1,5 @@
.\" -*-nroff-*-
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.am
index d1b8d0370d1..d1b8d0370d1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.in
index f29c81905b9..2ec8abfa444 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = mmpfb$(EXEEXT)
-subdir = lcdf-typetools-2.104/mmpfb
+subdir = lcdf-typetools-2.105/mmpfb
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -389,9 +389,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/mmpfb/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/mmpfb/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/mmpfb/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/mmpfb/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/main.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/main.cc
index 71d4ff3d45d..71d4ff3d45d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/main.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/main.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/mmpfb.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/mmpfb.1
index 022ea74485e..888bf884ec6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/mmpfb.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/mmpfb.1
@@ -1,5 +1,5 @@
.\" -*-nroff-*-
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.cc
index 1325b44d3e6..1325b44d3e6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.hh
index ffe35668f94..ffe35668f94 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/myfont.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/myfont.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.cc
index 2c4b1bcb015..2c4b1bcb015 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.hh
index a5c3ea04906..a5c3ea04906 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1minimize.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1minimize.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.cc
index 86382ca239b..86382ca239b 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.hh
index eac9d75beeb..eac9d75beeb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/mmpfb/t1rewrit.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/mmpfb/t1rewrit.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.am
index b2f3dbfa52a..b2f3dbfa52a 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.in
index 530344e5759..7d4b86eab26 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = otfinfo$(EXEEXT)
-subdir = lcdf-typetools-2.104/otfinfo
+subdir = lcdf-typetools-2.105/otfinfo
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -368,9 +368,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/otfinfo/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/otfinfo/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/otfinfo/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/otfinfo/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.1
index f2a9502f6c5..3d571c66245 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.1
@@ -1,5 +1,5 @@
'\"t
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.cc
index 345b1baf442..59b74223874 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otfinfo/otfinfo.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otfinfo/otfinfo.cc
@@ -67,6 +67,7 @@ const Clp_Option options[] = {
{ "verbose", 'V', VERBOSE_OPT, 0, Clp_Negate },
{ "features", 'f', QUERY_FEATURES_OPT, 0, 0 },
{ "scripts", 's', QUERY_SCRIPTS_OPT, 0, 0 },
+ { "size", 0, QUERY_OPTICAL_SIZE_OPT, 0, 0 },
{ "optical-size", 'z', QUERY_OPTICAL_SIZE_OPT, 0, 0 },
{ "postscript-name", 'p', QUERY_POSTSCRIPT_NAME_OPT, 0, 0 },
{ "family", 'a', QUERY_FAMILY_OPT, 0, 0 },
@@ -263,14 +264,14 @@ do_query_features(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *r
}
}
-static void
-do_query_optical_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
+static bool
+do_query_optical_size_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
{
int before_nerrors = errh->nerrors();
try {
String gpos_table = otf.table("GPOS");
if (!gpos_table)
- throw OpenType::Error();
+ return false;
OpenType::Gpos gpos(gpos_table, errh);
OpenType::Name name(otf.table("name"), errh);
@@ -282,13 +283,13 @@ do_query_optical_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandle
int size_fid = gpos.feature_list().find(OpenType::Tag("size"), fids);
if (size_fid < 0)
- throw OpenType::Error();
+ return false;
// old Adobe fonts implement an old, incorrect idea
// of what the FeatureParams offset means.
OpenType::Data size_data = gpos.feature_list().size_params(size_fid, name, errh);
if (!size_data.length())
- throw OpenType::Error();
+ return false;
StringAccum sa;
sa << "design size " << (size_data.u16(0) / 10.) << " pt";
@@ -301,6 +302,32 @@ do_query_optical_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandle
}
result_errh->message("%s", sa.c_str());
+ return true;
+
+ } catch (OpenType::Error) {
+ return errh->nerrors() != before_nerrors;
+ }
+}
+
+static void
+do_query_optical_size(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
+{
+ int before_nerrors = errh->nerrors();
+ try {
+ if (do_query_optical_size_size(otf, errh, result_errh))
+ return;
+
+ String os2_table = otf.table("OS/2");
+ if (!os2_table)
+ throw OpenType::Error();
+
+ OpenType::Os2 os2(os2_table, errh);
+ if (!os2.ok() || !os2.has_optical_point_size())
+ throw OpenType::Error();
+
+ StringAccum sa;
+ sa << "size range [" << os2.lower_optical_point_size() << ", " << os2.upper_optical_point_size() << ")";
+ result_errh->message("%s", sa.c_str());
} catch (OpenType::Error) {
if (errh->nerrors() == before_nerrors)
@@ -492,14 +519,8 @@ do_query_unicode(const OpenType::Font& otf, ErrorHandler* errh, ErrorHandler* re
if (!cmap.ok())
throw OpenType::Error();
- Vector<uint32_t> g2c;
- cmap.unmap_all(g2c);
-
Vector<std::pair<uint32_t, int> > u2g;
- for (int i = 0; i != g2c.size(); ++i)
- if (g2c[i])
- u2g.push_back(std::make_pair(g2c[i], i));
-
+ cmap.unmap_all(u2g);
std::sort(u2g.begin(), u2g.end());
for (std::pair<uint32_t, int>* it = u2g.begin(); it != u2g.end(); ++it) {
char name[10];
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.am
index 7bbb038146d..7bbb038146d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.in
index 9ee0531ddfc..b0f3ba0fc26 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/Makefile.in
@@ -93,7 +93,7 @@ bin_PROGRAMS = otftotfm$(EXEEXT)
@have_kpathsea_TRUE@am__append_2 = $(KPATHSEA_INCLUDES)
@have_kpathsea_TRUE@am__append_3 = $(KPATHSEA_LIBS)
@have_kpathsea_TRUE@am__append_4 = $(KPATHSEA_DEPEND)
-subdir = lcdf-typetools-2.104/otftotfm
+subdir = lcdf-typetools-2.105/otftotfm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -405,9 +405,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/otftotfm/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/otftotfm/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/otftotfm/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/otftotfm/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.cc
index 7ce4e512e84..7ce4e512e84 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.hh
index 4c973347715..4c973347715 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/automatic.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/automatic.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.cc
index 2c4e605ed86..2c4e605ed86 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.hh
index a80631c3038..a80631c3038 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/dvipsencoding.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/dvipsencoding.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.cc
index a4120660bfc..a4120660bfc 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.hh
index 753e5714d5c..753e5714d5c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/glyphfilter.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/glyphfilter.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.c b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.c
index 302dfb20d4c..302dfb20d4c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.c
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.c
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.h b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.h
index 413e06e6572..413e06e6572 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/kpseinterface.h
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/kpseinterface.h
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.cc
index f73bb9d01f9..f73bb9d01f9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.hh
index aa02acfac55..aa02acfac55 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/metrics.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/metrics.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.1
index 4ab647758c8..a475f0e7ad1 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.1
@@ -1,5 +1,5 @@
'\"t
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.cc
index b418a2f8270..6ee5e5958f8 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.cc
@@ -2287,14 +2287,14 @@ particular purpose.\n");
errh->fatal("encoding %<%s%> not found", encoding_file.c_str());
} else {
String cff_data(otf.table("CFF"));
- if (!cff_data)
+ if (!cff_data) {
errh->error("explicit encoding required for TrueType fonts");
- else if (!have_encoding_file)
+ errh->message("(Use %<-e ENCODING%> to choose an encoding. %<-e texnansx%> often works.)");
+ exit(1);
+ } else if (!have_encoding_file) {
errh->warning("no encoding provided");
- if (!cff_data || !have_encoding_file)
errh->message("(Use %<-e ENCODING%> to choose an encoding. %<-e texnansx%> often works,\nor say %<-e -%> to turn off this warning.)");
- if (!cff_data)
- exit(1);
+ }
// use encoding from font
Cff cff(cff_data, otf.units_per_em(), &bail_errh);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.hh
index e509e1577af..e509e1577af 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/otftotfm.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/otftotfm.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.cc
index 7726e2e77fd..7726e2e77fd 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.hh
index 81857fd4e9d..81857fd4e9d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/secondary.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/secondary.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.cc
index 228661394a9..228661394a9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.hh
index 4dd6b135eb7..4dd6b135eb7 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/uniprop.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/uniprop.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.cc
index b50ff9566d3..b50ff9566d3 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.hh
index a3e42b63d9f..a3e42b63d9f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/otftotfm/util.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/otftotfm/util.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.am
index 41360807e13..41360807e13 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.in
index 797e2944dc0..21f5d86625e 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = t1dotlessj$(EXEEXT)
-subdir = lcdf-typetools-2.104/t1dotlessj
+subdir = lcdf-typetools-2.105/t1dotlessj
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -366,9 +366,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1dotlessj/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1dotlessj/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1dotlessj/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1dotlessj/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.1
index 44f196b2636..e9f2807f3e4 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.cc
index 03f56452728..03f56452728 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1dotlessj/t1dotlessj.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1dotlessj/t1dotlessj.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.am
index c76b5671fe5..c76b5671fe5 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.in
index 8382383a1a4..1cec79ec182 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = t1lint$(EXEEXT)
-subdir = lcdf-typetools-2.104/t1lint
+subdir = lcdf-typetools-2.105/t1lint
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -386,9 +386,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1lint/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1lint/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1lint/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1lint/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.cc
index f39a040a014..53e40d262c7 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.cc
@@ -138,106 +138,125 @@ CharstringChecker::error(int which, int data)
bool
CharstringChecker::callothersubr()
{
- int othersubrnum = (int)top(0);
- int n = (int)top(1);
- int i;
+ int othersubrnum = (int)top(0);
+ int n = (int)top(1);
+ int i;
+
+ pop(2);
+ if (othersubrnum < 0 || size() < n)
+ return false;
+
+ if (!_started && (othersubrnum < Cs::othcCountercontrolpart
+ || othersubrnum > Cs::othcMM6))
+ _errh->warning("first command not %<hsbw%> or %<sbw%>");
+
+ bool retval = true;
+
+ switch (othersubrnum) {
+
+ case Cs::othcFlexend:
+ if (n != 3) {
+ _errh->error("wrong number of arguments to Flex");
+ goto unknown;
+ }
+ if (!_flex) {
+ _errh->error("no Flex in progress");
+ retval = false;
+ } else if (ps_size() != 16) {
+ _errh->error("Flex needs 16 arguments, have %d", ps_size());
+ retval = false;
+ } else {
+ ps_clear();
+ ps_push(top(0));
+ ps_push(top(1));
+ _flex = false;
+ }
+ break;
+
+ case Cs::othcFlexbegin:
+ if (n != 0) {
+ _errh->error("wrong number of arguments to Flex");
+ goto unknown;
+ }
+ ps_clear();
+ ps_push(_cp.x);
+ ps_push(_cp.y);
+ _flex = true;
+ _just_flexed = true;
+ //_flex_connect = _connect;
+ break;
+
+ case Cs::othcFlexmiddle:
+ if (n != 0) {
+ _errh->error("wrong number of arguments to Flex");
+ goto unknown;
+ }
+ if (!_flex)
+ retval = error(errFlex, 0);
+ else {
+ if (_just_flexed)
+ _errh->error("Flex control points must be separated by a moveto");
+ ps_push(_cp.x);
+ ps_push(_cp.y);
+ _just_flexed = true;
+ }
+ break;
+
+ case Cs::othcReplacehints:
+ if (n != 1) {
+ _errh->error("wrong number of arguments to hint replacement");
+ goto unknown;
+ }
+ ps_clear();
+ ps_push(top());
+ _h_hstem.clear();
+ _h_vstem.clear();
+ break;
+
+ case Cs::othcCountercontrolpart:
+ case Cs::othcCountercontrol:
+ if (_counter_controlled)
+ _errh->error("duplicate counter control instructions");
+ else if (_started
+ && _last_command != 256 + Cs::othcCountercontrolpart
+ && _last_command != Cs::cSbw
+ && _last_command != Cs::cHsbw)
+ _errh->error("counter control must appear immediately after %<sbw%> or %<hsbw%>");
+ if (n < 0 || n > 22)
+ _errh->error("too many arguments to counter control, max 22");
+ else if (n != size()) {
+ _errh->error("too few arguments to counter control, expected %d", size());
+ n = size();
+ }
+ ps_clear();
+ _counter_controlled = (othersubrnum == Cs::othcCountercontrol);
+ break;
+
+ case Cs::othcMM1:
+ case Cs::othcMM2:
+ case Cs::othcMM3:
+ case Cs::othcMM4:
+ case Cs::othcMM6:
+ retval = mm_command(othersubrnum, n);
+ goto skip_pop;
+
+ default: // unknown
+ unknown:
+ _errh->warning("unknown callothersubr %<%d%>", othersubrnum);
+ ps_clear();
+ for (i = 0; i < n; i++)
+ ps_push(top(i));
+ break;
- pop(2);
- if (othersubrnum < 0 || size() < n) return false;
-
- if (!_started && (othersubrnum < 14 || othersubrnum > 18))
- _errh->warning("first command not %<hsbw%> or %<sbw%>");
-
- switch (othersubrnum) {
-
- case 0: // Flex
- if (n != 3) {
- _errh->error("wrong number of arguments to Flex");
- goto unknown;
- }
- if (!_flex) {
- _errh->error("no Flex in progress");
- pop(3);
- return false;
- } else if (ps_size() != 16) {
- _errh->error("Flex needs 16 arguments, have %d", ps_size());
- pop(3);
- return false;
- }
- //_connect = _flex_connect;
-#if 0
- addbezier(Point(ps_at(0), ps_at(1)),
- Point(ps_at(4), ps_at(5)),
- Point(ps_at(6), ps_at(7)),
- Point(ps_at(8), ps_at(9)));
- addbezier(Point(ps_at(8), ps_at(9)),
- Point(ps_at(10), ps_at(11)),
- Point(ps_at(12), ps_at(13)),
- Point(ps_at(14), ps_at(15)));
-#endif
- ps_clear();
- ps_push(top(0));
- ps_push(top(1));
- _flex = false;
- break;
-
- case 1: // Flex
- if (n != 0) {
- _errh->error("wrong number of arguments to Flex");
- goto unknown;
- }
- ps_clear();
- ps_push(_cp.x);
- ps_push(_cp.y);
- _flex = true;
- _just_flexed = true;
- //_flex_connect = _connect;
- break;
-
- case 2: // Flex
- if (n != 0) {
- _errh->error("wrong number of arguments to Flex");
- goto unknown;
- }
- if (!_flex)
- return error(errFlex, 0);
- if (_just_flexed)
- _errh->error("Flex control points must be separated by a moveto");
- ps_push(_cp.x);
- ps_push(_cp.y);
- _just_flexed = true;
- break;
-
- case 3: // hint replacement
- if (n != 1) {
- _errh->error("wrong number of arguments to hint replacement");
- goto unknown;
}
- ps_clear();
- ps_push(top());
- _h_hstem.clear();
- _h_vstem.clear();
- break;
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- return mm_command(othersubrnum, n);
-
- default: // unknown
- unknown:
- _errh->warning("unknown callothersubr %<%d%>", othersubrnum);
- ps_clear();
- for (i = 0; i < n; i++)
- ps_push(top(i));
- break;
-
- }
-
- pop(n);
- return true;
+ pop(n);
+ if (_last_command == 256 + Cs::othcCountercontrolpart
+ && othersubrnum != Cs::othcCountercontrol)
+ _errh->error("partial counter control instruction");
+ _last_command = 256 + othersubrnum;
+ skip_pop:
+ return retval;
}
//#define DEBUG(s) printf s
@@ -263,14 +282,14 @@ CharstringChecker::type1_command(int cmd)
return arith_command(cmd);
}
- if (cmd != Cs::cHsbw && cmd != Cs::cSbw) {
- if (!_started)
- _errh->warning("first command not %<hsbw%> or %<sbw%>");
- } else {
- if (_started)
- _errh->error("duplicate %<hsbw%> or %<sbw%>");
- }
- _started = true;
+ if (cmd != Cs::cHsbw && cmd != Cs::cSbw) {
+ if (!_started)
+ _errh->warning("first command not %<hsbw%> or %<sbw%>");
+ } else {
+ if (_started)
+ _errh->error("duplicate %<hsbw%> or %<sbw%>");
+ }
+ _started = true;
switch (cmd) {
@@ -365,6 +384,7 @@ CharstringChecker::type1_command(int cmd)
case Cs::cEndchar:
set_done();
+ _last_command = cmd;
return false;
case Cs::cDotsection:
@@ -451,6 +471,9 @@ CharstringChecker::type1_command(int cmd)
}
+ if (_last_command == 256 + Cs::othcCountercontrolpart)
+ _errh->error("partial counter control instruction");
+ _last_command = cmd;
return true;
}
@@ -463,7 +486,9 @@ CharstringChecker::check(const CharstringContext &g, ErrorHandler *errh)
_started = false;
_flex = false;
- _hstem = _hstem3 = _vstem = _vstem3 = _just_flexed = false;
+ _hstem = _hstem3 = _vstem = _vstem3 = false;
+ _just_flexed = _counter_controlled = false;
+ _last_command = -1;
_h_hstem.clear();
_h_vstem.clear();
_h_hstem3.clear();
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.hh
index 9ba167b1588..d9de5134109 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/cscheck.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/cscheck.hh
@@ -58,6 +58,8 @@ class CharstringChecker : public Efont::CharstringInterp { public:
bool _vstem3;
bool _just_flexed;
+ bool _counter_controlled;
+ int _last_command;
Vector<double> _h_hstem;
Vector<double> _h_vstem;
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.1
index 0085e1a4d11..bf874d3df08 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.cc
index b05d7842c0f..b05d7842c0f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1lint/t1lint.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1lint/t1lint.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.am
index 035c5cb1c9d..035c5cb1c9d 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.in
index eaff4257cfb..703764b0a8b 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = t1rawafm$(EXEEXT)
-subdir = lcdf-typetools-2.104/t1rawafm
+subdir = lcdf-typetools-2.105/t1rawafm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -366,9 +366,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1rawafm/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1rawafm/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1rawafm/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1rawafm/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.1
index 4fb529731ef..530cd61b1fb 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.cc
index 84a851227ee..98d7a25062a 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1rawafm/t1rawafm.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1rawafm/t1rawafm.cc
@@ -42,10 +42,10 @@
using namespace Efont;
-#define VERSION_OPT 301
-#define HELP_OPT 302
-#define OUTPUT_OPT 303
-#define SMOKE_OPT 305
+#define VERSION_OPT 301
+#define HELP_OPT 302
+#define OUTPUT_OPT 303
+#define SMOKE_OPT 305
const Clp_Option options[] = {
{ "help", 'h', HELP_OPT, 0, 0 },
@@ -64,9 +64,9 @@ usage_error(ErrorHandler *errh, const char *error_message, ...)
va_list val;
va_start(val, error_message);
if (!error_message)
- errh->message("Usage: %s [OPTION]... [FONT [OUTPUT]]", program_name);
+ errh->message("Usage: %s [OPTION]... [FONT [OUTPUT]]", program_name);
else
- errh->vxmessage(ErrorHandler::e_error, error_message, val);
+ errh->vxmessage(ErrorHandler::e_error, error_message, val);
errh->message("Type %s --help for more information.", program_name);
exit(1);
}
@@ -102,34 +102,36 @@ do_file(const char *filename, PsresDatabase *psres, ErrorHandler *errh)
{
FILE *f;
if (!filename || strcmp(filename, "-") == 0) {
- f = stdin;
- filename = "<stdin>";
+ f = stdin;
+ filename = "<stdin>";
#if defined(_MSDOS) || defined(_WIN32)
- _setmode(_fileno(f), _O_BINARY);
+ _setmode(_fileno(f), _O_BINARY);
#endif
} else
- f = fopen(filename, "rb");
+ f = fopen(filename, "rb");
if (!f) {
- // check for PostScript name
- Filename fn = psres->filename_value("FontOutline", filename);
- f = fn.open_read();
+ // check for PostScript name
+ Filename fn = psres->filename_value("FontOutline", filename);
+ f = fn.open_read();
}
if (!f)
- errh->fatal("%s: %s", filename, strerror(errno));
+ errh->fatal("%s: %s", filename, strerror(errno));
Type1Reader *reader;
int c = getc(f);
ungetc(c, f);
if (c == EOF)
- errh->fatal("%s: empty file", filename);
+ errh->fatal("%s: empty file", filename);
if (c == 128)
- reader = new Type1PFBReader(f);
+ reader = new Type1PFBReader(f);
else
- reader = new Type1PFAReader(f);
+ reader = new Type1PFAReader(f);
font = new Type1Font(*reader);
+ if (!font->ok())
+ errh->fatal("%s: not a Type 1 font", filename);
delete reader;
}
@@ -164,15 +166,15 @@ strip_newlines(const String &str)
StringAccum sa;
const char *end = str.end(), *last = str.begin();
for (const char *s = str.begin(); s != end; ++s)
- if (*s == '\n' || *s == '\r' || *s == '\f' || *s == '\v') {
- sa.append(last, s);
- last = s + 1;
- }
+ if (*s == '\n' || *s == '\r' || *s == '\f' || *s == '\v') {
+ sa.append(last, s);
+ last = s + 1;
+ }
if (last == str.begin())
- return str;
+ return str;
else {
- sa.append(last, end);
- return sa.take_string();
+ sa.append(last, end);
+ return sa.take_string();
}
}
@@ -182,7 +184,7 @@ write_char(FILE *outf, int c, PermString n, Type1Charstring *g, const Transform
double bb[4], wx;
CharstringBounds::bounds(font_transform, CharstringContext(font, g), bb, wx);
fprintf(outf, "C %d ; WX %d ; N %s ; B %d %d %d %d ;\n",
- c, (int) ceil(wx), n.c_str(),
+ c, (int) ceil(wx), n.c_str(),
(int) floor(bb[0]), (int) floor(bb[1]),
(int) ceil(bb[2]), (int) ceil(bb[3]));
}
@@ -194,62 +196,62 @@ write_afm(FILE *outf, Type1Font *font)
Comment Generated by t1rawafm\n");
for (size_t i = 0; i < sizeof(fontinfo_strings) / sizeof(fontinfo_t); ++i)
- if (Type1Definition *t1d = font->dict(fontinfo_strings[i].dict,
- fontinfo_strings[i].dict_name)) {
- if (!fontinfo_strings[i].as_string)
- fprintf(outf, "%s %s\n", fontinfo_strings[i].afm_name, t1d->value().c_str());
- else {
- String s;
- if (t1d->value_string(s))
- fprintf(outf, "%s %s\n", fontinfo_strings[i].afm_name, strip_newlines(s).c_str());
- }
- }
+ if (Type1Definition *t1d = font->dict(fontinfo_strings[i].dict,
+ fontinfo_strings[i].dict_name)) {
+ if (!fontinfo_strings[i].as_string)
+ fprintf(outf, "%s %s\n", fontinfo_strings[i].afm_name, t1d->value().c_str());
+ else {
+ String s;
+ if (t1d->value_string(s))
+ fprintf(outf, "%s %s\n", fontinfo_strings[i].afm_name, strip_newlines(s).c_str());
+ }
+ }
Transform font_transform;
{
- double font_matrix[6];
- font->font_matrix(font_matrix);
- font_transform = Transform(font_matrix);
- font_transform.scale(1000);
+ double font_matrix[6];
+ font->font_matrix(font_matrix);
+ font_transform = Transform(font_matrix);
+ font_transform.scale(1000);
}
double bb[4], wx;
if (Type1Charstring *t1cs = font->glyph("H")) {
- CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
- if (bb[3])
- fprintf(outf, "CapHeight %d\n", (int) ceil(bb[3]));
+ CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
+ if (bb[3])
+ fprintf(outf, "CapHeight %d\n", (int) ceil(bb[3]));
}
if (Type1Charstring *t1cs = font->glyph("x")) {
- CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
- if (bb[3])
- fprintf(outf, "XHeight %d\n", (int) ceil(bb[3]));
+ CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
+ if (bb[3])
+ fprintf(outf, "XHeight %d\n", (int) ceil(bb[3]));
}
if (Type1Charstring *t1cs = font->glyph("d")) {
- CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
- if (bb[3])
- fprintf(outf, "Ascender %d\n", (int) ceil(bb[3]));
+ CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
+ if (bb[3])
+ fprintf(outf, "Ascender %d\n", (int) ceil(bb[3]));
}
if (Type1Charstring *t1cs = font->glyph("p")) {
- CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
- if (bb[1])
- fprintf(outf, "Descender %d\n", (int) floor(bb[1]));
+ CharstringBounds::bounds(font_transform, CharstringContext(font, t1cs), bb, wx);
+ if (bb[1])
+ fprintf(outf, "Descender %d\n", (int) floor(bb[1]));
}
Vector<double> vd;
if (Type1Definition *t1d = font->p_dict("StdHW"))
- if (t1d->value_numvec(vd) && vd.size() > 0)
- fprintf(outf, "StdHW %d\n", (int) ceil(vd[0]));
+ if (t1d->value_numvec(vd) && vd.size() > 0)
+ fprintf(outf, "StdHW %d\n", (int) ceil(vd[0]));
if (Type1Definition *t1d = font->p_dict("StdVW"))
- if (t1d->value_numvec(vd) && vd.size() > 0)
- fprintf(outf, "StdVW %d\n", (int) ceil(vd[0]));
+ if (t1d->value_numvec(vd) && vd.size() > 0)
+ fprintf(outf, "StdVW %d\n", (int) ceil(vd[0]));
double fontbb[4] = { 1000000, 1000000, -1000000, -1000000 };
for (int i = 0; i < font->nglyphs(); ++i) {
- CharstringBounds::bounds(font_transform, CharstringContext(font, font->glyph(i)), bb, wx);
- fontbb[0] = std::min(fontbb[0], bb[0]);
- fontbb[1] = std::min(fontbb[1], bb[1]);
- fontbb[2] = std::max(fontbb[2], bb[2]);
- fontbb[3] = std::max(fontbb[3], bb[3]);
+ CharstringBounds::bounds(font_transform, CharstringContext(font, font->glyph(i)), bb, wx);
+ fontbb[0] = std::min(fontbb[0], bb[0]);
+ fontbb[1] = std::min(fontbb[1], bb[1]);
+ fontbb[2] = std::max(fontbb[2], bb[2]);
+ fontbb[3] = std::max(fontbb[3], bb[3]);
}
fprintf(outf, "FontBBox %d %d %d %d\n",
(int) floor(fontbb[0]), (int) floor(fontbb[1]),
@@ -260,25 +262,26 @@ Comment Generated by t1rawafm\n");
int nglyphs = font->nglyphs();
PermString dot_notdef(".notdef");
if (font->glyph(dot_notdef))
- --nglyphs;
+ --nglyphs;
fprintf(outf, "Characters %d\n", nglyphs);
fprintf(outf, "StartCharMetrics %d\n", nglyphs);
- Type1Encoding *enc = font->type1_encoding();
HashMap<PermString, int> done_yet(0);
done_yet.insert(dot_notdef, 1);
- for (int i = 0; i < 256; ++i) {
- PermString n = enc->elt(i);
- if (!done_yet[n])
- if (Type1Charstring *g = font->glyph(n)) {
- write_char(outf, i, n, g, font_transform, font);
- done_yet.insert(n, true);
- }
+ if (Type1Encoding *enc = font->type1_encoding()) {
+ for (int i = 0; i < 256; ++i) {
+ PermString n = enc->elt(i);
+ if (!done_yet[n])
+ if (Type1Charstring *g = font->glyph(n)) {
+ write_char(outf, i, n, g, font_transform, font);
+ done_yet.insert(n, true);
+ }
+ }
}
for (int i = 0; i < font->nglyphs(); ++i) {
- PermString n = font->glyph_name(i);
- if (!done_yet[n])
- write_char(outf, -1, n, font->glyph(i), font_transform, font);
+ PermString n = font->glyph_name(i);
+ if (!done_yet[n])
+ write_char(outf, -1, n, font->glyph(i), font_transform, font);
}
fprintf(outf, "EndCharMetrics\n");
@@ -292,7 +295,7 @@ main(int argc, char *argv[])
psres->add_psres_path(getenv("PSRESOURCEPATH"), 0, false);
Clp_Parser *clp =
- Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options);
+ Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options);
program_name = Clp_ProgramName(clp);
ErrorHandler *errh = ErrorHandler::static_initialize(new FileErrorHandler(stderr));
@@ -300,61 +303,61 @@ main(int argc, char *argv[])
Vector<String> glyph_patterns;
while (1) {
- int opt = Clp_Next(clp);
- switch (opt) {
-
- case OUTPUT_OPT:
- output_file:
- if (output_file)
- errh->fatal("output file already specified");
- output_file = clp->vstr;
- break;
-
- case VERSION_OPT:
- printf("t1rawafm (LCDF typetools) %s\n", VERSION);
- printf("Copyright (C) 2008-2013 Eddie Kohler\n\
+ int opt = Clp_Next(clp);
+ switch (opt) {
+
+ case OUTPUT_OPT:
+ output_file:
+ if (output_file)
+ errh->fatal("output file already specified");
+ output_file = clp->vstr;
+ break;
+
+ case VERSION_OPT:
+ printf("t1rawafm (LCDF typetools) %s\n", VERSION);
+ printf("Copyright (C) 2008-2013 Eddie Kohler\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty, not even for merchantability or fitness for a\n\
particular purpose.\n");
- exit(0);
- break;
+ exit(0);
+ break;
- case HELP_OPT:
- usage();
- exit(0);
- break;
+ case HELP_OPT:
+ usage();
+ exit(0);
+ break;
- case Clp_NotOption:
- if (font)
- goto output_file;
- else
- do_file(clp->vstr, psres, errh);
- break;
+ case Clp_NotOption:
+ if (font)
+ goto output_file;
+ else
+ do_file(clp->vstr, psres, errh);
+ break;
- case Clp_Done:
- goto done;
+ case Clp_Done:
+ goto done;
- case Clp_BadOption:
- usage_error(errh, 0);
- break;
+ case Clp_BadOption:
+ usage_error(errh, 0);
+ break;
- default:
- break;
+ default:
+ break;
- }
+ }
}
done:
if (!font)
- do_file(0, psres, errh);
+ do_file(0, psres, errh);
FILE *outf;
if (!output_file || strcmp(output_file, "-") == 0)
- outf = stdout;
+ outf = stdout;
else {
- outf = fopen(output_file, "w");
- if (!outf)
- errh->fatal("%s: %s", output_file, strerror(errno));
+ outf = fopen(output_file, "w");
+ if (!outf)
+ errh->fatal("%s: %s", output_file, strerror(errno));
}
#if defined(_MSDOS) || defined(_WIN32)
_setmode(_fileno(outf), _O_BINARY);
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.am
index b022669f5d3..b022669f5d3 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.in
index 441c68c82db..984b7091805 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = t1reencode$(EXEEXT)
-subdir = lcdf-typetools-2.104/t1reencode
+subdir = lcdf-typetools-2.105/t1reencode
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -386,9 +386,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1reencode/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1reencode/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1reencode/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1reencode/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.1
index db28a7a6592..575bdb45b1a 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
@@ -8,7 +8,7 @@
..
.TH T1REENCODE 1 "LCDF Typetools" "Version \*V"
.SH NAME
-t1reencode \- reencode a PostScript Type 1 font
+t1reencode \- re-encode a PostScript Type 1 font
.SH SYNOPSIS
.B t1reencode
\%\-e ENCODING
@@ -17,7 +17,7 @@ t1reencode \- reencode a PostScript Type 1 font
.RI [ outputfile ]
.SH DESCRIPTION
.BR T1reencode
-changes a PostScript Type\~1 font's embedded encoding. The reencoded font
+changes a PostScript Type\~1 font's embedded encoding. The re-encoded font
is written to the standard output (but see the
.B \-\-output
option). If no input font file is supplied,
@@ -151,14 +151,14 @@ Print the version number and some short non-warranty information and exit.
'
.SH "RETURN VALUES"
.B T1reencode
-exits with value 0 if a reencoded font was successfully generated, and 1
+exits with value 0 if a re-encoded font was successfully generated, and 1
otherwise.
'
.SH "NOTES"
.LP
.B T1reencode
should be used only in special situations. It's generally much better to
-use PostScript commands to reencode a font; for instance, executing the
+use PostScript commands to re-encode a font; for instance, executing the
PostScript commands to generate two differently-encoded versions of a
single font will take up much less memory than loading two
.BR t1reencode d
@@ -166,7 +166,7 @@ fonts.
'
.SH "EXAMPLES"
.PP
-This command reencodes Frutiger Roman in the ISO Latin\~1 encoding. The new
+This command re-encodes Frutiger Roman in the ISO Latin\~1 encoding. The new
font will have the PostScript name Frutiger-RomanISOLatin1Encoding.
.Sp
.nf
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.cc
index c35fbdf01d9..c35fbdf01d9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/t1reencode.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/t1reencode.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.cc
index 89f43391152..89f43391152 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.hh
index 34b9c9c5a22..34b9c9c5a22 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1reencode/util.hh
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1reencode/util.hh
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.am
index 3e530d8f469..3e530d8f469 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.in
index 61a3e3cf002..7d095b31e56 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = t1testpage$(EXEEXT)
-subdir = lcdf-typetools-2.104/t1testpage
+subdir = lcdf-typetools-2.105/t1testpage
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -366,9 +366,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1testpage/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1testpage/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/t1testpage/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/t1testpage/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.1
index f4004a8d04f..10b35fc88b6 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.cc
index 507428b4c4f..507428b4c4f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/t1testpage/t1testpage.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/t1testpage/t1testpage.cc
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist-g2u.txt b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist-g2u.txt
index 2340809a4de..2340809a4de 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist-g2u.txt
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist-g2u.txt
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist.txt b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist.txt
index b9c5fa9af0f..b9c5fa9af0f 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/texglyphlist.txt
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/texglyphlist.txt
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.am b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.am
index d1c220870e9..d1c220870e9 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.am
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.am
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.in b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.in
index 6258f75b4c5..9e73f716582 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/Makefile.in
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/Makefile.in
@@ -89,7 +89,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = ttftotype42$(EXEEXT)
-subdir = lcdf-typetools-2.104/ttftotype42
+subdir = lcdf-typetools-2.105/ttftotype42
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_template_objs.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
@@ -366,9 +366,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.104/ttftotype42/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lcdf-typetools-2.105/ttftotype42/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign lcdf-typetools-2.104/ttftotype42/Makefile
+ $(AUTOMAKE) --foreign lcdf-typetools-2.105/ttftotype42/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.1 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.1
index 1b24f7149ee..56e6dc612ed 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.1
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.1
@@ -1,4 +1,4 @@
-.ds V 2.104
+.ds V 2.105
.de M
.BR "\\$1" "(\\$2)\\$3"
..
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.cc
index 3fb1b672daa..3fb1b672daa 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/ttftotype42/ttftotype42.cc
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.105/ttftotype42/ttftotype42.cc
diff --git a/Build/source/texk/lcdf-typetools/version.ac b/Build/source/texk/lcdf-typetools/version.ac
index 4ec4d089701..212ccbbf42b 100644
--- a/Build/source/texk/lcdf-typetools/version.ac
+++ b/Build/source/texk/lcdf-typetools/version.ac
@@ -1,5 +1,5 @@
dnl
-dnl Copyright (C) 2011-2014 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2011-2015 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,
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current lcdf-typetools version
-m4_define([lcdf_typetools_version], [2.104])
+m4_define([lcdf_typetools_version], [2.105])