diff -Nru lcdf-typetools-2.104~dfsg/aclocal.m4 lcdf-typetools-2.105~dfsg/aclocal.m4 --- lcdf-typetools-2.104~dfsg/aclocal.m4 2014-07-07 12:14:02.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/aclocal.m4 2015-09-15 18:06:42.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- +# generated automatically by aclocal 1.15 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2013 Free Software Foundation, Inc. +# Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' +[am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], +m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl +[AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -103,15 +103,14 @@ # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -142,7 +141,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -333,7 +332,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -409,7 +408,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -499,8 +498,8 @@ # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl @@ -573,7 +572,11 @@ END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi -fi]) +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further @@ -602,7 +605,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -613,7 +616,7 @@ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -623,7 +626,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -645,7 +648,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +683,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -730,7 +733,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -769,7 +772,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -798,7 +801,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -845,7 +848,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -864,7 +867,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -945,7 +948,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2013 Free Software Foundation, Inc. +# Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1005,7 +1008,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1033,7 +1036,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1052,7 +1055,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -Nru lcdf-typetools-2.104~dfsg/cfftot1/cfftot1.1 lcdf-typetools-2.105~dfsg/cfftot1/cfftot1.1 --- lcdf-typetools-2.104~dfsg/cfftot1/cfftot1.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/cfftot1/cfftot1.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/cfftot1/Makefile.in lcdf-typetools-2.105~dfsg/cfftot1/Makefile.in --- lcdf-typetools-2.104~dfsg/cfftot1/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/cfftot1/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = cfftot1$(EXEEXT) subdir = cfftot1 -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -191,6 +200,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -319,7 +329,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cfftot1/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cfftot1/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -657,6 +666,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/configure lcdf-typetools-2.105~dfsg/configure --- lcdf-typetools-2.104~dfsg/configure 2014-07-07 12:14:04.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/configure 2015-09-15 18:06:45.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lcdf-typetools 2.104. +# Generated by GNU Autoconf 2.69 for lcdf-typetools 2.105. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='lcdf-typetools' PACKAGE_TARNAME='lcdf-typetools' -PACKAGE_VERSION='2.104' -PACKAGE_STRING='lcdf-typetools 2.104' +PACKAGE_VERSION='2.105' +PACKAGE_STRING='lcdf-typetools 2.105' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1309,7 +1309,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lcdf-typetools 2.104 to adapt to many kinds of systems. +\`configure' configures lcdf-typetools 2.105 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1375,7 +1375,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lcdf-typetools 2.104:";; + short | recursive ) echo "Configuration of lcdf-typetools 2.105:";; esac cat <<\_ACEOF @@ -1501,7 +1501,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lcdf-typetools configure 2.104 +lcdf-typetools configure 2.105 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2466,7 +2466,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lcdf-typetools $as_me 2.104, which was +It was created by lcdf-typetools $as_me 2.105, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2815,7 +2815,7 @@ -am__api_version='1.14' +am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -3016,8 +3016,8 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -3036,7 +3036,7 @@ $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -3330,7 +3330,7 @@ # Define the identity of the package. PACKAGE='lcdf-typetools' - VERSION='2.104' + VERSION='2.105' cat >>confdefs.h <<_ACEOF @@ -3364,8 +3364,8 @@ # mkdir_p='$(MKDIR_P)' -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' @@ -3422,6 +3422,7 @@ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi + ac_config_headers="$ac_config_headers autoconf.h" @@ -7732,7 +7733,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lcdf-typetools $as_me 2.104, which was +This file was extended by lcdf-typetools $as_me 2.105, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7798,7 +7799,7 @@ 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 config.status 2.104 +lcdf-typetools config.status 2.105 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru lcdf-typetools-2.104~dfsg/configure.ac lcdf-typetools-2.105~dfsg/configure.ac --- lcdf-typetools-2.104~dfsg/configure.ac 2014-07-07 12:13:59.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/configure.ac 2015-09-15 18:06:32.000000000 +0000 @@ -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 -Nru lcdf-typetools-2.104~dfsg/debian/changelog lcdf-typetools-2.105~dfsg/debian/changelog --- lcdf-typetools-2.104~dfsg/debian/changelog 2014-10-25 15:09:43.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/changelog 2015-10-02 14:37:04.000000000 +0000 @@ -1,3 +1,47 @@ +lcdf-typetools (2.105~dfsg-2) unstable; urgency=medium + + [ Vasudev Kamath ] + * Add patch 1002 to fix avoid long lines in otftotfm manpage. + + [ Jonas Smedegaard ] + * Refresh patch 1002 with quilt shortening options. + + -- Jonas Smedegaard Fri, 02 Oct 2015 16:36:41 +0200 + +lcdf-typetools (2.105~dfsg-1) unstable; urgency=medium + + [ upstream ] + * New release(s). + + Several crash fixes. + + otfinfo -g: Print all Unicode mappings for a glyph. + + t1lint: Support counter control hints. + + * Update copyright info: + + Fix use common license shortname X11. + + Fix double-indent copyright holders. + + Rewrap licenses at 72 chars. + + Wrap before plural files and copyright holders. + + Merge identically licensed Files sections. + + Use License-Grant and License-Reference fields. + Thanks to Ben Finney. + + Fix list GAP license (verbatim different from GAP~Makefile.in). + + Fix list all GPL-2+ licensed files as such (not GPL-2). + + Use globbing in Files sections. + + Fix Upstream-Name. + + Extend coverage for myself. Add license grant to rules file. + + List issue tracker as preferred upstream contact. + + Extend coverage for main upstream authors. + + Extend coverage of autotools files. + * Add lintian override regarding license in License-Reference field. + See bug#786450. + * Bump debhelper compatibility level to 9. + * Add lintian override regarding debhelper 9. + * Drop patch 1001: Adopted upstream. + * Modernize git-buildpackage config: Avoid git- prefix. + * Install upstrem-renamed README.md. + + -- Jonas Smedegaard Fri, 02 Oct 2015 14:46:48 +0200 + lcdf-typetools (2.104~dfsg-1) unstable; urgency=medium [ upstream ] diff -Nru lcdf-typetools-2.104~dfsg/debian/compat lcdf-typetools-2.105~dfsg/debian/compat --- lcdf-typetools-2.104~dfsg/debian/compat 2014-10-25 15:09:43.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/compat 2015-10-02 14:26:00.000000000 +0000 @@ -1 +1 @@ -8 +9 diff -Nru lcdf-typetools-2.104~dfsg/debian/copyright lcdf-typetools-2.105~dfsg/debian/copyright --- lcdf-typetools-2.104~dfsg/debian/copyright 2014-10-25 14:35:57.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/copyright 2015-10-02 14:26:00.000000000 +0000 @@ -1,308 +1,165 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: lcdf-typetools -Upstream-Contact: http://www.lcdf.org/type/ - Eddie Kohler +Upstream-Name: LCDF Typetools +Upstream-Contact: https://github.com/kohler/lcdf-typetools/issues Source: https://github.com/kohler/lcdf-typetools Files: * -Copyright: 1997-2014, Eddie Kohler +Copyright: 1997-2015, Eddie Kohler +License-Grant: + This code is distributed under the GNU General Public License, Version + 2 (and only Version 2). License: GPL-2 -Files: cfftot1/maket1font.cc - libefont/afm.cc - libefont/afmparse.cc - libefont/afmw.cc - libefont/amfm.cc - libefont/cff.cc - libefont/encoding.cc - libefont/findmet.cc - libefont/metrics.cc - libefont/otf.cc - libefont/otfcmap.cc - libefont/otfdata.cc - libefont/otfdescrip.cc - libefont/otfgpos.cc - libefont/otfgsub.cc - libefont/otfos2.cc - libefont/otfpost.cc - libefont/pairop.cc - libefont/psres.cc - libefont/t1bounds.cc - libefont/t1cs.cc - libefont/t1csgen.cc - libefont/t1font.cc - libefont/t1interp.cc - libefont/t1item.cc - libefont/t1mm.cc - libefont/t1unparser.cc - libefont/ttfcs.cc - libefont/ttfhead.cc - libefont/ttfkern.cc - liblcdf/bezier.cc - liblcdf/filename.cc - liblcdf/globmatch.cc - liblcdf/landmark.cc - liblcdf/permstr.cc - liblcdf/point.cc - liblcdf/slurper.cc - liblcdf/transform.cc - mmpfb/myfont.cc - mmpfb/t1minimize.cc - mmpfb/t1rewrit.cc - otftotfm/automatic.cc - otftotfm/dvipsencoding.cc - otftotfm/glyphfilter.cc - otftotfm/kpseinterface.c - otftotfm/secondary.cc - otftotfm/uniprop.cc - otftotfm/util.cc - t1lint/cscheck.cc - t1reencode/util.cc - t1reencode/t1reencode.cc -Copyright: 1997-2014, Eddie Kohler -License: GPL-2+ - -Files: cfftot1/maket1font.cc - libefont/afm.cc - libefont/afmparse.cc - libefont/afmw.cc - libefont/amfm.cc - libefont/cff.cc - libefont/encoding.cc - libefont/findmet.cc - libefont/metrics.cc - libefont/otf.cc - libefont/otfcmap.cc - libefont/otfdata.cc - libefont/otfdescrip.cc - libefont/otfgpos.cc - libefont/otfgsub.cc - libefont/otfos2.cc - libefont/otfpost.cc - libefont/pairop.cc - libefont/psres.cc - libefont/t1bounds.cc - libefont/t1cs.cc - libefont/t1csgen.cc - libefont/t1font.cc - libefont/t1interp.cc - libefont/t1item.cc - libefont/t1mm.cc - libefont/t1unparser.cc - libefont/ttfcs.cc - libefont/ttfhead.cc - libefont/ttfkern.cc - liblcdf/bezier.cc - liblcdf/filename.cc - liblcdf/globmatch.cc - liblcdf/landmark.cc - liblcdf/permstr.cc - liblcdf/point.cc - liblcdf/slurper.cc - liblcdf/transform.cc - mmpfb/myfont.cc - mmpfb/t1minimize.cc - mmpfb/t1rewrit.cc - otftotfm/automatic.cc - otftotfm/dvipsencoding.cc - otftotfm/glyphfilter.cc - otftotfm/kpseinterface.c - otftotfm/secondary.cc - otftotfm/uniprop.cc - otftotfm/util.cc - t1lint/cscheck.cc - t1reencode/util.cc -Copyright: 1997-2012, Eddie Kohler -License: GPL-2+ +Files: */Makefile.in +Copyright: 1994-2014, Free Software Foundation, Inc. +License: GAP~Makefile.in -Files: libefont/t1rw.cc -Copyright: 2005-2013, Eddie Kohler +Files: + cfftot1/*.cc + libefont/*.cc + liblcdf/*.cc + mmafm/*.cc + mmpfb/*.cc + otfinfo/*.cc + otftotfm/*.cc + otftotfm/*.c + t1dotlessj/*.cc + t1lint/*.cc + t1rawafm/*.cc + t1reencode/*.cc + t1testpage/*.cc + ttftotype42/*.cc +Copyright: 1997-2014, Eddie Kohler +License-Grant: + 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. License: GPL-2+ -Files: liblcdf/straccum.cc -Copyright: 1999-2000, Massachusetts Institute of Technology - 2001-2012, Eddie Kohler -License: Expat - -Files: include/lcdf/hashmap.cc -Copyright: 1999-2000, Massachusetts Institute of Technology - 2001-2003, International Computer Science Institute -License: Expat - -Files: liblcdf/vectorv.cc -Copyright: 1999-2006, Massachusetts Institute of Technology -License: Expat - -Files: include/lcdf/vector.cc -Copyright: 1999-2000, Massachusetts Institute of Technology - 1999-2012, Eddie Kohler - 2001-2003, International Computer Science Institute -License: Expat - -Files: include/lcdf/clp.h +Files: + include/lcdf/clp.h + include/lcdf/hashmap.cc + include/lcdf/vector.cc liblcdf/clp.c -Copyright: 1997-2013, Eddie Kohler, ekohler@gmail.com -License: Expat - -Files: liblcdf/error.cc + liblcdf/error.cc + liblcdf/straccum.cc liblcdf/string.cc -Copyright: 1999-2000, Massachusetts Institute of Technology - 2001-2013, Eddie Kohler - 2008-2009, Meraki, Inc + liblcdf/vectorv.cc +Copyright: + 1999-2006, Massachusetts Institute of Technology + 2001-2003, International Computer Science Institute + 1997-2013, Eddie Kohler + 2008-2009, Meraki, Inc. License: Expat -Files: include/lcdf/md5.h +Files: + include/lcdf/md5.h liblcdf/md5.c Copyright: 1995, 1996, 1998, 1999, Free Software Foundation Inc. +License-Grant: + 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, or (at your option) any + later version. License: GPL-2+ -Files: compile +Files: + compile depcomp missing Copyright: 1999-2013, Free Software Foundation Inc. +License-Grant: + 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. License: GPL-2+ with Autoconf exception As a special exception to the GNU General Public License, if you distribute this file as part of a program that contains a configuration script generated by Autoconf, you may include it under the same distribution terms that you use for the rest of that program. -Files: Makefile.in - aclocal.m4 - cfftot1/Makefile.in - libefont/Makefile.in - liblcdf/Makefile.in - mmafm/Makefile.in - mmpfb/Makefile.in - otfinfo/Makefile.in - otftotfm/Makefile.in - t1dotlessj/Makefile.in - t1lint/Makefile.in - t1rawafm/Makefile.in - t1reencode/Makefile.in - t1testpage/Makefile.in - ttftotype42/Makefile.in -Copyright: 1994-2013, Free Software Foundation, Inc -License: GAP~Makefile.in - -Files: otftotfm/metrics.cc -Copyright: 2003-2014, Eddie Kohler -License: GPL-2+ - -Files: libefont/t1fontskel.cc -Copyright: 1998-2012, Eddie Kohler -License: GPL-2+ - -Files: libefont/otfname.cc -Copyright: 2003-2012, Eddie Kohler -License: GPL-2+ +Files: aclocal.m4 +Copyright: 1996-2014, Free Software Foundation, Inc. +License: GAP Files: install-sh Copyright: 1994, X Consortium -License: Expat~X +License: X11 Files: debian/* -Copyright: 2003-2012, Claire Connelly - 2014, Vasudev Kamath - 2014, Jonas Smedegaard +Copyright: + 2003-2012, Claire Connelly + 2014, Vasudev Kamath + 2014-2015, Jonas Smedegaard License: GPL-3+ +License: GAP + This file is free software; the Free Software Foundation gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. + License: GAP~Makefile.in - This Makefile.in is free software; the Free Software Foundation - gives unlimited permission to copy and/or distribute it, - with or without modifications, as long as this notice is preserved. + This Makefile.in is free software; the Free Software Foundation gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. . - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY, to the extent permitted by law; without - even the implied warranty of MERCHANTABILITY or FITNESS FOR A - PARTICULAR PURPOSE. + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. License: GPL-2 - 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; version 2 of the License. - . - 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. - . - Comment: - . - On Debian systems the 'GNU General Public License' version 2 is located - in '/usr/share/common-licenses/GPL-2'. - . - You should have received a copy of the 'GNU General Public License' - along with this program. If not, see . +License-Reference: /usr/share/common-licenses/GPL-2 License: GPL-2+ - 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. - . - Comment: - . - On Debian systems the 'GNU General Public License' version 2 is located - in '/usr/share/common-licenses/GPL-2'. - . - You should have received a copy of the 'GNU General Public License' - along with this program. If not, see . +License-Reference: /usr/share/common-licenses/GPL-2 License: GPL-3+ - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - . - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - Public License for more details. - . - Comment: - . - On Debian systems the 'GNU General Public License' version 3 is located - in '/usr/share/common-licenses/GPL-3'. +License-Reference: /usr/share/common-licenses/GPL-3 -License: Expat~X - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: +License: X11 + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: . - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- - TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. License: Expat - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -Nru lcdf-typetools-2.104~dfsg/debian/copyright_hints lcdf-typetools-2.105~dfsg/debian/copyright_hints --- lcdf-typetools-2.104~dfsg/debian/copyright_hints 2014-10-25 15:09:43.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/copyright_hints 2015-10-02 14:33:57.000000000 +0000 @@ -19,10 +19,10 @@ debian/control.in debian/gbp.conf debian/links - debian/patches/1001_t1reencode_manpage_typo_fix.patch + debian/patches/1002_fix_otftotfm_manpage.patch debian/patches/series - debian/rules debian/source/format + debian/source/lintian-overrides debian/watch glyphtounicode.tex include/config.h @@ -198,16 +198,16 @@ t1reencode/Makefile.in t1testpage/Makefile.in ttftotype42/Makefile.in -Copyright: 1994-2013, Free Software Foundation, Inc - 1996-2013, Free Software Foundation, Inc - 1997-2013, Free Software Foundation, Inc - 1999-2013, Free Software Foundation, Inc - 2001-2013, Free Software Foundation, Inc - 2002-2013, Free Software Foundation, Inc - 2003-2013, Free Software Foundation, Inc - 2004-2013, Free Software Foundation, Inc - 2006-2013, Free Software Foundation, Inc - 2009-2013, Free Software Foundation, Inc +Copyright: 1994-2014, Free Software Foundation, Inc + 1996-2014, Free Software Foundation, Inc + 1997-2014, Free Software Foundation, Inc + 1999-2014, Free Software Foundation, Inc + 2001-2014, Free Software Foundation, Inc + 2002-2014, Free Software Foundation, Inc + 2003-2014, Free Software Foundation, Inc + 2004-2014, Free Software Foundation, Inc + 2006-2014, Free Software Foundation, Inc + 2009-2014, Free Software Foundation, Inc License: UNKNOWN FIXME @@ -291,6 +291,7 @@ Files: install-sh Copyright: 1994, X Consortium + and license License: Expat FIXME @@ -329,12 +330,18 @@ License: GPL-2+ FIXME +Files: debian/rules +Copyright: 2003-2012, Claire Connelly + 2014, Vasudev Kamath + 2014-2015, Jonas Smedegaard +License: GPL-3+ + FIXME + Files: COPYING Copyright: 1989, 1991 Free Software Foundation, Inc 19yy 19yy name of author disclaimer" for the program, if - interest in the program law: the software, and License: GPL-ever @@ -349,17 +356,18 @@ FIXME Files: include/efont/otfname.hh -Copyright: = 0, N_FAMILY = 1, N_SUBFAMILY = 2 +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 }; License: UNKNOWN FIXME Files: include/efont/cff.hh -Copyright: = 32 + 0, oIsFixedPitch = 32 + 1, oItalicAngle = 32 + 2 +Copyright: = 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 License: UNKNOWN FIXME -Files: README -Copyright: 1997-2013, Eddie Kohler +Files: README.md +Copyright: 1997-2015, Eddie Kohler + and license License: UNKNOWN FIXME diff -Nru lcdf-typetools-2.104~dfsg/debian/gbp.conf lcdf-typetools-2.105~dfsg/debian/gbp.conf --- lcdf-typetools-2.104~dfsg/debian/gbp.conf 2014-10-25 15:09:43.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/gbp.conf 2015-10-02 14:26:00.000000000 +0000 @@ -3,6 +3,4 @@ [DEFAULT] pristine-tar = True sign-tags = True - -[git-import-orig] filter = .gitignore diff -Nru lcdf-typetools-2.104~dfsg/debian/patches/1001_t1reencode_manpage_typo_fix.patch lcdf-typetools-2.105~dfsg/debian/patches/1001_t1reencode_manpage_typo_fix.patch --- lcdf-typetools-2.104~dfsg/debian/patches/1001_t1reencode_manpage_typo_fix.patch 2014-10-25 15:09:43.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/patches/1001_t1reencode_manpage_typo_fix.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -Description: Fix typo in t1reencode patch - This patch fixes typos in t1reencode tools manpage. -Author: Vasudev Kamath -Forwarded: https://github.com/kohler/lcdf-typetools/pull/4 -Last-Change: 2014-10-14 - ---- a/t1reencode/t1reencode.1 -+++ b/t1reencode/t1reencode.1 -@@ -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 @@ - .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 @@ - ' - .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 @@ - ' - .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 -Nru lcdf-typetools-2.104~dfsg/debian/patches/1002_fix_otftotfm_manpage.patch lcdf-typetools-2.105~dfsg/debian/patches/1002_fix_otftotfm_manpage.patch --- lcdf-typetools-2.104~dfsg/debian/patches/1002_fix_otftotfm_manpage.patch 1970-01-01 00:00:00.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/patches/1002_fix_otftotfm_manpage.patch 2015-10-02 14:32:51.000000000 +0000 @@ -0,0 +1,16 @@ +Description: Adjust the long lines + This patch fixes "unable to adjust line" lintian warning in + otftotfm man pages. +Author: Vasudev Kamath +Last-Update: 2015-09-01 + +--- a/otftotfm/otftotfm.1 ++++ b/otftotfm/otftotfm.1 +@@ -132,6 +132,7 @@ + l l l . + \fBFile type\fR \fBDirectory\fR \fBFilename\fR + TFM TEXMF/fonts/tfm/\fIvendor\fR/\fItypeface\fR/ \fItexname\fR[\-\-base].tfm ++.ad l + VF TEXMF/fonts/vf/\fIvendor\fR/\fItypeface\fR/ \fItexname\fR.vf + PL TEXMF/fonts/pl/\fIvendor\fR/\fItypeface\fR/ \fItexname\fR[\-\-base].pl + VPL TEXMF/fonts/vpl/\fIvendor\fR/\fItypeface\fR/ \fItexname\fR.vpl diff -Nru lcdf-typetools-2.104~dfsg/debian/patches/series lcdf-typetools-2.105~dfsg/debian/patches/series --- lcdf-typetools-2.104~dfsg/debian/patches/series 2014-10-25 14:35:57.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/patches/series 2015-10-02 14:30:09.000000000 +0000 @@ -1 +1 @@ -1001_t1reencode_manpage_typo_fix.patch +1002_fix_otftotfm_manpage.patch diff -Nru lcdf-typetools-2.104~dfsg/debian/rules lcdf-typetools-2.105~dfsg/debian/rules --- lcdf-typetools-2.104~dfsg/debian/rules 2014-10-25 14:35:57.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/rules 2015-10-02 14:30:09.000000000 +0000 @@ -1,4 +1,22 @@ #!/usr/bin/make -f +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2003-2012 Claire Connelly +# Copyright © 2014 Vasudev Kamath +# Copyright © 2014-2015 Jonas Smedegaard +# Description: Main Debian packaging script for LCDF Typetools +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/rules/upstream-tarball.mk @@ -7,18 +25,23 @@ include /usr/share/cdbs/1/class/autotools.mk DEB_UPSTREAM_URL = http://www.lcdf.org/type -DEB_UPSTREAM_TARBALL_MD5 = 1a89fe63a1b5f37588014074bf88a438 +DEB_UPSTREAM_TARBALL_MD5 = e3540d438902cb97ad8195d2c2c18ab7 DEB_UPSTREAM_REPACKAGE_EXCLUDES = glyphlist.txt pkg = lcdf-typetools +# Build-depend unversioned on debhelper +# TODO: Drop when adopted in cdbs +CDBS_BUILD_DEPENDS_rules_debhelper_v9 = debhelper + # Build-Depends glyphlist_depends = aglfn CDBS_BUILD_DEPENDS += , libkpathsea-dev (>= 2.0.2-4), $(glyphlist_depends) CDBS_DEPENDS_$(pkg) = $(glyphlist_depends) +DEB_INSTALL_DOCS_ALL += README.md + post-patches:: ln -sf /usr/share/aglfn/glyphlist.txt glyphlist.txt - clean:: - [! -h glyphlist.txt ] || rm -f glyphlist.txt + rm -f glyphlist.txt diff -Nru lcdf-typetools-2.104~dfsg/debian/source/lintian-overrides lcdf-typetools-2.105~dfsg/debian/source/lintian-overrides --- lcdf-typetools-2.104~dfsg/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/debian/source/lintian-overrides 2015-10-02 14:26:00.000000000 +0000 @@ -0,0 +1,8 @@ +# License is in License-Reference field (see bug#786450) +missing-license-text-in-dep5-copyright + +# License is in License-Reference field (see bug#786450) +missing-license-paragraph-in-dep5-copyright + +# Debhelper 9 is satisfied even in oldstable +package-needs-versioned-debhelper-build-depends 9 diff -Nru lcdf-typetools-2.104~dfsg/include/efont/afm.hh lcdf-typetools-2.105~dfsg/include/efont/afm.hh --- lcdf-typetools-2.104~dfsg/include/efont/afm.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/afm.hh 2015-07-30 17:15:25.000000000 +0000 @@ -14,7 +14,7 @@ PermString notice; PermString encoding_scheme; - PermString kind() const { return "AFM"; } + PermString kind() const { return "AFM"; } }; @@ -41,7 +41,7 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/afmparse.hh lcdf-typetools-2.105~dfsg/include/efont/afmparse.hh --- lcdf-typetools-2.104~dfsg/include/efont/afmparse.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/afmparse.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,29 +10,29 @@ 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 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 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(); } 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/afmw.hh lcdf-typetools-2.105~dfsg/include/efont/afmw.hh --- lcdf-typetools-2.104~dfsg/include/efont/afmw.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/afmw.hh 2015-07-30 17:15:25.000000000 +0000 @@ -19,7 +19,7 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/amfm.hh lcdf-typetools-2.105~dfsg/include/efont/amfm.hh --- lcdf-typetools-2.104~dfsg/include/efont/amfm.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/amfm.hh 2015-07-30 17:15:25.000000000 +0000 @@ -24,7 +24,7 @@ bool loaded; Metrics *afm; - AmfmMaster() : loaded(0), afm(0) { } + AmfmMaster() : loaded(0), afm(0) { } }; @@ -44,25 +44,25 @@ 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 &design, - const Vector &weight, ErrorHandler *); + const Vector &weight, ErrorHandler *); private: @@ -96,8 +96,8 @@ 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 &design) const; @@ -122,9 +122,9 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/cff.hh lcdf-typetools-2.105~dfsg/include/efont/cff.hh --- lcdf-typetools-2.104~dfsg/include/efont/cff.hh 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/cff.hh 2015-07-30 17:15:25.000000000 +0000 @@ -22,54 +22,54 @@ 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 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 @@ 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::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::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 @@ 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 @@ 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 &) const; Charstring *glyph(int) const; @@ -296,23 +296,23 @@ 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 &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 @@ 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 &) const; Charstring *glyph(int) const; @@ -361,7 +361,7 @@ String dict_string(DictOperator) const; inline bool dict_value(DictOperator, double *) const; inline bool dict_value(DictOperator, Vector &) const; - const Dict &top_dict() const { return _top_dict; } + const Dict &top_dict() const { return _top_dict; } private: @@ -388,15 +388,15 @@ { 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 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/encoding.hh lcdf-typetools-2.105~dfsg/include/efont/encoding.hh --- lcdf-typetools-2.104~dfsg/include/efont/encoding.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/encoding.hh 2015-07-30 17:15:25.000000000 +0000 @@ -12,14 +12,14 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/findmet.hh lcdf-typetools-2.105~dfsg/include/efont/findmet.hh --- lcdf-typetools-2.104~dfsg/include/efont/findmet.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/findmet.hh 2015-07-30 17:15:25.000000000 +0000 @@ -13,10 +13,10 @@ 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 @@ MetricsFinder *_next; MetricsFinder *_prev; - MetricsFinder(const MetricsFinder &) { } - MetricsFinder &operator=(const MetricsFinder &) { return *this; } + MetricsFinder(const MetricsFinder &) { } + MetricsFinder &operator=(const MetricsFinder &) { return *this; } protected: diff -Nru lcdf-typetools-2.104~dfsg/include/efont/metrics.hh lcdf-typetools-2.105~dfsg/include/efont/metrics.hh --- lcdf-typetools-2.104~dfsg/include/efont/metrics.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/metrics.hh 2015-07-30 17:15:25.000000000 +0000 @@ -15,59 +15,59 @@ Metrics(PermString font_name, PermString full_name, const Metrics &); ~Metrics(); - void use() { _uses++; } - void unuse() { if (--_uses == 0) delete this; } + 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; } + 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; } + 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(); } + int nglyphs() const { return _names.size(); } PermString name(GlyphIndex gi) const { return _names[gi]; } - GlyphIndex find(PermString n) const { return _name_map[n]; } + 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); } + 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; } + double scale() const { return _scale; } + void set_scale(double d) { _scale = d; } - int nfd() const { return _fdv.size(); } - int nkv() const { return _kernv.size(); } + 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]; } + 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); @@ -75,14 +75,14 @@ // PAIR PROGRAM - PairProgram *pair_program() { return &_pairp; } - const PairProgram *pair_program() const { return &_pairp; } + 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]]; } + MetricsXt *find_xt(PermString name) const { return _xt[_xt_map[name]]; } void add_xt(MetricsXt *); private: @@ -122,12 +122,12 @@ public: - MetricsXt() { } - virtual ~MetricsXt() { } + MetricsXt() { } + virtual ~MetricsXt() { } virtual PermString kind() const = 0; - virtual void reserve_glyphs(int) { } + virtual void reserve_glyphs(int) { } }; diff -Nru lcdf-typetools-2.104~dfsg/include/efont/otfcmap.hh lcdf-typetools-2.105~dfsg/include/efont/otfcmap.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfcmap.hh 2014-07-04 11:43:06.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfcmap.hh 2015-04-21 21:06:10.000000000 +0000 @@ -3,6 +3,7 @@ #define EFONT_OTFCMAP_HH #include #include +#include namespace Efont { namespace OpenType { class Cmap { public: @@ -10,12 +11,12 @@ 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 &in, Vector &out) const; - inline void unmap_all(Vector &g2c) const; + inline void unmap_all(Vector > &ugp) const; private: @@ -26,30 +27,28 @@ mutable Vector _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 &g2c, ErrorHandler * = 0) const; + void dump_table(int t, Vector > &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 &g2c) const -{ - dump_table(USE_FIRST_UNICODE_TABLE, g2c, ErrorHandler::default_handler()); +inline void Cmap::unmap_all(Vector > &ugp) const { + dump_table(USE_FIRST_UNICODE_TABLE, ugp, ErrorHandler::default_handler()); } inline const uint8_t* Cmap::table_data(int t) const { diff -Nru lcdf-typetools-2.104~dfsg/include/efont/otfdata.hh lcdf-typetools-2.105~dfsg/include/efont/otfdata.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfdata.hh 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfdata.hh 2015-08-10 19:45:55.000000000 +0000 @@ -37,39 +37,40 @@ 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 @@ 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 @@ inline uint8_t Data::operator[](unsigned offset) const throw (Bounds) { if (offset >= static_cast(_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 uint16_t Data::u16(unsigned offset) const throw (Bounds) { if (offset + 1 >= static_cast(_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(_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(_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(_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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otfgpos.hh lcdf-typetools-2.105~dfsg/include/efont/otfgpos.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfgpos.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfgpos.hh 2015-07-30 17:15:25.000000000 +0000 @@ -30,14 +30,14 @@ 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 &, 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 @@ 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 @@ Coverage coverage() const throw (); void unparse(Vector &) 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 * = 0) const; String unparse(const Vector * = 0) const; }; @@ -124,10 +124,10 @@ 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 &gs) const; void unparse(StringAccum &, const Vector * = 0) const; @@ -148,33 +148,33 @@ 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 @@ { 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otfgsub.hh lcdf-typetools-2.105~dfsg/include/efont/otfgsub.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfgsub.hh 2014-07-06 12:30:45.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfgsub.hh 2015-07-30 17:15:25.000000000 +0000 @@ -32,15 +32,15 @@ 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 &gmap) const; bool unparse_automatics(const Gsub &gsub, Vector &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 @@ void unparse(Vector &, 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 @@ void unparse(Vector &) 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 @@ const Gsub& gsub, Vector& 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 &outsubs, - const Substitution &prototype_sub); + int nglyph, int glyphtab_offset, const Coverage &limit, + int nsub, int subtab_offset, + const Gsub &gsub, Vector &outsubs, + const Substitution &prototype_sub); friend class GsubChainContext; }; @@ -119,8 +119,8 @@ void mark_out_glyphs(const Gsub &gsub, Vector &gmap) const; bool unparse(const Gsub &gsub, Vector &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 &subs, const Coverage &limit) const; @@ -210,9 +210,9 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otf.hh lcdf-typetools-2.105~dfsg/include/efont/otf.hh --- lcdf-typetools-2.104~dfsg/include/efont/otf.hh 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otf.hh 2015-07-30 17:15:25.000000000 +0000 @@ -8,26 +8,26 @@ 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 @@ 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 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& scripts, Vector& langsys, ErrorHandler* = 0) const; int features(Tag script, Tag langsys, int& required_fid, Vector& 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 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 @@ 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 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 &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 - - 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; - - 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; } + iterator() : _pos(0), _value(0) { } + // private constructor + // default destructor + + 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; + + 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; } 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 @@ 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 @@ 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 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; } - - 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; } + Glyph operator*() const { return *_coviter; } + Glyph value() const { return *_coviter; } + int class_value() const { return _class; } + + 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; } 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 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otfname.hh lcdf-typetools-2.105~dfsg/include/efont/otfname.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfname.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfname.hh 2015-07-30 17:15:25.000000000 +0000 @@ -2,7 +2,7 @@ #ifndef EFONT_OTFNAME_HH #define EFONT_OTFNAME_HH #include -#include // for ntohl() +#include // for ntohl() #include namespace Efont { namespace OpenType { @@ -11,20 +11,20 @@ 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 @@ 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::end() const { if (_error >= 0) { - int count = Data::u16_aligned(_str.udata() + 2); - return reinterpret_cast(_str.udata() + HEADER_SIZE + NAMEREC_SIZE * count); + int count = Data::u16_aligned(_str.udata() + 2); + return reinterpret_cast(_str.udata() + HEADER_SIZE + NAMEREC_SIZE * count); } else - return reinterpret_cast(_str.udata() + HEADER_SIZE); + return reinterpret_cast(_str.udata() + HEADER_SIZE); } @@ -103,18 +103,18 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otfos2.hh lcdf-typetools-2.105~dfsg/include/efont/otfos2.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfos2.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfos2.hh 2015-08-10 19:49:04.000000000 +0000 @@ -11,17 +11,18 @@ 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 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/otfpost.hh lcdf-typetools-2.105~dfsg/include/efont/otfpost.hh --- lcdf-typetools-2.104~dfsg/include/efont/otfpost.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/otfpost.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,15 +10,15 @@ 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 &gnames) const; private: diff -Nru lcdf-typetools-2.104~dfsg/include/efont/pairop.hh lcdf-typetools-2.105~dfsg/include/efont/pairop.hh --- lcdf-typetools-2.104~dfsg/include/efont/pairop.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/pairop.hh 2015-07-30 17:15:25.000000000 +0000 @@ -6,16 +6,16 @@ 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 @@ 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; } - - GlyphIndex left() const { return _left; } - GlyphIndex right() const { return _right; } - GlyphIndex result() const { assert(is_lig()); return _result; } - int value() const { return _val; } + 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; } PairOpIndex next_left() const { return _next_left; } private: @@ -59,22 +59,22 @@ 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 @@ 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, GlyphIndex x, int kind, - PairOpIndex nl) + PairOpIndex nl) : _left(l), _right(r), _result(x), _val(opLigature - kind), _next_left(nl) { } diff -Nru lcdf-typetools-2.104~dfsg/include/efont/psres.hh lcdf-typetools-2.105~dfsg/include/efont/psres.hh --- lcdf-typetools-2.104~dfsg/include/efont/psres.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/psres.hh 2015-07-30 17:15:25.000000000 +0000 @@ -38,12 +38,12 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/t1bounds.hh lcdf-typetools-2.105~dfsg/include/efont/t1bounds.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1bounds.hh 2014-05-23 14:40:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1bounds.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,17 +10,17 @@ CharstringBounds(); CharstringBounds(const Transform&); CharstringBounds(const Transform&, const Vector& weight_vec); - ~CharstringBounds() { } + ~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; } + 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/t1csgen.hh lcdf-typetools-2.105~dfsg/include/efont/t1csgen.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1csgen.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1csgen.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,12 +10,12 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/t1cs.hh lcdf-typetools-2.105~dfsg/include/efont/t1cs.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1cs.hh 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1cs.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,9 +10,9 @@ // 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) +#define UNKDOUBLE -9.79797e97 +#define MIN_KNOWN_DOUBLE -9.69696e97 +#define KNOWN(d) ((d) >= MIN_KNOWN_DOUBLE) class CharstringProgram; class CharstringInterp; @@ -22,101 +22,103 @@ class Charstring { public: - Charstring() { } + 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, + 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 + 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 + 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); @@ -129,15 +131,15 @@ class Type1Charstring : public Charstring { public: - Type1Charstring() { } - inline Type1Charstring(const String &); // unencrypted - Type1Charstring(int lenIV, const String &); // encrypted + 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(); } + int length() const { return _s.length(); } operator String::unspecified_bool_type() const { return _s; } inline const String &data_string() const; @@ -162,14 +164,14 @@ class Type2Charstring : public Charstring { public: - Type2Charstring() { } + 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(); } + int length() const { return _s.length(); } bool process(CharstringInterp &) const; @@ -197,44 +199,44 @@ class CharstringProgram { public: explicit CharstringProgram(unsigned units_per_em); - virtual ~CharstringProgram() { } + virtual ~CharstringProgram() { } - virtual PermString font_name() const { return PermString(); } + virtual PermString font_name() const { return PermString(); } virtual void font_matrix(double[6]) const; - unsigned units_per_em() const { return _units_per_em; } + 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; } + 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; } + 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 int nglyphs() const { return 0; } + virtual PermString glyph_name(int) const { return PermString(); } virtual void glyph_names(Vector &) const; - virtual Charstring *glyph(int) const { return 0; } - virtual Charstring *glyph(PermString) const { return 0; } + 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; } + 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 *mm_vector(VectorType, bool writable) const; - virtual Type1Encoding *type1_encoding() const { return 0; } + virtual Type1Encoding *type1_encoding() const { return 0; } virtual double global_width_x(bool is_nominal) const; @@ -247,11 +249,11 @@ enum Type1Defs { - t1Warmup_ee = 4, - t1R_ee = 55665, - t1R_cs = 4330, - t1C1 = 52845, - t1C2 = 22719 + t1Warmup_ee = 4, + t1R_ee = 55665, + t1R_cs = 4330, + t1C1 = 52845, + t1C2 = 22719 }; @@ -269,21 +271,21 @@ inline const uint8_t *Type1Charstring::data() const { if (_key >= 0) - decrypt(); + decrypt(); return reinterpret_cast(_s.data()); } inline const String &Type1Charstring::data_string() const { if (_key >= 0) - decrypt(); + decrypt(); return _s; } inline String Type1Charstring::substring(int pos, int len) const { if (_key >= 0) - decrypt(); + decrypt(); return _s.substring(pos, len); } @@ -327,11 +329,11 @@ inline CharstringContext CharstringProgram::glyph_context(int gi) const { if (!_parent_program) - return CharstringContext(this, glyph(gi)); + return CharstringContext(this, glyph(gi)); else if (const CharstringProgram *p = child_program(gi)) - return CharstringContext(p, p->glyph(gi)); + return CharstringContext(p, p->glyph(gi)); else - return CharstringContext(0, 0); + return CharstringContext(0, 0); } inline CharstringContext CharstringProgram::glyph_context(PermString gn) const diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1font.hh lcdf-typetools-2.105~dfsg/include/efont/t1font.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1font.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1font.hh 2015-07-30 17:15:25.000000000 +0000 @@ -27,53 +27,53 @@ 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 &); // 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 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 @@ 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 PermString Type1Font::font_name() const { if (!_cached_defs) - cache_defs(); + cache_defs(); return _font_name; } diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1interp.hh lcdf-typetools-2.105~dfsg/include/efont/t1interp.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1interp.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1interp.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,39 +10,39 @@ CharstringInterp(); CharstringInterp(const Vector &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 *, int); - const Vector &weight_vector() const { return _weight_vector; } - Vector *scratch_vector() { return &_scratch_vector; } + const Vector &weight_vector() const { return _weight_vector; } + Vector *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 @@ 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 @@ bool mm_command(int, int); bool itc_command(int, int); - const Point &left_sidebearing() const { return _lsb; } - const Point ¤tpoint() const { return _cp; } - void set_state_path() { _state = S_PATH; } + const Point &left_sidebearing() const { return _lsb; } + const Point ¤tpoint() 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 @@ 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 @@ 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 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 *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 void CharstringInterp::ensure_weight_vector() { if (!_weight_vector.size()) - fetch_weight_vector(); + fetch_weight_vector(); } inline bool CharstringInterp::callxsubr_command(bool g) diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1item.hh lcdf-typetools-2.105~dfsg/include/efont/t1item.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1item.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1item.hh 2015-07-30 17:15:25.000000000 +0000 @@ -15,14 +15,14 @@ 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 Type1NullItem : public Type1Item { public: - Type1NullItem() { } + Type1NullItem() { } void gen(Type1Writer &); @@ -42,17 +42,17 @@ 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 Type1EexecItem : public Type1Item { public: - Type1EexecItem(bool on) : _eexec_on(on) { } + Type1EexecItem(bool on) : _eexec_on(on) { } void gen(Type1Writer &w); @@ -77,15 +77,15 @@ typedef Vector 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 @@ 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 &); void set_normalize(const Vector &, const Vector &); @@ -111,7 +111,7 @@ void gen(Type1Writer &); void gen(StringAccum &); - Type1Definition *cast_definition() { return this; } + Type1Definition *cast_definition() { return this; } private: @@ -136,13 +136,13 @@ 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 @@ 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; } - - Type1Charstring &t1cs() { return _cs; } - const Type1Charstring &t1cs() const { return _cs; } - operator Type1Charstring &() { return _cs; } + 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; } 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 @@ 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 @@ 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 Type1Encoding::put(int e, PermString glyph) { if (_copy_of) - unshare(); + unshare(); assert(e >= 0 && e < 256); _v[e] = glyph; } diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1mm.hh lcdf-typetools-2.105~dfsg/include/efont/t1mm.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1mm.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1mm.hh 2015-07-30 17:15:25.000000000 +0000 @@ -13,21 +13,21 @@ typedef Vector 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 &); void set_normalize(const Vector &, const Vector &); diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1rw.hh lcdf-typetools-2.105~dfsg/include/efont/t1rw.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1rw.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1rw.hh 2015-07-30 17:15:25.000000000 +0000 @@ -19,9 +19,9 @@ 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 @@ 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 @@ 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 @@ inline void Type1Writer::print(int c) { if (_pos >= BufSize) - local_flush(); + local_flush(); _buf[_pos++] = c; } diff -Nru lcdf-typetools-2.104~dfsg/include/efont/t1unparser.hh lcdf-typetools-2.105~dfsg/include/efont/t1unparser.hh --- lcdf-typetools-2.104~dfsg/include/efont/t1unparser.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/t1unparser.hh 2015-07-30 17:15:25.000000000 +0000 @@ -10,9 +10,9 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/ttfhead.hh lcdf-typetools-2.105~dfsg/include/efont/ttfhead.hh --- lcdf-typetools-2.104~dfsg/include/efont/ttfhead.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/ttfhead.hh 2015-07-30 17:15:25.000000000 +0000 @@ -2,7 +2,7 @@ #ifndef EFONT_TTFHEAD_HH #define EFONT_TTFHEAD_HH #include -#include // for ntohl() +#include // for ntohl() #include namespace Efont { namespace OpenType { @@ -11,8 +11,8 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/efont/ttfkern.hh lcdf-typetools-2.105~dfsg/include/efont/ttfkern.hh --- lcdf-typetools-2.104~dfsg/include/efont/ttfkern.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/efont/ttfkern.hh 2015-07-30 17:15:25.000000000 +0000 @@ -9,7 +9,7 @@ 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 &, ErrorHandler * = 0) const; @@ -20,19 +20,19 @@ 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 -Nru lcdf-typetools-2.104~dfsg/include/lcdf/error.hh lcdf-typetools-2.105~dfsg/include/lcdf/error.hh --- lcdf-typetools-2.104~dfsg/include/lcdf/error.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/include/lcdf/error.hh 2015-09-15 17:58:10.000000000 +0000 @@ -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 @@ /** @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 @@ /** @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 @@ * 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 @@ String vformat(const char *fmt, va_list val); void *emit(const String &str, void *user_data, bool more); - void account(int level); private: diff -Nru lcdf-typetools-2.104~dfsg/lcdf-typetools.spec lcdf-typetools-2.105~dfsg/lcdf-typetools.spec --- lcdf-typetools-2.104~dfsg/lcdf-typetools.spec 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/lcdf-typetools.spec 2015-09-15 18:09:16.000000000 +0000 @@ -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 Group: Utilities/Printing diff -Nru lcdf-typetools-2.104~dfsg/libefont/afm.cc lcdf-typetools-2.105~dfsg/libefont/afm.cc --- lcdf-typetools-2.104~dfsg/libefont/afm.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/afm.cc 2015-07-30 17:15:25.000000000 +0000 @@ -18,14 +18,14 @@ #endif #include #include -#include /* for UNKDOUBLE */ +#include /* for UNKDOUBLE */ #include #include #include namespace Efont { AfmReader::AfmReader(AfmParser &parser, Metrics *afm, AfmMetricsXt *afm_xt, - ErrorHandler *errh) + ErrorHandler *errh) : _afm(afm), _afm_xt(afm_xt), _l(parser), _composite_warned(false), _metrics_sets_warned(false), _y_width_warned(0) { @@ -37,7 +37,7 @@ { AfmParser p(slurp); if (!p.ok()) - return 0; + return 0; Metrics *afm = new Metrics; AfmMetricsXt *afm_xt = new AfmMetricsXt; @@ -45,10 +45,10 @@ AfmReader reader(p, afm, afm_xt, errh); if (!reader.read()) { - delete afm; - return 0; + delete afm; + return 0; } else - return afm; + return afm; } Metrics * @@ -82,7 +82,7 @@ { GlyphIndex gi = _afm->find(name); if (gi < 0) - lerror("character `%s' doesn't exist", name.c_str()); + lerror("character `%s' doesn't exist", name.c_str()); return gi; } @@ -90,7 +90,7 @@ AfmReader::composite_warning() const { if (!_composite_warned) - lwarning("composite fonts not supported"); + lwarning("composite fonts not supported"); _composite_warned = 1; } @@ -98,7 +98,7 @@ AfmReader::metrics_sets_warning() const { if (!_metrics_sets_warned) - lwarning("only metrics set 0 is supported"); + lwarning("only metrics set 0 is supported"); _metrics_sets_warned = 1; } @@ -106,10 +106,10 @@ 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."); + lwarning("character has a nonzero Y width"); + _y_width_warned++; + if (_y_width_warned == 40) + lwarning("I won't warn you again."); } } @@ -121,12 +121,12 @@ 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()); + 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); + lwarning(context ? "unknown command `%s' in %s" + : "unknown command `%s'", keyword.c_str(), context); _l.clear_message(); } @@ -141,14 +141,14 @@ // 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; - } + 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); @@ -159,164 +159,164 @@ int direction; while (l.next_line()) - switch (l.first()) { + 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(); + 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; + return false; else - return true; + return true; } @@ -336,94 +336,94 @@ AfmParser &l = _l; l.is("C %d ; WX %g ; N %/s ; B %g %g %g %g ;", - &c, &wx, &n, &bllx, &blly, &burx, &bury); + &c, &wx, &n, &bllx, &blly, &burx, &bury); while (l.left()) { - switch (l.first()) { + 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; + 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 + l.is(";"); // get rid of any possible semicolon } // create the character if (!n) - lwarning("character without a name ignored"); + lwarning("character without a name ignored"); else { - if (_afm->find(n) != -1) - lwarning("character %s defined twice", n.c_str()); + if (_afm->find(n) != -1) + lwarning("character %s defined twice", n.c_str()); - GlyphIndex gi = _afm->add_glyph(n); + 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; + _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); + if (c != -1) + _afm->set_code(gi, c); } } @@ -434,38 +434,38 @@ assert(!ligature_left.size()); while (_l.next_line()) - // Grok the whole line. Are we on a character metric data line? - switch (_l.first()) { + // 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(); + 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"); + 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(); @@ -485,75 +485,75 @@ _afm->pair_program()->set_reversed(true); while (l.next_line()) - switch (l.first()) { + 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; + 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; - } + } } @@ -561,26 +561,26 @@ AfmReader::read_composites() const { while (_l.next_line()) - switch (_l.first()) { + 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; + 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 -Nru lcdf-typetools-2.104~dfsg/libefont/afmparse.cc lcdf-typetools-2.105~dfsg/libefont/afmparse.cc --- lcdf-typetools-2.104~dfsg/libefont/afmparse.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/afmparse.cc 2015-07-30 17:15:25.000000000 +0000 @@ -46,8 +46,8 @@ { int l = _length - 1; while (l >= 0 && isspace(_line[l])) { - _line[l] = 0; - l--; + _line[l] = 0; + l--; } _length = l + 1; } @@ -57,14 +57,14 @@ AfmParser::static_initialize() { if (name_enders[(uint8_t)'(']) - return; + 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; + = 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; @@ -96,8 +96,8 @@ // %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 +// %= rest of line/until next `=' PermString; beginning & ending spaces +// elided // %d integer // %g number // %x hex integer @@ -108,7 +108,7 @@ // ???????????? EOS vs. don't-skip-to-EOS ??????????? -#define FAIL(s) do { _message = s; return 0; } while (0) +#define FAIL(s) do { _message = s; return 0; } while (0) unsigned char * AfmParser::vis(const char *formatsigned, va_list valist) @@ -121,16 +121,16 @@ // 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"); - } + 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; @@ -139,175 +139,175 @@ while (1) { - switch (*format) { + 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 "); - 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; + /* - - - - - - - - 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 "); + 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++; + format++; } } @@ -320,10 +320,10 @@ unsigned char *new_pos = vis(format, valist); va_end(valist); if (new_pos && *new_pos == 0) { - _pos = new_pos; - return 1; + _pos = new_pos; + return 1; } else - return 0; + return 0; } @@ -335,10 +335,10 @@ unsigned char *new_pos = vis(format, valist); va_end(valist); if (new_pos) { - _pos = new_pos; - return 1; + _pos = new_pos; + return 1; } else - return 0; + return 0; } @@ -347,10 +347,10 @@ { const char *f = (const char *)_pos; while (isspace((unsigned char) *f)) - f++; + f++; const char *l = f; while (isalnum((unsigned char) *l) || *l == '_') - l++; + l++; return PermString(f, l - f); } @@ -359,7 +359,7 @@ AfmParser::skip_until(unsigned char c) { while (*_pos && *_pos != c) - _pos++; + _pos++; } } diff -Nru lcdf-typetools-2.104~dfsg/libefont/afmw.cc lcdf-typetools-2.105~dfsg/libefont/afmw.cc --- lcdf-typetools-2.104~dfsg/libefont/afmw.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/afmw.cc 2015-07-30 17:15:25.000000000 +0000 @@ -17,7 +17,7 @@ # include #endif #include -#include /* for KNOWN() */ +#include /* for KNOWN() */ namespace Efont { AfmWriter::AfmWriter(Metrics *m, FILE *f) @@ -41,8 +41,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/amfm.cc lcdf-typetools-2.105~dfsg/libefont/amfm.cc --- lcdf-typetools-2.104~dfsg/libefont/amfm.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/amfm.cc 2015-07-30 17:15:25.000000000 +0000 @@ -42,14 +42,14 @@ { assert(_uses == 0); for (int m = 0; m < _nmasters; m++) - if (_masters[m].afm) - _masters[m].afm->unuse(); + 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; + AmfmPrimaryFont *pf = _primary_fonts; + _primary_fonts = _primary_fonts->next; + delete pf; } } @@ -58,20 +58,20 @@ AmfmMetrics::sanity(ErrorHandler *errh) const { if (!_mmspace) { - errh->error("AMFM sanity: no multiple master interpolation information"); - return false; + 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 (!_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; + ok = false; return ok; } @@ -82,8 +82,8 @@ { assert(ax >= 0 && ax < _naxes); for (AmfmPrimaryFont *pf = _primary_fonts; pf; pf = pf->next) { - if (pf->labels[ax] == label) - return pf->design_vector[ax]; + if (pf->labels[ax] == label) + return pf->design_vector[ax]; } return -1; } @@ -101,50 +101,50 @@ 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); - } + 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; @@ -157,10 +157,10 @@ 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; + for (int a = 0; a < _naxes; a++) + if ((int)design_vector[a] != pf->design_vector[a]) + goto loser; + return pf; loser: ; } @@ -170,8 +170,8 @@ Metrics * AmfmMetrics::interpolate(const Vector &design_vector, - const Vector &weight_vector, - ErrorHandler *errh) + const Vector &weight_vector, + ErrorHandler *errh) { assert(design_vector.size() == _naxes); assert(weight_vector.size() == _nmasters); @@ -182,9 +182,9 @@ * 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; + if (weight_vector[m]) + if (!master(m, errh)) + return 0; /* 1. * Use the design vector to generate new FontName and FullName. */ @@ -192,23 +192,23 @@ 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; + 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; + 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 << '_'; @@ -218,11 +218,11 @@ // 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); + AfmMetricsXt *new_xt = new AfmMetricsXt((AfmMetricsXt &)*xt); + afm->add_xt(new_xt); } /* 2. @@ -231,8 +231,8 @@ 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); + if (weight_vector[m]) + afm->interpolate_dimens(*_masters[m].afm, weight_vector[m], true); return afm; } @@ -257,10 +257,10 @@ AmfmMetrics *amfm = new AmfmMetrics(finder); AmfmReader reader(parser, amfm, errh); if (!reader.read()) { - delete amfm; - return 0; + delete amfm; + return 0; } else - return amfm; + return amfm; } AmfmMetrics * @@ -306,12 +306,12 @@ 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()); + 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); + lwarning(context ? "unknown command `%s' in %s" + : "unknown command `%s'", keyword.c_str(), context); _l.clear_message(); } @@ -320,9 +320,9 @@ 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); + && _amfm->_font_name) { + _mmspace = _amfm->_mmspace = + new MultipleMasterSpace(_amfm->_font_name, _amfm->_naxes, _amfm->_nmasters); } } @@ -340,172 +340,172 @@ // 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; - } + 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]) { + 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 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(); + 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 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; + _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; + _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); + String name = l.filename().base() + ".amcp"; + Slurper slurp(_l.filename().from_directory(name)); + add_amcp_file(slurp, _amfm, _errh); } return true; @@ -518,30 +518,30 @@ int lines_read = 0; while (_l.next_line()) { - lines_read++; - switch (_l[0]) { + 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"); + 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"); + lwarning("no conversion programs in .amcp file"); } @@ -553,7 +553,7 @@ vec.clear(); double d; while (_l.is("%g", &d)) - vec.push_back(d); + vec.push_back(d); return _l.is("]"); } @@ -567,9 +567,9 @@ 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; + positions.push_back(NumVector()); + if (!read_simple_array(positions.back())) + goto error; } if (!_l.is("]")) goto error; @@ -589,15 +589,15 @@ 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; + 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; @@ -620,7 +620,7 @@ _mmspace->check(); while (_l.is("/%/s", &s)) - _mmspace->set_axis_type(ax++, s); + _mmspace->set_axis_type(ax++, s); if (!_l.is("]")) goto error; return; @@ -635,42 +635,42 @@ { bool ok = _mmspace && ax < naxes(); if (!ok) - lerror("bad axis number %d", ax); + lerror("bad axis number %d", ax); else - _mmspace->check(); + _mmspace->check(); PermString s; while (_l.next_line()) - switch (_l[0]) { + 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(); + 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: ; } @@ -682,58 +682,58 @@ AmfmMaster *amfmm; AmfmMaster dummy; if (m >= nmasters()) { - lerror("too many masters"); - amfmm = &dummy; + lerror("too many masters"); + amfmm = &dummy; } else { - if (!_amfm->_masters) - _amfm->_masters = new AmfmMaster[ nmasters() ]; - amfmm = &_amfm->_masters[m]; + 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]) { + // 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(); + 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: ; } @@ -748,20 +748,20 @@ 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"); + 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 + _l.is(";"); // get rid of any possible semicolon } pf->next = _amfm->_primary_fonts; @@ -777,30 +777,30 @@ AmfmReader::read_primary_fonts() const { while (_l.next_line()) - switch (_l[0]) { + 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(); + 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: ; } @@ -812,38 +812,38 @@ String ndv, cdv, s; while (_l.next_line()) - switch (_l[0]) { + 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; + 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)); + _mmspace->set_ndv(Type1Charstring(ndv)); + _mmspace->set_cdv(Type1Charstring(cdv)); } } diff -Nru lcdf-typetools-2.104~dfsg/libefont/cff.cc lcdf-typetools-2.105~dfsg/libefont/cff.cc --- lcdf-typetools-2.104~dfsg/libefont/cff.cc 2014-07-07 12:15:04.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/cff.cc 2015-07-30 17:15:25.000000000 +0000 @@ -55,24 +55,24 @@ }; 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 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 @@ 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() { for (int i = 0; i < _gsubrs_cs.size(); i++) - delete _gsubrs_cs[i]; + delete _gsubrs_cs[i]; } /* @@ -370,56 +370,56 @@ 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(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(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 @@ 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 @@ 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(_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(_strings_index[sid]), _strings_index[sid + 1] - _strings_index[sid]); } } @@ -480,23 +480,23 @@ 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(_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(_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 @@ 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 @@ 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::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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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::~FDSelect() { if (_my_fds) - delete[] _fds; + delete[] _fds; } int @@ -719,40 +719,40 @@ 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(_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(_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 @@ : _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 @@ 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 @@ _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]) { + 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; + 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 @@ 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 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]); + 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; + 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ { 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 @@ 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 &subrs_cs, - ErrorHandler *errh) + double &default_width_x, double &nominal_width_x, + Cff::IndexIterator &subrs_index, Vector &subrs_cs, + ErrorHandler *errh) { Vector 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 @@ 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 @@ { 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 @@ _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 @@ _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() { for (int i = 0; i < _charstrings_cs.size(); i++) - delete _charstrings_cs[i]; + delete _charstrings_cs[i]; delete _t1encoding; } @@ -1288,75 +1288,75 @@ { _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 @@ 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 @@ { Vector 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 @@ 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 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ Vector 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 @@ // 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 @@ _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() { 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 @@ { 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 @@ { 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 @@ 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 @@ : 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() { for (int i = 0; i < _subrs_cs.size(); i++) - delete _subrs_cs[i]; + delete _subrs_cs[i]; } Charstring * @@ -1660,11 +1660,11 @@ 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 @@ { 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 -Nru lcdf-typetools-2.104~dfsg/libefont/findmet.cc lcdf-typetools-2.105~dfsg/libefont/findmet.cc --- lcdf-typetools-2.104~dfsg/libefont/findmet.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/findmet.cc 2015-07-30 17:15:25.000000000 +0000 @@ -28,20 +28,20 @@ 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 *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 *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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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()); + 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(""); - Slurper slurpy(fake, f); - AmfmReader::add_amcp_file(slurpy, amfm, errh); - pclose(f); - } + FILE *f = popen(buf, "r"); + if (f) { + Filename fake(""); + Slurper slurpy(fake, f); + AmfmReader::add_amcp_file(slurpy, amfm, errh); + pclose(f); + } - delete[] buf; + delete[] buf; } Vector design = mmspace->default_design_vector(); int i = 0; while (underscore[0] == '_' && underscore[1]) { - double x = strtod(underscore + 1, const_cast(&underscore)); - mmspace->set_design(design, i, x, errh); - i++; + double x = strtod(underscore + 1, const_cast(&underscore)); + mmspace->set_design(design, i, x, errh); + i++; } Vector 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 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/Makefile.in lcdf-typetools-2.105~dfsg/libefont/Makefile.in --- lcdf-typetools-2.104~dfsg/libefont/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -77,13 +87,12 @@ PRE_UNINSTALL = : POST_UNINSTALL = : subdir = libefont -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -164,6 +173,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -322,7 +332,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libefont/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign libefont/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -603,6 +612,8 @@ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/libefont/metrics.cc lcdf-typetools-2.105~dfsg/libefont/metrics.cc --- lcdf-typetools-2.104~dfsg/libefont/metrics.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/metrics.cc 2015-07-30 17:15:25.000000000 +0000 @@ -17,7 +17,7 @@ # include #endif #include -#include /* for UNKDOUBLE */ +#include /* for UNKDOUBLE */ namespace Efont { Metrics::Metrics() @@ -91,7 +91,7 @@ static void set_dimen(Vector &dest, const Vector &src, double scale, - bool increment) + bool increment) { int c = src.size(); if (increment) diff -Nru lcdf-typetools-2.104~dfsg/libefont/otf.cc lcdf-typetools-2.105~dfsg/libefont/otf.cc --- lcdf-typetools-2.104~dfsg/libefont/otf.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otf.cc 2015-07-30 17:15:25.000000000 +0000 @@ -23,7 +23,7 @@ #include #include #include -#include // for ntohl() +#include // for ntohl() #include #include @@ -41,44 +41,44 @@ Font::parse_header(ErrorHandler *errh) { // HEADER FORMAT: - // Fixed sfnt version - // USHORT numTables - // USHORT searchRange - // USHORT entrySelector - // USHORT rangeShift + // 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; + 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; + && (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; + 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; + return errh->error("OTF table directory out of range"), -EFAULT; // TABLE DIRECTORY ENTRY FORMAT: - // ULONG tag - // ULONG checksum - // ULONG offset - // ULONG length + // 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; + 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; + last_tag = tag; } return 0; @@ -88,22 +88,22 @@ Font::check_checksums(ErrorHandler *errh) const { if (error() < 0) - return false; + 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; - } + 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; } @@ -112,21 +112,21 @@ Font::ntables() const { if (error() < 0) - return 0; + return 0; else - return Data::u16_aligned(data() + 4); + return Data::u16_aligned(data() + 4); } String Font::table(Tag tag) const { if (error() < 0) - return String(); + 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)); + return _str.substring(Data::u32_aligned(entry + 8), Data::u32_aligned(entry + 12)); else - return String(); + return String(); } bool @@ -134,7 +134,7 @@ { const uint8_t *entry = 0; if (error() >= 0) - entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE); + entry = tag.table_entry(data() + HEADER_SIZE, Data::u16_aligned(data() + 4), TABLE_DIR_ENTRY_SIZE); return entry != 0; } @@ -142,21 +142,21 @@ Font::table_checksum(Tag tag) const { if (error() < 0) - return 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); + return Data::u32_aligned(entry + 4); else - return 0; + return 0; } Tag Font::table_tag(int i) const { if (error() < 0 || i < 0 || i >= ntables()) - return Tag(); + return Tag(); else - return Tag(Data::u32_aligned(data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i)); + return Tag(Data::u32_aligned(data() + HEADER_SIZE + TABLE_DIR_ENTRY_SIZE * i)); } uint32_t @@ -164,14 +164,14 @@ { uint32_t sum = 0; if (reinterpret_cast(begin) % 4) - for (; begin + 3 < end; begin += 4) - sum += Data::u32(begin); + for (; begin + 3 < end; begin += 4) + sum += Data::u32(begin); else - for (; begin + 3 < end; begin += 4) - sum += Data::u32_aligned(begin); + 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); + leftover = (leftover << 8) + (begin < end ? *begin++ : 0); return sum + leftover; } @@ -196,67 +196,67 @@ // 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); + 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 permut; for (int i = 0; i < tags.size(); i++) - permut.push_back(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; + 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'; + 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(sa.data()), reinterpret_cast(sa.data() + sa.length())); - uint32_t *adj = reinterpret_cast(head + 8); - *adj = htonl(0xB1B0AFBA - allsum); - } + 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(sa.data()), reinterpret_cast(sa.data() + sa.length())); + uint32_t *adj = reinterpret_cast(head + 8); + *adj = htonl(0xB1B0AFBA - allsum); + } } return Font(sa.take_string()); @@ -272,32 +272,32 @@ : _tag(0) { if (!s) - 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 == 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 = 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; + 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; } } @@ -306,8 +306,8 @@ { uint32_t tag = _tag; for (int i = 0; i < 4; i++, tag >>= 8) - if ((tag & 255) < 32 || (tag & 255) > 126) - return false; + if ((tag & 255) < 32 || (tag & 255) > 126) + return false; return true; } @@ -317,13 +317,13 @@ 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; - } + 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(); } @@ -331,9 +331,9 @@ Tag::langsys_text(Tag script, Tag langsys) { if (!langsys.null()) - return script.text() + "." + langsys.text(); + return script.text() + "." + langsys.text(); else - return script.text(); + return script.text(); } const uint8_t * @@ -342,15 +342,15 @@ 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; + 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; } @@ -369,7 +369,7 @@ _str.align(4); int result = check_header(errh ? errh : ErrorHandler::silent_handler()); if (result < 0) - _str = String(); + _str = String(); return result; } @@ -377,13 +377,13 @@ ScriptList::check_header(ErrorHandler *errh) { // HEADER FORMAT: - // USHORT scriptCount - // 6bytes scriptRecord[] + // 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"); + || (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 @@ -394,12 +394,12 @@ ScriptList::script_offset(Tag script) const { if (_str.length() == 0) - return -1; + 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); + return Data::u16_aligned(entry + 4); else - return 0; + return 0; } int @@ -408,9 +408,9 @@ 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); + || (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; } @@ -420,28 +420,28 @@ { int script_off = script_offset(script); if (script_off == 0) { - script = Tag("DFLT"); - script_off = script_offset(script); + script = Tag("DFLT"); + script_off = script_offset(script); } if (script_off <= 0) - return script_off; + return script_off; // check script bounds if (check_script(script, script_off, errh) < 0) - return -1; + 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 script_off + Data::u16_aligned(entry + 4); // return default int defaultLangSys = Data::u16_aligned(data + script_off); if (defaultLangSys != 0) - return script_off + defaultLangSys; + return script_off + defaultLangSys; else - return 0; + return 0; } int @@ -453,18 +453,18 @@ 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); - } + 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; @@ -475,27 +475,27 @@ { required_fid = -1; if (clear_fids) - fids.clear(); + fids.clear(); int offset = langsys_offset(script, langsys); if (offset <= 0) - return offset; + 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); + || (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; + required_fid = f; data += offset + 6; for (int i = 0; i < featureCount; i++, data += FEATURE_RECSIZE) - fids.push_back(Data::u16_aligned(data)); + fids.push_back(Data::u16_aligned(data)); return 0; } @@ -514,7 +514,7 @@ _str.align(2); int result = check_header(errh ? errh : ErrorHandler::silent_handler()); if (result < 0) - _str = String(); + _str = String(); return result; } @@ -523,9 +523,9 @@ { 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"); + || (featureCount = Data::u16_aligned(_str.udata()), + _str.length() < FEATURELIST_HEADERSIZE + featureCount*FEATURE_RECSIZE)) + return errh->error("OTF FeatureList too short"); return 0; } @@ -533,40 +533,40 @@ FeatureList::tag(int fid) const { if (_str.length() == 0) - return Tag(); + 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)); + return Tag(Data::u32_aligned16(data + FEATURELIST_HEADERSIZE + fid*FEATURE_RECSIZE)); else - return Tag(); + return Tag(); } String FeatureList::params(int fid, int length, ErrorHandler *errh, bool old_style_offset) const { if (_str.length() == 0 || length < 0) - return String(); + return String(); if (errh == 0) - errh = ErrorHandler::silent_handler(); + 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(); + 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(); + 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(); + return String(); if (!old_style_offset) - poff += foff; + poff += foff; if (len < poff + length) - return errh->error("OTF feature parameters for feature ID %<%d%> out of range", fid), String(); + return errh->error("OTF feature parameters for feature ID %<%d%> out of range", fid), String(); else - return _str.substring(poff, length); + return _str.substring(poff, length); } String @@ -574,36 +574,36 @@ { // 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; - } + 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"); + errh->error("no valid 'size' feature data in the 'size' feature"); return String(); } @@ -611,16 +611,16 @@ FeatureList::find(Tag tag, const Vector &fids) const { if (fids.size() == 0 || _str.length() == 0) - return -1; + 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; - } + 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; } @@ -629,34 +629,34 @@ FeatureList::filter(Vector &fids, const Vector &sorted_ftags) const { if (_str.length() == 0) - fids.clear(); + fids.clear(); else { - std::sort(fids.begin(), fids.end()); // sort fids + 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++; + } - 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(); + 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(); } } @@ -664,26 +664,26 @@ FeatureList::lookups(int fid, Vector &results, ErrorHandler *errh, bool clear_results) const { if (clear_results) - results.clear(); + results.clear(); if (_str.length() == 0) - return -1; + return -1; if (errh == 0) - errh = ErrorHandler::silent_handler(); + 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); + 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); + || (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)); + results.push_back(Data::u16_aligned(ldata)); return 0; } @@ -693,11 +693,11 @@ { results.clear(); if (_str.length() == 0) - return -1; + return -1; for (int i = 0; i < fids.size(); i++) - if (lookups(fids[i], results, errh, false) < 0) - return -1; + if (lookups(fids[i], results, errh, false) < 0) + return -1; // sort results and remove duplicates std::sort(results.begin(), results.end()); @@ -712,7 +712,7 @@ Vector fidsx(fids); filter(fidsx, sorted_ftags); for (int i = 0; i < required_fids.size(); i++) - fidsx.push_back(required_fids[i]); + fidsx.push_back(required_fids[i]); return lookups(fidsx, results, errh); } @@ -722,7 +722,7 @@ Vector fidsx(fids); filter(fidsx, sorted_ftags); if (required_fid >= 0) - fidsx.push_back(required_fid); + fidsx.push_back(required_fid); return lookups(fidsx, results, errh); } @@ -733,10 +733,10 @@ Vector 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); + filter(fids, sorted_ftags); + if (required_fid >= 0) + fids.push_back(required_fid); + result = lookups(fids, results, errh); } return result; } @@ -754,13 +754,13 @@ 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); + _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); } } @@ -768,25 +768,25 @@ { int end = gmap.size(); while (end > 0 && !gmap[end - 1]) - --end; + --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; - } + _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); + n = htonl(n); + memcpy(_str.mutable_udata() + 4, &n, 4); } } @@ -795,15 +795,15 @@ { _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); + 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); } } @@ -812,31 +812,31 @@ // side effect: shorten string to cover coverage { // HEADER FORMAT: - // USHORT coverageFormat - // USHORT glyphCount + // USHORT coverageFormat + // USHORT glyphCount const uint8_t *data = _str.udata(); if (_str.length() < HEADERSIZE) - return errh->error("OTF coverage table too small"); + 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; + 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; + 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); + return errh->error("OTF coverage table has unknown format %d", coverageFormat); } _str = _str.substring(0, len); @@ -847,91 +847,91 @@ Coverage::size() const throw () { if (_str.length() == 0) - return -1; + return -1; const uint8_t *data = _str.udata(); if (data[1] == T_LIST) - return (_str.length() - HEADERSIZE) / LIST_RECSIZE; + 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; + 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); + return Data::u32_aligned(data + 4); else - return -1; + return -1; } int Coverage::coverage_index(Glyph g) const throw () { if (_str.length() == 0) - return -1; + 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; + 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; + 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; + if (g >= 0 && g < _str.length() - 8 && data[8 + g]) + return g; + else + return -1; } else - return -1; + return -1; } Glyph Coverage::operator[](int cindex) const throw () { if (_str.length() == 0 || cindex < 0) - return 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); + 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; + 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; + return 0; } void @@ -939,21 +939,21 @@ { const uint8_t *data = _str.udata(); if (_str.length() == 0) - sa << "@*#!"; + 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); - } + 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; - } + 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; + } } } @@ -972,24 +972,24 @@ 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); - } + 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); - } + 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; @@ -1003,9 +1003,9 @@ { Coverage::iterator ai = a.begin(), bi = b.begin(); while (ai && bi) { - if (*ai != *bi && !bi.forward_to(*ai)) - return false; - ai++, bi++; + if (*ai != *bi && !bi.forward_to(*ai)) + return false; + ai++, bi++; } return bi || !ai; } @@ -1021,8 +1021,8 @@ { // XXX assume _str has been checked if (!_str.length()) { - _pos = 0; - return; + _pos = 0; + return; } // shrink _str to fit the coverage table @@ -1030,24 +1030,24 @@ int n = Data::u16_aligned(data + 2); switch (Data::u16_aligned(data)) { case T_LIST: - _str = _str.substring(0, HEADERSIZE + n*LIST_RECSIZE); + _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; + _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; + _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; + 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; + _str = String(); + _pos = 0; + _value = 0; + break; } } @@ -1057,11 +1057,11 @@ const uint8_t *data = _str.udata(); assert(_pos < _str.length()); if (data[1] == T_LIST) - return (_pos - HEADERSIZE) / LIST_RECSIZE; + return (_pos - HEADERSIZE) / LIST_RECSIZE; else if (data[1] == T_RANGES) - return Data::u16_aligned(data + _pos + 4) + _value - Data::u16_aligned(data + _pos); + return Data::u16_aligned(data + _pos + 4) + _value - Data::u16_aligned(data + _pos); else - return _pos - 8; + return _pos - 8; } void @@ -1070,22 +1070,22 @@ 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; + || (data[1] == T_RANGES && ++_value <= Data::u16_aligned(data + _pos + 2))) + return; switch (data[1]) { case T_LIST: - _pos += LIST_RECSIZE; + _pos += LIST_RECSIZE; normal_pos_setting: - _value = _pos >= len ? 0 : Data::u16_aligned(data + _pos); - break; + _value = _pos >= len ? 0 : Data::u16_aligned(data + _pos); + break; case T_RANGES: - _pos += RANGES_RECSIZE; - goto normal_pos_setting; + _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; + for (++_pos; _pos < len && !data[_pos]; ++_pos) + /* do nothing */; + _value = _pos >= len ? 0 : _pos - 8; + break; } } @@ -1095,77 +1095,77 @@ // XXX really should check that this works if (find <= _value) - return find == _value; + return find == _value; else if (_pos >= _str.length()) - return false; + 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)); + // 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)); + // 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; + _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; @@ -1185,34 +1185,34 @@ 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; + 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]; + delete[] _v[i]; } int GlyphSet::change(Glyph g, bool value) { if ((unsigned)g > MAXGLYPH) - return -1; + return -1; uint32_t *&u = _v[g >> SHIFT]; if (!u) { - u = new uint32_t[VULEN]; - memset(u, 0, sizeof(uint32_t) * VULEN); + 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; + u[(g & MASK) >> 5] |= mask; else - u[(g & MASK) >> 5] &= ~mask; + u[(g & MASK) >> 5] &= ~mask; return 0; } @@ -1220,13 +1220,13 @@ 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); + 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; } @@ -1242,37 +1242,37 @@ { _str.align(2); if (check(errh ? errh : ErrorHandler::silent_handler()) < 0) - _str = String(); + _str = String(); } int ClassDef::check(ErrorHandler *errh) { // HEADER FORMAT: - // USHORT coverageFormat - // USHORT glyphCount + // 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"); + 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 + 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 + 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); + 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"); + return errh->error("OTF class def table too short"); else { - _str = _str.substring(0, len); - return 0; + _str = _str.substring(0, len); + return 0; } } @@ -1280,34 +1280,34 @@ ClassDef::lookup(Glyph g) const throw () { if (_str.length() == 0) - return -1; + 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); + 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; + 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; + return 0; } void @@ -1315,23 +1315,23 @@ { const uint8_t *data = _str.udata(); if (_str.length() == 0) - sa << "@*#!"; + 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); - } + 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); - } + 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); + } } } @@ -1356,47 +1356,47 @@ // cannot handle the_class == 0 when coviter doesn't exist if (_class == 0 && !_coviter) - throw Error("cannot iterate over ClassDef class 0"); + 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; - } + 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(); + _pos = _str.length(); else { - _pos = 0; - (*this)++; + _pos = 0; + (*this)++; } } @@ -1408,49 +1408,49 @@ bool is_list = (data[1] == T_LIST); if (_pos != 0) - _coviter++; + _coviter++; else - _pos = FIRST_POS; + _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); + 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); - } + 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; + _pos = LAST_POS; else - _pos = len; + _pos = len; } void ClassDef::class_iterator::operator++(int) { if (_class == 0) { - increment_class0(); - return; + increment_class0(); + return; } const uint8_t *data = _str.udata(); @@ -1458,26 +1458,26 @@ bool is_list = (data[1] == T_LIST); if (_pos != 0) - _coviter++; + _coviter++; else - _pos = (is_list ? LIST_HEADERSIZE : RANGES_HEADERSIZE); + _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)); - } + 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; diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfcmap.cc lcdf-typetools-2.105~dfsg/libefont/otfcmap.cc --- lcdf-typetools-2.104~dfsg/libefont/otfcmap.cc 2014-07-04 11:43:06.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfcmap.cc 2015-04-21 21:06:24.000000000 +0000 @@ -21,11 +21,11 @@ #include #include #include -#include // for ntohl() +#include // 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 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 { @@ -40,61 +40,61 @@ Cmap::parse_header(ErrorHandler *errh) { // HEADER FORMAT: - // USHORT version - // USHORT numTables + // 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; + return errh->error("OTF cmap too small"), -EFAULT; if (!(data[0] == '\000' && data[1] == '\000')) - return errh->error("bad cmap version number"), -ERANGE; + 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; + 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; + return errh->error("cmap directory out of range"), -EFAULT; // ENCODING ENTRY FORMAT: - // USHORT platformID - // USHORT encodingID - // ULONG offset + // 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; + 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); @@ -105,13 +105,13 @@ Cmap::first_table(int platform, int encoding) const { if (error() < 0) - return -1; + 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; + int p = USHORT_AT(data), e = USHORT_AT(data + 2); + if (platform == p && (encoding < 0 || encoding == e)) + return i; } return -1; } @@ -120,131 +120,131 @@ Cmap::check_table(int t, ErrorHandler *errh) const { if (!errh) - errh = ErrorHandler::silent_handler(); + 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; + errh->warning("font appears not to support Unicode"); + _first_unicode_table = 0; } if (t == USE_FIRST_UNICODE_TABLE) - t = _first_unicode_table; + t = _first_unicode_table; if (_error < 0 || t < 0 || t >= _ntables) - return errh->error("no such table"); + return errh->error("no such table"); if (_table_error[t] != -2) - return _table_error[t]; + 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 + 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; + 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; + 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; + 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; + 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; + 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); + return errh->error("bad table %d unsupported format %d", t, format); } @@ -256,205 +256,188 @@ Cmap::map_table(int t, uint32_t uni, ErrorHandler *errh) const { if ((t = check_table(t, errh)) < 0) - return 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; + 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; + 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; + 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)); + 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; + 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; + return 0; } } void -Cmap::dump_table(int t, Vector &g2c, ErrorHandler *errh) const +Cmap::dump_table(int t, Vector > &ugp, ErrorHandler *errh) const { if ((t = check_table(t, errh)) < 0) - return; + 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; + 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 (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; + 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) { - 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; + 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: { - 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; + 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; - 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; + 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; + break; } } @@ -464,10 +447,10 @@ { int t; if ((t = check_table(USE_FIRST_UNICODE_TABLE)) < 0) - return -1; + return -1; vout.resize(vin.size(), 0); for (int i = 0; i < vin.size(); i++) - vout[i] = map_table(t, vin[i]); + vout[i] = map_table(t, vin[i]); return 0; } diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfdata.cc lcdf-typetools-2.105~dfsg/libefont/otfdata.cc --- lcdf-typetools-2.104~dfsg/libefont/otfdata.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfdata.cc 2015-07-30 17:15:25.000000000 +0000 @@ -24,7 +24,7 @@ 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 @@ { int offset = u16(offset_offset); if (offset > _str.length()) - throw Bounds(); + throw Bounds(); return Data(_str.substring(offset)); } diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfdescrip.cc lcdf-typetools-2.105~dfsg/libefont/otfdescrip.cc --- lcdf-typetools-2.104~dfsg/libefont/otfdescrip.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfdescrip.cc 2015-07-30 17:15:25.000000000 +0000 @@ -209,7 +209,7 @@ { 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 @@ { 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 @@ // 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 -Nru lcdf-typetools-2.104~dfsg/libefont/otfgpos.cc lcdf-typetools-2.105~dfsg/libefont/otfgpos.cc --- lcdf-typetools-2.104~dfsg/libefont/otfgpos.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfgpos.cc 2015-07-30 17:15:25.000000000 +0000 @@ -34,18 +34,18 @@ Gpos::Gpos(const Data &d, ErrorHandler *errh) throw (Error) { - // Fixed Version - // Offset ScriptList - // Offset FeatureList - // Offset LookupList + // Fixed Version + // Offset ScriptList + // Offset FeatureList + // Offset LookupList if (d.length() == 0) - throw BlankTable("GPOS"); + throw BlankTable("GPOS"); if (d.u16(0) != 1) - throw Format("GPOS"); + throw Format("GPOS"); if (_script_list.assign(d.offset_subtable(4), errh) < 0) - throw Format("GPOS script list"); + throw Format("GPOS script list"); if (_feature_list.assign(d.offset_subtable(6), errh) < 0) - throw Format("GPOS feature list"); + throw Format("GPOS feature list"); _lookup_list = d.offset_subtable(8); } @@ -59,9 +59,9 @@ Gpos::lookup(unsigned i) const { if (i >= _lookup_list.u16(0)) - throw Error("GPOS lookup out of range"); + throw Error("GPOS lookup out of range"); else - return GposLookup(_lookup_list.offset_subtable(2 + i*2)); + return GposLookup(_lookup_list.offset_subtable(2 + i*2)); } @@ -71,7 +71,7 @@ **************************/ const int GposValue::nibble_bitcount_x2[] = { 0, 2, 2, 4, 2, 4, 4, 6, - 2, 4, 4, 6, 4, 6, 6, 8 }; + 2, 4, 4, 6, 4, 6, 6, 8 }; /************************** @@ -83,13 +83,13 @@ : _d(d) { if (_d.length() < 6) - throw Format("GPOS Lookup table"); + 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 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); } } @@ -98,11 +98,11 @@ { 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(); } bool @@ -111,29 +111,29 @@ 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; + 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; + 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; + return false; } } @@ -147,12 +147,12 @@ : _d(d) { if (_d[0] != 0 - || (_d[1] != 1 && _d[1] != 2)) - throw Format("GPOS Single Positioning"); + || (_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"); + || (_d[1] == 2 && coverage.size() > _d.u16(6))) + throw Format("GPOS Single Positioning coverage"); } Coverage @@ -165,15 +165,15 @@ GposSingle::unparse(Vector &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))); + 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())))); + 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())))); } } @@ -187,12 +187,12 @@ : _d(d) { if (_d[0] != 0 - || (_d[1] != 1 && _d[1] != 2)) - throw Format("GPOS Pair Positioning"); + || (_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"); + || (_d[1] == 1 && coverage.size() > _d.u16(8))) + throw Format("GPOS Pair Positioning coverage"); } Coverage @@ -205,40 +205,40 @@ GposPair::unparse(Vector &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))); - } - } + 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))); + } + } } } @@ -252,11 +252,11 @@ unparse_glyphid(StringAccum &sa, Glyph gid, const Vector *gns) { if (!gns) - gns = &debug_glyph_names; + gns = &debug_glyph_names; if (gid && gns && gns->size() > gid && (*gns)[gid]) - sa << (*gns)[gid]; + sa << (*gns)[gid]; else - sa << "g" << gid; + sa << "g" << gid; } void @@ -264,10 +264,10 @@ { unparse_glyphid(sa, g, gns); if (placed()) - sa << '@' << pdx << ',' << pdy; + sa << '@' << pdx << ',' << pdy; sa << '+' << adx; if (ady) - sa << '/' << ady; + sa << '/' << ady; } String @@ -294,25 +294,25 @@ Positioning::unparse(StringAccum &sa, const Vector *gns) const { if (!*this) - sa << "NULL[]"; + sa << "NULL[]"; else if (is_single()) { - sa << "SINGLE["; - _left.unparse(sa, gns); - sa << ']'; + 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 << ']'; + 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 << ']'; + sa << "PAIR["; + _left.unparse(sa, gns); + sa << ' '; + _right.unparse(sa, gns); + sa << ']'; } else - sa << "UNKNOWN[]"; + sa << "UNKNOWN[]"; } String diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfgsub.cc lcdf-typetools-2.105~dfsg/libefont/otfgsub.cc --- lcdf-typetools-2.104~dfsg/libefont/otfgsub.cc 2014-07-07 12:10:49.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfgsub.cc 2015-07-30 17:15:25.000000000 +0000 @@ -32,11 +32,11 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ : _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 @@ { 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 @@ { 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 @@ 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 @@ { 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 @@ { 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 @@ { switch (t) { case T_GLYPH: - return const_cast(&s.gid); + return const_cast(&s.gid); case T_GLYPHS: - return &s.gids[1]; + return &s.gids[1]; default: - return 0; + return 0; } } @@ -319,13 +319,13 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 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 @@ unparse_glyphid(StringAccum &sa, Glyph gid, const Vector *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 *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 << ""; + sa << ""; else - sa << "-"; + sa << "-"; } void Substitution::unparse(StringAccum &sa, const Vector *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); - } + 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 << ']'; + sa << ']'; } } @@ -568,28 +568,28 @@ 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 @@ 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 @@ : _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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ : _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 @@ { 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 &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 @@ GsubSingle::unparse(Vector &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 @@ 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 @@ : _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 @@ 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 @@ GsubMultiple::mark_out_glyphs(Vector &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 @@ { Vector 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 @@ 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 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 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 @@ : _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 @@ 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 @@ GsubLigature::mark_out_glyphs(Vector &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 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 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 @@ GsubLigature::unparse(Vector &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 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 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 @@ 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 @@ 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 @@ 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 @@ Vector &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 &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 @@ bool GsubContext::f3_unparse(const Data &data, - int nglyph, int glyphtab_offset, const Coverage &limit, - int nsub, int subtab_offset, - const Gsub &gsub, Vector &outsubs, - const Substitution &prototype_sub) + int nglyph, int glyphtab_offset, const Coverage &limit, + int nsub, int subtab_offset, + const Gsub &gsub, Vector &outsubs, + const Substitution &prototype_sub) { Vector subs; subs.push_back(prototype_sub); @@ -1124,42 +1124,42 @@ // 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 &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 @@ 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 @@ Vector backtrackc; Vector 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 backtracki; Vector 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 @@ else if (_d.u16(0) == 3) return f3_unparse(gsub, v, limit); else - return false; + return false; } diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfname.cc lcdf-typetools-2.105~dfsg/libefont/otfname.cc --- lcdf-typetools-2.104~dfsg/libefont/otfname.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfname.cc 2015-07-30 17:15:25.000000000 +0000 @@ -24,51 +24,51 @@ #include #include -#define USHORT_AT(d) (Data::u16_aligned(d)) +#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 + // 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 }; @@ -82,19 +82,19 @@ Name::parse_header(ErrorHandler *errh) { // HEADER FORMAT: - // USHORT version - // USHORT numTables + // USHORT version + // USHORT numTables int len = _str.length(); const uint8_t *data = _str.udata(); if (len == 0) - return errh->error("font has no % table"), -EFAULT; + return errh->error("font has no % table"), -EFAULT; if (HEADER_SIZE > len) - return errh->error("% table too small"), -EFAULT; + return errh->error("% table too small"), -EFAULT; if (!(data[0] == '\000' && data[1] == '\000')) - return errh->error("bad % version number"), -ERANGE; + return errh->error("bad % version number"), -ERANGE; int count = USHORT_AT(data + 2); if (HEADER_SIZE + count*NAMEREC_SIZE > len) - return errh->error("% table too small"), -EFAULT; + return errh->error("% table too small"), -EFAULT; return 0; } @@ -102,11 +102,11 @@ Name::name(const_iterator i) const { if (i < end()) { - int stringOffset = USHORT_AT(_str.udata() + 4); - int length = USHORT_AT(reinterpret_cast(i) + 8); - int offset = USHORT_AT(reinterpret_cast(i) + 10); - if (stringOffset + offset + length <= _str.length()) - return _str.substring(stringOffset + offset, length); + int stringOffset = USHORT_AT(_str.udata() + 4); + int length = USHORT_AT(reinterpret_cast(i) + 8); + int offset = USHORT_AT(reinterpret_cast(i) + 10); + if (stringOffset + offset + length <= _str.length()) + return _str.substring(stringOffset + offset, length); } return String(); } @@ -117,35 +117,35 @@ // This code can handle Microsoft Unicode BMP and Mac Roman encodings, // but that's it if (!(i < end())) - return String(); + return String(); int stringOffset = USHORT_AT(_str.udata() + 4); int length = USHORT_AT(reinterpret_cast(i) + 8); int offset = USHORT_AT(reinterpret_cast(i) + 10); if (stringOffset + offset + length > _str.length()) - return String(); + 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(); + 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(); - } + 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); + return _str.substring(begins, ends); } String @@ -154,7 +154,7 @@ 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)); + it = std::find_if(begin(), end, PlatformPred(nameid, P_MACINTOSH, E_MAC_ROMAN, 0)); return utf8_name(it); } @@ -164,29 +164,29 @@ 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; + 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; + || v[0] != 'C' || v[1] != 'o' || v[2] != 'r' || v[3] != 'e') + return false; for (v += 4; v < endv && *v != ';'; v++) - /* do nothing */; + /* do nothing */; if (v + 12 > endv || memcmp(v, ";makeotf.lib", 12) != 0) - return false; + return false; return true; } diff -Nru lcdf-typetools-2.104~dfsg/libefont/otfos2.cc lcdf-typetools-2.105~dfsg/libefont/otfos2.cc --- lcdf-typetools-2.104~dfsg/libefont/otfos2.cc 2013-10-13 15:49:15.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfos2.cc 2015-07-30 17:15:25.000000000 +0000 @@ -29,18 +29,18 @@ { _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 -Nru lcdf-typetools-2.104~dfsg/libefont/otfpost.cc lcdf-typetools-2.105~dfsg/libefont/otfpost.cc --- lcdf-typetools-2.104~dfsg/libefont/otfpost.cc 2013-10-13 15:49:29.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/otfpost.cc 2015-07-30 17:15:26.000000000 +0000 @@ -21,81 +21,81 @@ #include #include #include -#include // for ntohl() +#include // 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)) +#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 + ".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 + "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 + "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 }; @@ -110,58 +110,46 @@ 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 + // 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 + 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; + || (_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++; - } + // 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; + _nglyphs = N_MAC_GLYPHS; else - _nglyphs = -1; + _nglyphs = -1; return 0; } @@ -170,7 +158,7 @@ Post::italic_angle() const { if (error() < 0) - return -1; + return -1; return (double) LONG_AT(_str.udata() + 4) / 65536.; } @@ -178,7 +166,7 @@ Post::is_fixed_pitch() const { if (error() < 0) - return false; + return false; return ULONG_AT(_str.udata() + 12) != 0; } @@ -187,26 +175,26 @@ { gnames.clear(); if (error() < 0) - return false; + return false; if (_version == 1) { - for (int i = 0; i < N_MAC_GLYPHS; i++) - gnames.push_back(mac_names[i]); - return true; + 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; + 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; + return false; } }} diff -Nru lcdf-typetools-2.104~dfsg/libefont/pairop.cc lcdf-typetools-2.105~dfsg/libefont/pairop.cc --- lcdf-typetools-2.104~dfsg/libefont/pairop.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/pairop.cc 2015-07-30 17:15:26.000000000 +0000 @@ -66,7 +66,7 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/psres.cc lcdf-typetools-2.105~dfsg/libefont/psres.cc --- lcdf-typetools-2.104~dfsg/libefont/psres.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/psres.cc 2015-07-30 17:15:26.000000000 +0000 @@ -84,17 +84,17 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ PsresDatabaseSection::add_section(PsresDatabaseSection *s, bool override) { for (HashMap::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 @@ { 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 @@ { 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1bounds.cc lcdf-typetools-2.105~dfsg/libefont/t1bounds.cc --- lcdf-typetools-2.104~dfsg/libefont/t1bounds.cc 2014-07-04 22:54:31.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1bounds.cc 2015-07-30 17:15:26.000000000 +0000 @@ -56,9 +56,9 @@ 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 @@ 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 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1cs.cc lcdf-typetools-2.105~dfsg/libefont/t1cs.cc --- lcdf-typetools-2.104~dfsg/libefont/t1cs.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1cs.cc 2015-07-30 17:15:26.000000000 +0000 @@ -98,25 +98,25 @@ 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(""); + return String(""); } 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(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(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 @@ 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 @@ Type1Charstring::decrypt() const { if (_key >= 0) { - int r = _key; - uint8_t *d = reinterpret_cast(_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(_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 @@ int left = _s.length(); while (left > 0) { - bool more; - int 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 (*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; + if (!more) + return interp.error() == CharstringInterp::errOK; - data += ahead; - left -= ahead; + data += ahead; + left -= ahead; } runoff_error: @@ -217,19 +217,19 @@ 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 @@ 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 @@ int left = _s.length(); while (left > 0) { - bool more; - int 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 (*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; + if (!more) + return interp.error() == CharstringInterp::errOK; - data += ahead; - left -= ahead; + data += ahead; + left -= ahead; } runoff_error: @@ -350,7 +350,7 @@ int n = nglyphs(); gnames.resize(n); for (int i = 0; i < n; i++) - gnames[i] = glyph_name(i); + gnames[i] = glyph_name(i); } Vector * diff -Nru lcdf-typetools-2.104~dfsg/libefont/t1csgen.cc lcdf-typetools-2.105~dfsg/libefont/t1csgen.cc --- lcdf-typetools-2.104~dfsg/libefont/t1csgen.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1csgen.cc 2015-07-30 17:15:26.000000000 +0000 @@ -48,9 +48,9 @@ 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ _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 @@ 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); + _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); - } + 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 @@ 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 @@ 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 @@ 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 @@ // 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(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(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(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_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; + _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(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(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(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); + + 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 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1font.cc lcdf-typetools-2.105~dfsg/libefont/t1font.cc --- lcdf-typetools-2.104~dfsg/libefont/t1font.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1font.cc 2015-07-30 17:15:26.000000000 +0000 @@ -37,9 +37,9 @@ { _dict = new HashMap[dLast]; for (int i = 0; i < dLast; i++) { - _index[i] = -1; - _dict_deltas[i] = 0; - _dict[i].set_default_value((Type1Definition *)0); + _index[i] = -1; + _dict_deltas[i] = 0; + _dict[i].set_default_value((Type1Definition *)0); } } @@ -50,9 +50,9 @@ { _dict = new HashMap[dLast]; for (int i = 0; i < dLast; i++) { - _index[i] = -1; - _dict_deltas[i] = 0; - _dict[i].set_default_value((Type1Definition *)0); + _index[i] = -1; + _dict_deltas[i] = 0; + _dict[i].set_default_value((Type1Definition *)0); } read(reader); } @@ -61,13 +61,13 @@ { delete[] _dict; for (int i = 0; i < _items.size(); i++) - delete _items[i]; + delete _items[i]; delete _mmspace; for (int i = 0; i < _subrs.size(); i++) - delete _subrs[i]; + delete _subrs[i]; if (!_synthetic_item) - for (int i = 0; i < _glyphs.size(); i++) - delete _glyphs[i]; + for (int i = 0; i < _glyphs.size(); i++) + delete _glyphs[i]; } void @@ -85,9 +85,9 @@ 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(); + 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); @@ -97,12 +97,12 @@ 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; - } + for (Type1Item** t1i = _items.begin(); t1i < _items.end(); t1i++) + if (*t1i == _encoding) { + delete _encoding; + *t1i = _encoding = e; + return; + } } _encoding = e; add_item(e); @@ -113,10 +113,10 @@ { int &g = _glyph_map.find_force(s->name(), _glyphs.size()); if (g == _glyphs.size()) - _glyphs.push_back(s); + _glyphs.push_back(s); else { - delete _glyphs[g]; - _glyphs[g] = s; + delete _glyphs[g]; + _glyphs[g] = s; } } @@ -134,181 +134,181 @@ 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; - } + // 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; + // 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(); + _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; + _glyphs = _synthetic_item->included_font()->_glyphs; + _glyph_map = _synthetic_item->included_font()->_glyph_map; } return (ok() ? 0 : -1); @@ -323,13 +323,13 @@ 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; + if (isspace((unsigned char) *s)) + ++s; + else if (*s == '%') { + for (++s; *s != '\r' && *s != '\n' && *s != '\0'; ++s) + /* nada */; + } else + return s; } } @@ -337,10 +337,10 @@ Type1Font::read_encoding(Type1Reader &reader, const char *first_line) { while (isspace((unsigned char) *first_line)) - first_line++; + first_line++; if (strncmp(first_line, "StandardEncoding", 16) == 0) { - add_type1_encoding(Type1Encoding::standard_encoding()); - return; + add_type1_encoding(Type1Encoding::standard_encoding()); + return; } add_type1_encoding(new Type1Encoding); @@ -350,156 +350,156 @@ 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 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))); + // 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(); + accum.clear(); } } static bool read_synthetic_string(Type1Reader &reader, StringAccum &wrong_accum, - const char *format, int *value) + const char *format, int *value) { StringAccum accum; if (!reader.next_line(accum)) - return false; + return false; wrong_accum << accum; - accum.append('\0'); // ensure we don't run off the string + accum.append('\0'); // ensure we don't run off the string int n = 0; if (value) - sscanf(accum.data(), format, value, &n); + sscanf(accum.data(), format, value, &n); else - sscanf(accum.data(), format, &n); + 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) + 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; + 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; + 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; + return false; int multiplicand; if (!read_synthetic_string(reader, wrong_accum, "%d {currentfile fbufstr readstring { pop } { clear currentfile%n", &multiplicand)) - return false; + return false; if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse } repeat%n", 0)) - return false; + return false; int extra; if (!read_synthetic_string(reader, wrong_accum, "currentfile %d string readstring { pop } { clear currentfile%n", &extra)) - return false; + return false; if (!read_synthetic_string(reader, wrong_accum, "closefile /fontdownload /unexpectedEOF /.error cvx exec } ifelse%n", 0)) - return false; + return false; if (!read_synthetic_string(reader, wrong_accum, "restore } if } if%n", 0)) - return false; + return false; Type1SubsetReader subreader(&reader, multiplier*multiplicand + extra); Type1Font *synthetic = new Type1Font(subreader); if (!synthetic->ok()) - delete synthetic; + delete synthetic; else { - _synthetic_item = new Type1IncludedFont(synthetic, unique_id); - add_item(_synthetic_item); + _synthetic_item = new Type1IncludedFont(synthetic, unique_id); + add_item(_synthetic_item); } return true; } @@ -513,22 +513,22 @@ // Format. We take advantage of this. if (!_synthetic_item) - return; + return; int mod_ii; for (mod_ii = nitems() - 1; mod_ii >= 0; mod_ii--) - if (_items[mod_ii] == _synthetic_item) - break; + if (_items[mod_ii] == _synthetic_item) + break; if (mod_ii < 0) - return; + 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; - } + 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 @@ -536,28 +536,28 @@ // 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; - } + 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; - } + 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 + f->_glyphs.clear(); // don't delete glyphs; we've stolen them delete _synthetic_item; _synthetic_item = 0; } @@ -567,27 +567,27 @@ Type1Font::subr(int e) const { if (e >= 0 && e < _subrs.size() && _subrs[e]) - return &_subrs[e]->t1cs(); + return &_subrs[e]->t1cs(); else - return 0; + return 0; } PermString Type1Font::glyph_name(int i) const { if (i >= 0 && i < _glyphs.size() && _glyphs[i]) - return _glyphs[i]->name(); + return _glyphs[i]->name(); else - return PermString(); + return PermString(); } Type1Charstring * Type1Font::glyph(int i) const { if (i >= 0 && i < _glyphs.size() && _glyphs[i]) - return &_glyphs[i]->t1cs(); + return &_glyphs[i]->t1cs(); else - return 0; + return 0; } Type1Charstring * @@ -595,9 +595,9 @@ { int i = _glyph_map[name]; if (i >= 0) - return &_glyphs[i]->t1cs(); + return &_glyphs[i]->t1cs(); else - return 0; + return 0; } @@ -605,17 +605,17 @@ Type1Font::set_subr(int e, const Type1Charstring &t1cs, PermString definer) { if (e < 0) - return false; + return false; if (e >= _subrs.size()) - _subrs.resize(e + 1, (Type1Subr *)0); + _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(); + 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]; @@ -627,7 +627,7 @@ Type1Font::remove_subr(int e) { if (e < 0 || e >= _subrs.size()) - return false; + return false; delete _subrs[e]; _subrs[e] = 0; return true; @@ -637,10 +637,10 @@ Type1Font::fill_in_subrs() { while (_subrs.size() && _subrs.back() == 0) - _subrs.pop_back(); + _subrs.pop_back(); for (int i = 0; i < _subrs.size(); i++) - if (!_subrs[i]) - set_subr(i, Type1Charstring(String::make_stable("\013", 1))); + if (!_subrs[i]) + set_subr(i, Type1Charstring(String::make_stable("\013", 1))); } void @@ -649,15 +649,15 @@ Vector 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; + 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]; + delete old_subrs[i]; } @@ -665,26 +665,26 @@ 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; + _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; - } + 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; + } } } @@ -694,11 +694,11 @@ 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); + 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; } @@ -708,9 +708,9 @@ { int i; for (i = 0; i < _items.size(); i++) { - Type1CopyItem *copy = _items[i]->cast_copy(); - if (!copy || copy->value()[0] != '%') - break; + Type1CopyItem *copy = _items[i]->cast_copy(); + if (!copy || copy->value()[0] != '%') + break; } shift_indices(i, 1); _items[i] = new Type1CopyItem(comment); @@ -723,28 +723,28 @@ switch (d) { case dF: - if (_built && _index[d] > 0) - return _items[_index[d] - 1]; - break; + 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; + 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; + 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; + if (Type1Item *t1i = b_dict("Private")) + return t1i; + else if (_index[dBP] > 0) + return _items[_index[dBP] - 1]; + break; } return 0; @@ -755,19 +755,19 @@ { Type1Item *item = dict_size_item(d); if (!item) - /* nada */; + /* nada */; else if (Type1Definition *t1d = item->cast_definition()) { - int num; - if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num)) - return num; + 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); - } + 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; } @@ -777,22 +777,22 @@ { Type1Item *item = dict_size_item(d); if (!item) - return; + return; if (Type1Definition *t1d = item->cast_definition()) { - int num; - if (strstr(t1d->definer().c_str(), "dict") && t1d->value_int(num)) - t1d->set_int(size); + 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()); - } + 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()); + } } } @@ -802,17 +802,17 @@ Type1Definition *lenIV_def = p_dict("lenIV"); int lenIV = 4; if (lenIV_def) - lenIV_def->value_int(lenIV); + 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]); + 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); + _items[i]->gen(w); w.flush(); } @@ -822,7 +822,7 @@ { Type1Definition *t1d = dict("FontName"); if (t1d) - t1d->value_name(_font_name); + t1d->value_name(_font_name); _cached_defs = true; } @@ -830,7 +830,7 @@ Type1Font::mmspace() const { if (!_cached_mmspace) - create_mmspace(); + create_mmspace(); return _mmspace; } @@ -838,7 +838,7 @@ Type1Font::create_mmspace(ErrorHandler *errh) const { if (_cached_mmspace) - return _mmspace; + return _mmspace; _cached_mmspace = 1; Type1Definition *t1d; @@ -846,12 +846,12 @@ Vector< Vector > master_positions; t1d = fi_dict("BlendDesignPositions"); if (!t1d || !t1d->value_numvec_vec(master_positions)) - return 0; + return 0; int nmasters = master_positions.size(); if (nmasters <= 0) { - errh->error("bad BlendDesignPositions"); - return 0; + errh->error("bad BlendDesignPositions"); + return 0; } int naxes = master_positions[0].size(); _mmspace = new MultipleMasterSpace(font_name(), naxes, nmasters); @@ -860,36 +860,36 @@ Vector< Vector > normalize_in, normalize_out; t1d = fi_dict("BlendDesignMap"); if (t1d && t1d->value_normalize(normalize_in, normalize_out)) - _mmspace->set_normalize(normalize_in, normalize_out); + _mmspace->set_normalize(normalize_in, normalize_out); Vector 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]); + 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); + _mmspace->set_ndv(*cs); t1d = p_dict("CDV"); if (t1d && t1d->value_int(cdv) && (cs = subr(cdv))) - _mmspace->set_cdv(*cs); + _mmspace->set_cdv(*cs); Vector design_vector; t1d = dict("DesignVector"); if (t1d && t1d->value_numvec(design_vector)) - _mmspace->set_design_vector(design_vector); + _mmspace->set_design_vector(design_vector); Vector weight_vector; t1d = dict("WeightVector"); if (t1d && t1d->value_numvec(weight_vector)) - _mmspace->set_weight_vector(weight_vector); + _mmspace->set_weight_vector(weight_vector); if (!_mmspace->check(errh)) { - delete _mmspace; - _mmspace = 0; + delete _mmspace; + _mmspace = 0; } return _mmspace; } @@ -906,10 +906,10 @@ Vector 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); + 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; } } diff -Nru lcdf-typetools-2.104~dfsg/libefont/t1fontskel.cc lcdf-typetools-2.105~dfsg/libefont/t1fontskel.cc --- lcdf-typetools-2.104~dfsg/libefont/t1fontskel.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1fontskel.cc 2015-07-30 17:15:26.000000000 +0000 @@ -218,7 +218,7 @@ 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 @@ 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 @@ { 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 @@ { 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 @@ // 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 @@ 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 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 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1interp.cc lcdf-typetools-2.105~dfsg/libefont/t1interp.cc --- lcdf-typetools-2.104~dfsg/libefont/t1interp.cc 2014-07-07 12:15:59.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1interp.cc 2015-07-30 17:15:26.000000000 +0000 @@ -25,37 +25,37 @@ # 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) +#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): +# 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 + "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; @@ -92,12 +92,12 @@ CharstringInterp::interpret(const CharstringProgram *program, const Charstring *cs) { if (cs) { - initialize(); - _program = program; - cs->process(*this); - return _error == errOK; + initialize(); + _program = program; + cs->process(*this); + return _error == errOK; } else - return error(errGlyph, 0); + return error(errGlyph, 0); } bool @@ -114,17 +114,17 @@ static_assert(-errLastError == (sizeof(error_formats) / sizeof(error_formats[0])) - 1, "errLastError defined incorrectly"); if (error >= 0) - return error_formats[0]; + return error_formats[0]; else if (error < errLastError) - return "charstring unknown error number " + String(error); + 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); + 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); + return format.substring(0, percent) + String(error_data) + format.substring(percent + 2); else - return format; + return format; } bool @@ -138,8 +138,8 @@ CharstringInterp::fetch_weight_vector() { if (_program) - if (Vector *wv = _program->mm_vector(CharstringProgram::VEC_WEIGHT, false)) - _weight_vector = *wv; + if (Vector *wv = _program->mm_vector(CharstringProgram::VEC_WEIGHT, false)) + _weight_vector = *wv; } bool @@ -152,61 +152,61 @@ switch (cmd) { case Cs::cPut: - CHECK_STACK(2); - offset = (int)top(0); - vec(&_scratch_vector, offset) = top(1); - pop(2); - break; + 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; + 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; + 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; + 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 error(errUnimplemented, cmd); } @@ -222,7 +222,7 @@ ensure_weight_vector(); if (!_weight_vector.size()) - return error(errVector, cmd); + return error(errVector, cmd); int nmasters = _weight_vector.size(); CHECK_STACK(nargs * nmasters); @@ -230,9 +230,9 @@ 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]; + 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)); @@ -247,19 +247,19 @@ int amount = (int)pop(); int n = (int)pop(); if (n <= 0) - return error(errValue, cmd); + return error(errValue, cmd); CHECK_STACK(n); int base = _sp - n; while (amount < 0) - amount += n; + amount += n; int i; double copy_stack[STACK_SIZE]; for (i = 0; i < n; i++) - copy_stack[i] = _s[ base + (i+amount) % n ]; + copy_stack[i] = _s[ base + (i+amount) % n ]; for (i = 0; i < n; i++) - _s[base + i] = copy_stack[i]; + _s[base + i] = copy_stack[i]; return true; } @@ -273,132 +273,132 @@ switch (cmd) { case Cs::cBlend: - return blend_command(); + return blend_command(); case Cs::cAbs: - CHECK_STACK(1); - if (top() < 0) - top() = -top(); - break; + CHECK_STACK(1); + if (top() < 0) + top() = -top(); + break; case Cs::cAdd: - CHECK_STACK(1); - d = pop(); - top() += d; - break; + CHECK_STACK(1); + d = pop(); + top() += d; + break; case Cs::cSub: - CHECK_STACK(1); - d = pop(); - top() -= d; - break; + CHECK_STACK(1); + d = pop(); + top() -= d; + break; case Cs::cDiv: - CHECK_STACK(2); - d = pop(); - top() /= d; - break; + CHECK_STACK(2); + d = pop(); + top() /= d; + break; case Cs::cNeg: - CHECK_STACK(1); - top() = -top(); - break; + CHECK_STACK(1); + top() = -top(); + break; case Cs::cRandom: { - double d; - do { - d = random() / ((double)RAND_MAX); - } while (d == 0); - push(d); - break; + 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; + 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; + CHECK_STACK(1); + if (top() < 0) + return error(errValue, cmd); + top() = sqrt(top()); + break; case Cs::cDrop: - CHECK_STACK(1); - pop(); - break; + CHECK_STACK(1); + pop(); + break; case Cs::cExch: - CHECK_STACK(2); - d = top(0); - top(0) = top(1); - top(1) = d; - break; + 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; + 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(); + return roll_command(); case Cs::cDup: - CHECK_STACK(1); - push(top()); - break; + CHECK_STACK(1); + push(top()); + break; case Cs::cAnd: - CHECK_STACK(2); - d = pop(); - top() = (top() != 0) && (d != 0); - break; + 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; + CHECK_STACK(2); + d = pop(); + top() = (top() != 0) || (d != 0); + break; case Cs::cNot: - CHECK_STACK(1); - top() = (top() == 0); - break; + CHECK_STACK(1); + top() = (top() == 0); + break; case Cs::cEq: - CHECK_STACK(2); - d = pop(); - top() = (top() == d); - break; + 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; + 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; + 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; + // this command is found with no explanation in JansonText-Roman + CHECK_STACK(2); + pop(2); + return true; default: - return error(errUnimplemented, cmd); + return error(errUnimplemented, cmd); } @@ -414,17 +414,17 @@ Charstring *subr_cs = get_subr(which); if (!subr_cs) - return error(errSubr, which); + return error(errSubr, which); if (_subr_depth >= MAX_SUBR_DEPTH) - return error(errSubrDepth, which); + return error(errSubrDepth, which); _subr_depth++; subr_cs->process(*this); _subr_depth--; if (_error != errOK) - return false; + return false; return !done(); } @@ -437,17 +437,17 @@ Charstring *subr_cs = get_gsubr(which); if (!subr_cs) - return error(errSubr, which); + return error(errSubr, which); if (_subr_depth >= MAX_SUBR_DEPTH) - return error(errSubrDepth, which); + return error(errSubrDepth, which); _subr_depth++; subr_cs->process(*this); _subr_depth--; if (_error != errOK) - return false; + return false; return !done(); } @@ -456,7 +456,7 @@ { ensure_weight_vector(); if (!_weight_vector.size()) - return error(errVector, command); + return error(errVector, command); int nargs; switch (command) { @@ -470,20 +470,20 @@ int nmasters = _weight_vector.size(); if (size() < nargs * nmasters - || on_stack != nargs * nmasters) - return error(errMultipleMaster, command); + || 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); + 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)); + ps_push(at(base + i)); pop(on_stack); return true; @@ -494,76 +494,76 @@ { ensure_weight_vector(); if (!_weight_vector.size()) - return error(errVector, command); + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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); + return error(errOthersubr, command); } @@ -616,57 +616,57 @@ 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; + 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; + 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; + 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; + 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); + return mm_command(othersubrnum, n); case Cs::othcITC_load: case Cs::othcITC_add: @@ -678,14 +678,14 @@ case Cs::othcITC_unknown: case Cs::othcITC_ifelse: case Cs::othcITC_random: - return itc_command(othersubrnum, n); + return itc_command(othersubrnum, n); - default: // unknown + default: // unknown unknown: - ps_clear(); - for (int i = 0; i < n; i++) - ps_push(top(i)); - break; + ps_clear(); + for (int i = 0; i < n; i++) + ps_push(top(i)); + break; } @@ -699,64 +699,64 @@ switch (cmd) { case Cs::cReturn: - return false; + 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; + 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; + 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; + 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(); + 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); + 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); + return vector_command(cmd); case Cs::cBlend: case Cs::cAbs: @@ -778,102 +778,102 @@ case Cs::cEq: case Cs::cIfelse: case Cs::cPop: - return arith_command(cmd); + return arith_command(cmd); case Cs::cHlineto: - CHECK_STACK(1); - CHECK_PATH_START(); - actp_rlineto(cmd, at(0), 0); - break; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + CHECK_STACK(1); + CHECK_PATH_END(); + actp_rmoveto(cmd, 0, at(0)); + break; case Cs::cDotsection: - break; + break; case Cs::cHstem: - CHECK_STACK(2); - act_hstem(cmd, _lsb.y + at(0), at(1)); - break; + 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; + 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; + 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; + 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; + CHECK_STACK(2); + _cp = Point(at(0), at(1)); + break; case Cs::cClosepath: - CHECK_PATH_END(); - break; + CHECK_PATH_END(); + break; case Cs::cEndchar: - CHECK_PATH_END(); - set_done(); - return false; + CHECK_PATH_END(); + set_done(); + return false; case Cs::cError: default: - return error(errUnimplemented, cmd); + return error(errUnimplemented, cmd); } @@ -889,11 +889,11 @@ { _cp = _lsb = _seac_origin; if (_state != S_INITIAL) - /* ignore width */; + /* ignore width */; else if (have_width) - act_nominal_width_delta(cmd, at(0)); + act_nominal_width_delta(cmd, at(0)); else - act_default_width(cmd); + act_default_width(cmd); return (have_width ? 1 : 0); } @@ -910,310 +910,310 @@ 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; + 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; + 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; + 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)); + 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; + bottom += 2; #endif - break; + 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); + 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++; + bottom++; #endif - break; + 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)); + 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++; + bottom++; #endif - break; + 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; + 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; + 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; + 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; + 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; + 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; - } - } + 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++; + if (bottom + 1 == size()) + bottom++; #endif - break; + 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)); + 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; + bottom += 2; #endif - break; + 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)); + 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; + bottom += 6; #endif - break; + 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; - } - } + 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++; + if (bottom + 1 == size()) + bottom++; #endif - break; + 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; + 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)); + 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; + bottom += 13; #endif - break; + 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); + 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; + bottom += 7; #endif - break; + 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); + 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; + bottom += 9; #endif - break; + 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; + 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; + 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; + 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; + return false; case Cs::cCallsubr: - return callsubr_command(); + return callsubr_command(); case Cs::cCallgsubr: - return callgsubr_command(); + return callgsubr_command(); case Cs::cPut: case Cs::cGet: case Cs::cStore: case Cs::cLoad: - return vector_command(cmd); + return vector_command(cmd); case Cs::cBlend: case Cs::cAbs: @@ -1235,20 +1235,20 @@ case Cs::cEq: case Cs::cIfelse: case Cs::cPop: - return arith_command(cmd); + return arith_command(cmd); case Cs::cDotsection: - break; + break; case Cs::cError: default: - return error(errUnimplemented, cmd); + return error(errUnimplemented, cmd); } #if DEBUG_TYPE2 if (bottom != size()) - fprintf(stderr, "[left %d on stack] ", size() - bottom); + fprintf(stderr, "[left %d on stack] ", size() - bottom); #endif clear(); @@ -1273,7 +1273,7 @@ { double d = (_program ? _program->global_width_x(false) : UNKDOUBLE); if (KNOWN(d)) - act_width(cmd, Point(d, 0)); + act_width(cmd, Point(d, 0)); } void @@ -1281,7 +1281,7 @@ { double d = (_program ? _program->global_width_x(true) : UNKDOUBLE); if (KNOWN(d)) - act_width(cmd, Point(d + delta, 0)); + act_width(cmd, Point(d + delta, 0)); } void @@ -1289,11 +1289,11 @@ { 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; + || !_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); @@ -1305,10 +1305,10 @@ _state = S_SEAC; acs->process(*this); if (error() == errOK) { - CharstringInterp::initialize(); - _seac_origin = save_seac_origin; - _state = S_SEAC; - bcs->process(*this); + CharstringInterp::initialize(); + _seac_origin = save_seac_origin; + _state = S_SEAC; + bcs->process(*this); } _lsb = save_lsb; diff -Nru lcdf-typetools-2.104~dfsg/libefont/t1item.cc lcdf-typetools-2.105~dfsg/libefont/t1item.cc --- lcdf-typetools-2.104~dfsg/libefont/t1item.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1item.cc 2015-07-30 17:15:26.000000000 +0000 @@ -60,7 +60,7 @@ Type1EexecItem::gen(Type1Writer &w) { if (_eexec_on) - w << "currentfile eexec\n"; + w << "currentfile eexec\n"; w.switch_eexec(_eexec_on); } @@ -75,7 +75,7 @@ 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 @@ 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 @@ 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 * 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ bool Type1Definition::value_normalize(Vector &in, - Vector &out) const + Vector &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 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 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 @@ 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 @@ 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 @@ { StringAccum sa; if (name) - sa << '/'; + sa << '/'; sa << str; set_val(sa); } @@ -493,7 +493,7 @@ { 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 @@ 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 &vin, - const Vector &vout) + const Vector &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 @@ 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 @@ : _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() { 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 @@ { unshare(); for (int i = 0; i < 256; i++) - _v[i] = dot_notdef; + _v[i] = dot_notdef; } @@ -615,10 +615,10 @@ 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 @@ 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 @@ **/ 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 @@ // 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 @@ 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; - } + // 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.print((char *)buf, len + w.lenIV()); + delete[] buf; } w << _definer << '\n'; @@ -774,34 +774,34 @@ 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(); + 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); + 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 @@ { FILE *f = tmpfile(); if (!f) - return; + return; // write included font Type1PFAWriter new_w(f); @@ -849,10 +849,10 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1mm.cc lcdf-typetools-2.105~dfsg/libefont/t1mm.cc --- lcdf-typetools-2.104~dfsg/libefont/t1mm.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1mm.cc 2015-07-30 17:15:26.000000000 +0000 @@ -41,7 +41,7 @@ void MultipleMasterSpace::set_normalize(const Vector &nin, - const Vector &nout) + const Vector &nout) { _normalize_in = nin; _normalize_out = nout; @@ -76,15 +76,15 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 &norm_in = _normalize_in[a]; - const Vector &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 &norm_in = _normalize_in[a]; + const Vector &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 @@ 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 @@ 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 @@ _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 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1rw.cc lcdf-typetools-2.105~dfsg/libefont/t1rw.cc --- lcdf-typetools-2.104~dfsg/libefont/t1rw.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1rw.cc 2015-07-30 17:15:26.000000000 +0000 @@ -31,7 +31,7 @@ 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 @@ 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 @@ _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 @@ Type1Reader::get_base() { if (_pos >= _len) - return more_data(); + return more_data(); else - return _data[_pos++]; + return _data[_pos++]; } @@ -127,13 +127,13 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ _ungot = -1; for (int c = first_char; c >= 0; c = get()) - switch (c) { + 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; + 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { _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 @@ 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 @@ { 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 -Nru lcdf-typetools-2.104~dfsg/libefont/t1unparser.cc lcdf-typetools-2.105~dfsg/libefont/t1unparser.cc --- lcdf-typetools-2.104~dfsg/libefont/t1unparser.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/t1unparser.cc 2015-07-30 17:15:26.000000000 +0000 @@ -43,10 +43,10 @@ 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 @@ 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 @@ 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 @@ { _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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/ttfcs.cc lcdf-typetools-2.105~dfsg/libefont/ttfcs.cc --- lcdf-typetools-2.104~dfsg/libefont/ttfcs.cc 2014-07-04 11:43:06.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/ttfcs.cc 2015-04-21 21:04:45.000000000 +0000 @@ -22,7 +22,9 @@ #include #include #include +#include namespace Efont { +typedef OpenType::Glyph Glyph; TrueTypeBoundsCharstringProgram::TrueTypeBoundsCharstringProgram(const OpenType::Font* otf) : CharstringProgram(otf->units_per_em()), @@ -32,48 +34,48 @@ { OpenType::Data maxp(otf->table("maxp")); if (maxp.length() >= 6) - _nglyphs = maxp.u16(4); + _nglyphs = maxp.u16(4); OpenType::Head head(otf->table("head"), 0); if (head.ok()) - _loca_long = head.index_to_loc_format() != 0; + _loca_long = head.index_to_loc_format() != 0; if (_loca_long) - _loca.align_long(); + _loca.align_long(); int loca_onesize = (_loca_long ? 4 : 2); if (_nglyphs >= _loca.length() / loca_onesize) - _nglyphs = (_loca.length() / loca_onesize) - 1; + _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 + // 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); + && hhea.u32(0) == 0x10000) + _nhmtx = hhea.u16(34); if (_nhmtx * 4 > _hmtx.length()) - _nhmtx = _hmtx.length() / 4; + _nhmtx = _hmtx.length() / 4; } TrueTypeBoundsCharstringProgram::~TrueTypeBoundsCharstringProgram() { for (Charstring **cs = _charstrings.begin(); cs < _charstrings.end(); cs++) - delete *cs; + delete *cs; } void TrueTypeBoundsCharstringProgram::font_matrix(double matrix[6]) const { @@ -92,13 +94,13 @@ { // generate glyph names based on what pdftex can understand if (gi == 0) - return PermString(".notdef"); + 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); + OpenType::Post post(_otf->table("post")); + if (post.ok()) + post.glyph_names(_glyph_names); HashMap name2glyph(-1); // some 'post' tables are bogus, reject multiply-encoded names for (int gi = 0; gi < _glyph_names.size(); ++gi) { @@ -110,33 +112,42 @@ else _glyph_names[gi] = _glyph_names[xgi] = PermString(); } - _got_glyph_names = true; + _got_glyph_names = true; } if (gi >= 0 && gi < _glyph_names.size() && _glyph_names[gi]) - return _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 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; + OpenType::Cmap cmap(_otf->table("cmap")); + if (cmap.ok()) { + Vector > ugp; + cmap.unmap_all(ugp); + std::sort(ugp.begin(), ugp.end()); + for (Vector >::iterator it = ugp.begin(); + it != ugp.end(); ) { + Vector >::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); + char buf[10]; + sprintf(buf, "uni%04X", _unicodes[gi]); + return PermString(buf); } else - return permprintf("index%d", gi); + return permprintf("index%d", gi); } void @@ -144,76 +155,76 @@ { gn.clear(); for (int gi = 0; gi < _nglyphs; gi++) - gn.push_back(glyph_name(gi)); + gn.push_back(glyph_name(gi)); } Charstring * TrueTypeBoundsCharstringProgram::glyph(int gi) const { if (gi < 0 || gi >= _nglyphs) - return 0; + return 0; if (_charstrings.size() <= gi) - _charstrings.resize(gi + 1, (Charstring *) 0); + _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); + // 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(); + _charstrings[gi] = gen.output(); } return _charstrings[gi]; } diff -Nru lcdf-typetools-2.104~dfsg/libefont/ttfhead.cc lcdf-typetools-2.105~dfsg/libefont/ttfhead.cc --- lcdf-typetools-2.104~dfsg/libefont/ttfhead.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/ttfhead.cc 2015-07-30 17:15:26.000000000 +0000 @@ -36,33 +36,33 @@ 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 -Nru lcdf-typetools-2.104~dfsg/libefont/ttfkern.cc lcdf-typetools-2.105~dfsg/libefont/ttfkern.cc --- lcdf-typetools-2.104~dfsg/libefont/ttfkern.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/libefont/ttfkern.cc 2015-07-30 17:15:26.000000000 +0000 @@ -31,13 +31,13 @@ { 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::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 @@ 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; - } - - 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()); - } + if (_version == 0) { + if ((coverage & COV_V0_HORIZONTAL) == 0 + || (coverage & (COV_V0_MINIMUM | COV_V0_CROSS_STREAM + | COV_V0_OVERRIDE)) != 0 + || (coverage & COV_V0_FORMAT) != COV_V0_FORMAT0) + continue; + } else { + if ((coverage & (COV_V1_VERTICAL | COV_V1_CROSS_STREAM + | COV_V1_VARIATION)) != 0 + || (coverage & COV_V1_FORMAT) != COV_V1_FORMAT0) + continue; + } + + try { + uint32_t off = (_version ? 16 : 14); + uint16_t npairs = subt.u16(off - 8); + for (uint16_t j = 0; j < npairs; ++j, off += 6) { + v.push_back(Positioning(Position(subt.u16(off), 0, 0, subt.s16(off + 4), 0), + Position(subt.u16(off + 2), 0, 0, 0, 0))); + ++success; + } + } catch (Error e) { + if (errh) + errh->warning("%s, continuing", e.description.c_str()); + } } return success > 0; diff -Nru lcdf-typetools-2.104~dfsg/liblcdf/error.cc lcdf-typetools-2.105~dfsg/liblcdf/error.cc --- lcdf-typetools-2.104~dfsg/liblcdf/error.cc 2013-09-17 13:40:15.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/liblcdf/error.cc 2015-09-15 17:58:10.000000000 +0000 @@ -319,8 +319,14 @@ #define NUMBUF_SIZE 128 #define ErrH ErrorHandler -static char * -do_number(unsigned long 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 @@ if (*s2 == '}') goto braces; } - void *v = va_arg(val, void *); + void* v = va_arg(val, void*); s2 = numbuf + NUMBUF_SIZE; - s1 = do_number((unsigned long)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 @@ 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 @@ return r; } -int +void ErrorHandler::lfatal(const String &landmark, const char *fmt, ...) { va_list val; @@ -871,7 +876,7 @@ 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 @@ 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 @@ return 0; } -void -FileErrorHandler::account(int level) -{ - ErrorHandler::account(level); - if (level <= el_abort) - abort(); - else if (level <= el_fatal) - exit(-level); -} - #endif diff -Nru lcdf-typetools-2.104~dfsg/liblcdf/Makefile.in lcdf-typetools-2.105~dfsg/liblcdf/Makefile.in --- lcdf-typetools-2.104~dfsg/liblcdf/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/liblcdf/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : @FIXLIBC_TRUE@am__append_1 = fixlibc.c subdir = liblcdf -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -177,6 +186,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign liblcdf/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign liblcdf/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -584,6 +593,8 @@ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/Makefile.am lcdf-typetools-2.105~dfsg/Makefile.am --- lcdf-typetools-2.104~dfsg/Makefile.am 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/Makefile.am 2015-09-15 18:11:48.000000000 +0000 @@ -6,7 +6,7 @@ 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 @@ 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 -Nru lcdf-typetools-2.104~dfsg/Makefile.in lcdf-typetools-2.105~dfsg/Makefile.in --- lcdf-typetools-2.104~dfsg/Makefile.in 2014-07-07 12:14:02.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/Makefile.in 2015-09-15 18:11:53.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -77,15 +87,13 @@ PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/configure $(am__configure_deps) \ - $(srcdir)/autoconf.h.in COPYING INSTALL NEWS README compile \ - depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d @@ -177,6 +185,8 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/autoconf.h.in \ + COPYING INSTALL NEWS compile depcomp install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -327,7 +337,7 @@ t1dotlessj t1lint t1rawafm t1reencode t1testpage ttftotype42 EXTRA_DIST = \ - ONEWS \ + ONEWS README.md \ lcdf-typetools.spec \ include/config.h \ include/lcdf/bezier.hh \ @@ -404,7 +414,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -677,15 +686,15 @@ $(am__post_remove_distdir) dist-tarZ: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) @@ -721,17 +730,17 @@ esac chmod -R a-w $(distdir) chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=.. --prefix="$$dc_install_base" \ + --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ @@ -910,6 +919,8 @@ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-encDATA uninstall-glyphlistDATA +.PRECIOUS: Makefile + liblcdf libefont: cd $@ && $(MAKE) @@ -920,7 +931,7 @@ 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 -Nru lcdf-typetools-2.104~dfsg/mmafm/Makefile.in lcdf-typetools-2.105~dfsg/mmafm/Makefile.in --- lcdf-typetools-2.104~dfsg/mmafm/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/mmafm/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = mmafm$(EXEEXT) subdir = mmafm -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -179,6 +188,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mmafm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign mmafm/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -642,6 +651,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/mmafm/mmafm.1 lcdf-typetools-2.105~dfsg/mmafm/mmafm.1 --- lcdf-typetools-2.104~dfsg/mmafm/mmafm.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/mmafm/mmafm.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,5 +1,5 @@ .\" -*-nroff-*- -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/mmpfb/Makefile.in lcdf-typetools-2.105~dfsg/mmpfb/Makefile.in --- lcdf-typetools-2.104~dfsg/mmpfb/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/mmpfb/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = mmpfb$(EXEEXT) subdir = mmpfb -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -192,6 +201,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -322,7 +332,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mmpfb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign mmpfb/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -662,6 +671,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/mmpfb/mmpfb.1 lcdf-typetools-2.105~dfsg/mmpfb/mmpfb.1 --- lcdf-typetools-2.104~dfsg/mmpfb/mmpfb.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/mmpfb/mmpfb.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,5 +1,5 @@ .\" -*-nroff-*- -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/NEWS lcdf-typetools-2.105~dfsg/NEWS --- lcdf-typetools-2.104~dfsg/NEWS 2014-07-07 12:13:51.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/NEWS 2015-09-15 18:11:14.000000000 +0000 @@ -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 -Nru lcdf-typetools-2.104~dfsg/otfinfo/Makefile.in lcdf-typetools-2.105~dfsg/otfinfo/Makefile.in --- lcdf-typetools-2.104~dfsg/otfinfo/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otfinfo/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = otfinfo$(EXEEXT) subdir = otfinfo -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -178,6 +187,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -307,7 +317,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign otfinfo/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign otfinfo/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -644,6 +653,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/otfinfo/otfinfo.1 lcdf-typetools-2.105~dfsg/otfinfo/otfinfo.1 --- lcdf-typetools-2.104~dfsg/otfinfo/otfinfo.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otfinfo/otfinfo.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,5 +1,5 @@ '\"t -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/otfinfo/otfinfo.cc lcdf-typetools-2.105~dfsg/otfinfo/otfinfo.cc --- lcdf-typetools-2.104~dfsg/otfinfo/otfinfo.cc 2014-07-04 11:43:06.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otfinfo/otfinfo.cc 2015-04-21 20:44:47.000000000 +0000 @@ -67,6 +67,7 @@ { "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 @@ } } -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 @@ 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 @@ } 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 @@ if (!cmap.ok()) throw OpenType::Error(); - Vector g2c; - cmap.unmap_all(g2c); - Vector > 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* it = u2g.begin(); it != u2g.end(); ++it) { char name[10]; diff -Nru lcdf-typetools-2.104~dfsg/otftotfm/Makefile.in lcdf-typetools-2.105~dfsg/otftotfm/Makefile.in --- lcdf-typetools-2.104~dfsg/otftotfm/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otftotfm/Makefile.in 2015-09-15 18:06:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -82,13 +92,12 @@ @have_kpathsea_TRUE@am__append_3 = $(KPATHSEA_LIBS) @have_kpathsea_TRUE@am__append_4 = $(KPATHSEA_DEPEND) subdir = otftotfm -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -205,6 +214,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -338,7 +348,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign otftotfm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign otftotfm/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -697,6 +706,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + @KPATHSEA_RULE@ diff -Nru lcdf-typetools-2.104~dfsg/otftotfm/otftotfm.1 lcdf-typetools-2.105~dfsg/otftotfm/otftotfm.1 --- lcdf-typetools-2.104~dfsg/otftotfm/otftotfm.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otftotfm/otftotfm.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,5 +1,5 @@ '\"t -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/otftotfm/otftotfm.cc lcdf-typetools-2.105~dfsg/otftotfm/otftotfm.cc --- lcdf-typetools-2.104~dfsg/otftotfm/otftotfm.cc 2014-07-06 13:17:25.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/otftotfm/otftotfm.cc 2015-09-15 17:05:30.000000000 +0000 @@ -2284,14 +2284,14 @@ 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 -Nru lcdf-typetools-2.104~dfsg/README lcdf-typetools-2.105~dfsg/README --- lcdf-typetools-2.104~dfsg/README 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/README 1970-01-01 00:00:00.000000000 +0000 @@ -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 , or in the COPYING file in -this directory. - - -AUTHOR ------- - Eddie Kohler - 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 -Nru lcdf-typetools-2.104~dfsg/README.md lcdf-typetools-2.105~dfsg/README.md --- lcdf-typetools-2.104~dfsg/README.md 1970-01-01 00:00:00.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/README.md 2015-09-15 18:09:16.000000000 +0000 @@ -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 , or in the COPYING file in +this directory. + + +Author +------ + +Eddie Kohler , 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 -Nru lcdf-typetools-2.104~dfsg/t1dotlessj/Makefile.in lcdf-typetools-2.105~dfsg/t1dotlessj/Makefile.in --- lcdf-typetools-2.104~dfsg/t1dotlessj/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1dotlessj/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = t1dotlessj$(EXEEXT) subdir = t1dotlessj -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -179,6 +188,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t1dotlessj/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t1dotlessj/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -642,6 +651,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/t1dotlessj/t1dotlessj.1 lcdf-typetools-2.105~dfsg/t1dotlessj/t1dotlessj.1 --- lcdf-typetools-2.104~dfsg/t1dotlessj/t1dotlessj.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1dotlessj/t1dotlessj.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/t1lint/cscheck.cc lcdf-typetools-2.105~dfsg/t1lint/cscheck.cc --- lcdf-typetools-2.104~dfsg/t1lint/cscheck.cc 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1lint/cscheck.cc 2014-10-26 02:20:50.000000000 +0000 @@ -138,106 +138,125 @@ bool CharstringChecker::callothersubr() { - int othersubrnum = (int)top(0); - int n = (int)top(1); - int i; - - pop(2); - if (othersubrnum < 0 || size() < n) return false; - - if (!_started && (othersubrnum < 14 || othersubrnum > 18)) - _errh->warning("first command not % or %"); - - 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; + 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 % or %"); + + 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 % or %"); + 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; - 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 @@ return arith_command(cmd); } - if (cmd != Cs::cHsbw && cmd != Cs::cSbw) { - if (!_started) - _errh->warning("first command not % or %"); - } else { - if (_started) - _errh->error("duplicate % or %"); - } - _started = true; + if (cmd != Cs::cHsbw && cmd != Cs::cSbw) { + if (!_started) + _errh->warning("first command not % or %"); + } else { + if (_started) + _errh->error("duplicate % or %"); + } + _started = true; switch (cmd) { @@ -365,6 +384,7 @@ case Cs::cEndchar: set_done(); + _last_command = cmd; return false; case Cs::cDotsection: @@ -451,6 +471,9 @@ } + if (_last_command == 256 + Cs::othcCountercontrolpart) + _errh->error("partial counter control instruction"); + _last_command = cmd; return true; } @@ -463,7 +486,9 @@ _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 -Nru lcdf-typetools-2.104~dfsg/t1lint/cscheck.hh lcdf-typetools-2.105~dfsg/t1lint/cscheck.hh --- lcdf-typetools-2.104~dfsg/t1lint/cscheck.hh 2013-09-17 13:27:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1lint/cscheck.hh 2014-10-26 02:20:50.000000000 +0000 @@ -58,6 +58,8 @@ bool _vstem3; bool _just_flexed; + bool _counter_controlled; + int _last_command; Vector _h_hstem; Vector _h_vstem; diff -Nru lcdf-typetools-2.104~dfsg/t1lint/Makefile.in lcdf-typetools-2.105~dfsg/t1lint/Makefile.in --- lcdf-typetools-2.104~dfsg/t1lint/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1lint/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = t1lint$(EXEEXT) subdir = t1lint -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -191,6 +200,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -319,7 +329,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t1lint/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t1lint/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -657,6 +666,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/t1lint/t1lint.1 lcdf-typetools-2.105~dfsg/t1lint/t1lint.1 --- lcdf-typetools-2.104~dfsg/t1lint/t1lint.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1lint/t1lint.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/t1rawafm/Makefile.in lcdf-typetools-2.105~dfsg/t1rawafm/Makefile.in --- lcdf-typetools-2.104~dfsg/t1rawafm/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1rawafm/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = t1rawafm$(EXEEXT) subdir = t1rawafm -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -179,6 +188,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t1rawafm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t1rawafm/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -642,6 +651,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/t1rawafm/t1rawafm.1 lcdf-typetools-2.105~dfsg/t1rawafm/t1rawafm.1 --- lcdf-typetools-2.104~dfsg/t1rawafm/t1rawafm.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1rawafm/t1rawafm.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/t1rawafm/t1rawafm.cc lcdf-typetools-2.105~dfsg/t1rawafm/t1rawafm.cc --- lcdf-typetools-2.104~dfsg/t1rawafm/t1rawafm.cc 2014-05-23 13:13:20.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1rawafm/t1rawafm.cc 2015-09-15 18:03:32.000000000 +0000 @@ -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 @@ 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 @@ { FILE *f; if (!filename || strcmp(filename, "-") == 0) { - f = stdin; - filename = ""; + f = stdin; + filename = ""; #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 @@ 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 @@ 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 @@ 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 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 @@ 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 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 @@ 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 @@ Vector glyph_patterns; while (1) { - int opt = Clp_Next(clp); - switch (opt) { + 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\ + 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 Clp_NotOption: - if (font) - goto output_file; - else - do_file(clp->vstr, psres, errh); - break; - - case Clp_Done: - goto done; - - case Clp_BadOption: - usage_error(errh, 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_Done: + goto done; + + 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)); } write_afm(outf, font); diff -Nru lcdf-typetools-2.104~dfsg/t1reencode/Makefile.in lcdf-typetools-2.105~dfsg/t1reencode/Makefile.in --- lcdf-typetools-2.104~dfsg/t1reencode/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1reencode/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = t1reencode$(EXEEXT) subdir = t1reencode -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -191,6 +200,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -319,7 +329,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t1reencode/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t1reencode/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -657,6 +666,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/t1reencode/t1reencode.1 lcdf-typetools-2.105~dfsg/t1reencode/t1reencode.1 --- lcdf-typetools-2.104~dfsg/t1reencode/t1reencode.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1reencode/t1reencode.1 2015-09-15 18:09:16.000000000 +0000 @@ -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 @@ .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 @@ ' .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 @@ ' .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 -Nru lcdf-typetools-2.104~dfsg/t1testpage/Makefile.in lcdf-typetools-2.105~dfsg/t1testpage/Makefile.in --- lcdf-typetools-2.104~dfsg/t1testpage/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1testpage/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = t1testpage$(EXEEXT) subdir = t1testpage -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -179,6 +188,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t1testpage/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t1testpage/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -642,6 +651,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/t1testpage/t1testpage.1 lcdf-typetools-2.105~dfsg/t1testpage/t1testpage.1 --- lcdf-typetools-2.104~dfsg/t1testpage/t1testpage.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/t1testpage/t1testpage.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" .. diff -Nru lcdf-typetools-2.104~dfsg/ttftotype42/Makefile.in lcdf-typetools-2.105~dfsg/ttftotype42/Makefile.in --- lcdf-typetools-2.104~dfsg/ttftotype42/Makefile.in 2014-07-07 12:14:03.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/ttftotype42/Makefile.in 2015-09-15 18:06:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -78,13 +88,12 @@ POST_UNINSTALL = : bin_PROGRAMS = ttftotype42$(EXEEXT) subdir = ttftotype42 -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/lcdf-typetools.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = @@ -179,6 +188,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -305,7 +315,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ttftotype42/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ttftotype42/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -642,6 +651,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcdf-typetools-2.104~dfsg/ttftotype42/ttftotype42.1 lcdf-typetools-2.105~dfsg/ttftotype42/ttftotype42.1 --- lcdf-typetools-2.104~dfsg/ttftotype42/ttftotype42.1 2014-07-07 12:15:46.000000000 +0000 +++ lcdf-typetools-2.105~dfsg/ttftotype42/ttftotype42.1 2015-09-15 18:09:16.000000000 +0000 @@ -1,4 +1,4 @@ -.ds V 2.104 +.ds V 2.105 .de M .BR "\\$1" "(\\$2)\\$3" ..