diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-02 12:30:55 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-02 12:30:55 +0000 |
commit | 54bed52730b7a0af68847ac70f93bd1debcaa8dd (patch) | |
tree | bf3d1cd2de55c90b1d175bb53d2b6db803267765 | |
parent | 808caf0e3038020441cdb1d964efd26ebc6ba474 (diff) |
texk/ttfdump: Add a test case and fix a type
git-svn-id: svn://tug.org/texlive/trunk@22278 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/ttfdump/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/Makefile.am | 11 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/Makefile.in | 109 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/libttf/tabledir.c | 2 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/tests/FonetikaDaniaIwonaeRegular.ttf | bin | 0 -> 7456 bytes | |||
-rw-r--r-- | Build/source/texk/ttfdump/tests/ttfdump.glyf | 60 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/tests/ttfdump.head | 45 | ||||
-rwxr-xr-x | Build/source/texk/ttfdump/tests/ttfdump.test | 14 |
8 files changed, 246 insertions, 6 deletions
diff --git a/Build/source/texk/ttfdump/ChangeLog b/Build/source/texk/ttfdump/ChangeLog index 67dbf80a0de..234d4d4fd5f 100644 --- a/Build/source/texk/ttfdump/ChangeLog +++ b/Build/source/texk/ttfdump/ChangeLog @@ -1,3 +1,14 @@ +2011-04-25 Peter Breitenlohner <peb@mppmu.mpg.de> + + * tests/ttfdump.test (new): Shell script for a test case. + * tests/FonetikaDaniaIwonaeRegular.ttf (new): Test input. + * tests/ttfdump.{glyf,head} (new): Expected output. + * Makefile.am: Adapted. + +2011-04-25 Peter Breitenlohner <peb@mppmu.mpg.de> + + * libttf/tabledir.c: Fix typo "chechsum" -> "checksum". + 2010-12-08 Peter Breitenlohner <peb@mppmu.mpg.de> * configure.ac: Remove duplicate checks (done by KPSE_COMMON). diff --git a/Build/source/texk/ttfdump/Makefile.am b/Build/source/texk/ttfdump/Makefile.am index c9accb8af83..bcc47f9aa97 100644 --- a/Build/source/texk/ttfdump/Makefile.am +++ b/Build/source/texk/ttfdump/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/ttfdump/ ## -## Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -65,6 +65,15 @@ LDADD = libttf.a nodist_man1_MANS = docs/ttfdump.1 +## Tests. +## +TESTS = tests/ttfdump.test +EXTRA_DIST += $(TESTS) +DISTCLEANFILES = +## tests/ttfdump.test +EXTRA_DIST += tests/FonetikaDaniaIwonaeRegular.ttf tests/ttfdump.glyf tests/ttfdump.head +DISTCLEANFILES += FonetikaDaniaIwonaeRegular.ttf ttfdump.glyf ttfdump.head + ## Not used ## EXTRA_DIST += ILX NOTE README.bg5 diff --git a/Build/source/texk/ttfdump/Makefile.in b/Build/source/texk/ttfdump/Makefile.in index 53bd2c753ff..399b2830bff 100644 --- a/Build/source/texk/ttfdump/Makefile.in +++ b/Build/source/texk/ttfdump/Makefile.in @@ -128,6 +128,8 @@ NROFF = nroff MANS = $(nodist_man1_MANS) ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -256,7 +258,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 -EXTRA_DIST = docs include libttf src ILX NOTE README.bg5 +EXTRA_DIST = docs include libttf src $(TESTS) \ + tests/FonetikaDaniaIwonaeRegular.ttf tests/ttfdump.glyf \ + tests/ttfdump.head ILX NOTE README.bg5 INCLUDES = -I$(top_srcdir)/include AM_CPPFLAGS = -Dlint AM_CFLAGS = $(WARNING_CFLAGS) @@ -299,6 +303,9 @@ nodist_libttf_a_SOURCES = \ nodist_ttfdump_SOURCES = src/ttfdump.c LDADD = libttf.a nodist_man1_MANS = docs/ttfdump.1 +TESTS = tests/ttfdump.test +DISTCLEANFILES = FonetikaDaniaIwonaeRegular.ttf ttfdump.glyf \ + ttfdump.head all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -997,6 +1004,98 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ @@ -1161,6 +1260,7 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) config.h installdirs: @@ -1188,6 +1288,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -1268,10 +1369,10 @@ uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 -.MAKE: all install-am install-strip +.MAKE: all check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-generic clean-libtool \ +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES ctags dist dist-all dist-bzip2 dist-gzip \ dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ diff --git a/Build/source/texk/ttfdump/libttf/tabledir.c b/Build/source/texk/ttfdump/libttf/tabledir.c index 738936b2092..e950a8a7aab 100644 --- a/Build/source/texk/ttfdump/libttf/tabledir.c +++ b/Build/source/texk/ttfdump/libttf/tabledir.c @@ -71,7 +71,7 @@ void ttfPrintTableDir(FILE *fp,TableDirPtr p) FourByteSwap((unsigned char *)tagname,4); #endif - fprintf(fp,"'%s' - chechsum = 0x%08x, offset = 0x%08x, len = %9u \n", + fprintf(fp,"'%s' - checksum = 0x%08x, offset = 0x%08x, len = %9u \n", tagname,p->checksum,p->offset,p->length); } diff --git a/Build/source/texk/ttfdump/tests/FonetikaDaniaIwonaeRegular.ttf b/Build/source/texk/ttfdump/tests/FonetikaDaniaIwonaeRegular.ttf Binary files differnew file mode 100644 index 00000000000..95e09e4eb9f --- /dev/null +++ b/Build/source/texk/ttfdump/tests/FonetikaDaniaIwonaeRegular.ttf diff --git a/Build/source/texk/ttfdump/tests/ttfdump.glyf b/Build/source/texk/ttfdump/tests/ttfdump.glyf new file mode 100644 index 00000000000..be977900774 --- /dev/null +++ b/Build/source/texk/ttfdump/tests/ttfdump.glyf @@ -0,0 +1,60 @@ +True Type Font File Dumper: v 0.5.5 +Copyright 1996-1998 ollie@ms1.hinet.net +Dumping File:FonetikaDaniaIwonaeRegular.ttf + + +Offset Table +------------ + sfnt version: + number of tables: 14 + 0. 'GPOS' - checksum = 0xd7f8e75c, offset = 0x00001cd0, len = 80 + 1. 'GSUB' - checksum = 0x6c91748f, offset = 0x00001cb0, len = 32 + 2. 'OS/2' - checksum = 0x55d6fec3, offset = 0x00000168, len = 86 + 3. 'cmap' - checksum = 0x987c2758, offset = 0x0000028c, len = 482 + 4. 'cvt ' - checksum = 0x00210279, offset = 0x00000470, len = 4 + 5. 'gasp' - checksum = 0xffff0003, offset = 0x00001ca8, len = 8 + 6. 'glyf' - checksum = 0xd071d50c, offset = 0x000004dc, len = 4946 + 7. 'head' - checksum = 0xe43df9fb, offset = 0x000000ec, len = 54 + 8. 'hhea' - checksum = 0x05e9014f, offset = 0x00000124, len = 36 + 9. 'hmtx' - checksum = 0x4ca30981, offset = 0x000001c0, len = 202 + 10. 'loca' - checksum = 0x6c437107, offset = 0x00000474, len = 104 + 11. 'maxp' - checksum = 0x0079007b, offset = 0x00000148, len = 32 + 12. 'name' - checksum = 0x31984665, offset = 0x00001830, len = 1002 + 13. 'post' - checksum = 0x0aef76ec, offset = 0x00001c1c, len = 140 + +Glyph 1. + numberOfContours: 2 + xMin: 33 + yMin: 0 + xMax: 366 + yMax: 666 + + EndPoints + --------- + 0: 3 + 1: 7 + + Length of Instructions: 46 + + Flags + ----- + 0: YDual XDual X-Short On + 1: XDual On + 2: YDual On + 3: XDual On + 4: YDual Y-Short On + 5: YDual On + 6: XDual On + 7: YDual On + + Coordinates + ----------- + 0 Rel ( 33, 0) -> Abs ( 33, 0) + 1 Rel ( 0, 666) -> Abs ( 33, 666) + 2 Rel ( 333, 0) -> Abs ( 366, 666) + 3 Rel ( 0, -666) -> Abs ( 366, 0) + 4 Rel ( -300, 33) -> Abs ( 66, 33) + 5 Rel ( 267, 0) -> Abs ( 333, 33) + 6 Rel ( 0, 600) -> Abs ( 333, 633) + 7 Rel ( -267, 0) -> Abs ( 66, 633) + diff --git a/Build/source/texk/ttfdump/tests/ttfdump.head b/Build/source/texk/ttfdump/tests/ttfdump.head new file mode 100644 index 00000000000..4e626afd6f1 --- /dev/null +++ b/Build/source/texk/ttfdump/tests/ttfdump.head @@ -0,0 +1,45 @@ +True Type Font File Dumper: v 0.5.5 +Copyright 1996-1998 ollie@ms1.hinet.net +Dumping File:FonetikaDaniaIwonaeRegular.ttf + + +Offset Table +------------ + sfnt version: + number of tables: 14 + 0. 'GPOS' - checksum = 0xd7f8e75c, offset = 0x00001cd0, len = 80 + 1. 'GSUB' - checksum = 0x6c91748f, offset = 0x00001cb0, len = 32 + 2. 'OS/2' - checksum = 0x55d6fec3, offset = 0x00000168, len = 86 + 3. 'cmap' - checksum = 0x987c2758, offset = 0x0000028c, len = 482 + 4. 'cvt ' - checksum = 0x00210279, offset = 0x00000470, len = 4 + 5. 'gasp' - checksum = 0xffff0003, offset = 0x00001ca8, len = 8 + 6. 'glyf' - checksum = 0xd071d50c, offset = 0x000004dc, len = 4946 + 7. 'head' - checksum = 0xe43df9fb, offset = 0x000000ec, len = 54 + 8. 'hhea' - checksum = 0x05e9014f, offset = 0x00000124, len = 36 + 9. 'hmtx' - checksum = 0x4ca30981, offset = 0x000001c0, len = 202 + 10. 'loca' - checksum = 0x6c437107, offset = 0x00000474, len = 104 + 11. 'maxp' - checksum = 0x0079007b, offset = 0x00000148, len = 32 + 12. 'name' - checksum = 0x31984665, offset = 0x00001830, len = 1002 + 13. 'post' - checksum = 0x0aef76ec, offset = 0x00001c1c, len = 140 + +'head' Table - Font Header +-------------------------- + 'head' version: 1. 0 + fontReversion: 1. 0 + checkSumAdjustment: 0x851d4906 + magicNumber: 0x5f0f3cf5 + flags: 0x000b + unitsPerEm: 1000 + created: + modified: + xMin: -63 + yMin: -250 + xMax: 733 + yMax: 750 + macStyle bits: 0x0000 + lowestRecPPEM: 8 + fontDirectionHint: 2 + indexToLocFormat: 0 + glyphDataFormat: 0 + + diff --git a/Build/source/texk/ttfdump/tests/ttfdump.test b/Build/source/texk/ttfdump/tests/ttfdump.test new file mode 100755 index 00000000000..a4f70940795 --- /dev/null +++ b/Build/source/texk/ttfdump/tests/ttfdump.test @@ -0,0 +1,14 @@ +#! /bin/sh + +# Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +rm -rf FonetikaDaniaIwonaeRegular.ttf ttfdump.glyf ttfdump.head +cp $srcdir/tests/FonetikaDaniaIwonaeRegular.ttf . + +./ttfdump -t head FonetikaDaniaIwonaeRegular.ttf -o ttfdump.head || exit 1 +diff $srcdir/tests/ttfdump.head ttfdump.head || exit 1 + +./ttfdump -t glyf -g 1 FonetikaDaniaIwonaeRegular.ttf -o ttfdump.glyf || exit 1 +diff $srcdir/tests/ttfdump.glyf ttfdump.glyf || exit 1 + |