diff options
-rw-r--r-- | Build/source/texk/ttfdump/ChangeLog | 16 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/Makefile.am | 6 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/Makefile.in | 12 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/include/protos.h | 4 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/include/stack.h | 9 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/include/tables.h | 7 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/libttf/os2.c | 30 | ||||
-rw-r--r-- | Build/source/texk/ttfdump/tests/texmfhome.otf | bin | 0 -> 1884 bytes | |||
-rw-r--r-- | Build/source/texk/ttfdump/tests/ttfdump.os_2 | 69 | ||||
-rwxr-xr-x | Build/source/texk/ttfdump/tests/ttfdump.test | 10 |
10 files changed, 149 insertions, 14 deletions
diff --git a/Build/source/texk/ttfdump/ChangeLog b/Build/source/texk/ttfdump/ChangeLog index 3bfb89f42fd..8d4362e7c30 100644 --- a/Build/source/texk/ttfdump/ChangeLog +++ b/Build/source/texk/ttfdump/ChangeLog @@ -1,3 +1,19 @@ +2012-09-09 Peter Breitenlohner <peb@mppmu.mpg.de> + + * include/tables.h, libttf/os2.c: Handle fields present only in + versions 1 and 2 of OS/2 table. + * tests/ttfdump.test: Add a test case for OS/2 table. + * tests/texmfhome.otf (new): Test input. + * tests/ttfdump.os_2 (new): Expected output. + * Makefile.am: Adapted. + +2012-09-07 Peter Breitenlohner <peb@mppmu.mpg.de> + + * include/protos.h: Move prototypes for functions in + libttf/stack.c from here ... + * include/stack.h: ... to this new (and unused) file. + * Makefile.am (EXTRA_DIST): Add the new file. + 2012-07-14 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am, configure.ac, include/ttf.h, include/ttfutil.h, diff --git a/Build/source/texk/ttfdump/Makefile.am b/Build/source/texk/ttfdump/Makefile.am index 63b1eeaf5e5..20c82e32e31 100644 --- a/Build/source/texk/ttfdump/Makefile.am +++ b/Build/source/texk/ttfdump/Makefile.am @@ -60,6 +60,7 @@ libttf_a_SOURCES = \ ## Not used (interp.c would just produce compiler warnings). ## EXTRA_DIST = \ + include/stack.h \ libttf/fixed.c \ libttf/interp.c \ libttf/stack.c @@ -92,12 +93,15 @@ DISTCLEANFILES = ## tests/ttfdump.test EXTRA_DIST += \ tests/FonetikaDaniaIwonaeRegular.ttf \ + tests/texmfhome.otf \ tests/ttfdump.glyf \ tests/ttfdump.gpos \ tests/ttfdump.gsub \ - tests/ttfdump.head + tests/ttfdump.head \ + tests/ttfdump.os_2 DISTCLEANFILES += \ FonetikaDaniaIwonaeRegular.ttf \ + texmfhome.otf \ ttftest.* ## Not used diff --git a/Build/source/texk/ttfdump/Makefile.in b/Build/source/texk/ttfdump/Makefile.in index e7fa3db66cf..53502e74b1a 100644 --- a/Build/source/texk/ttfdump/Makefile.in +++ b/Build/source/texk/ttfdump/Makefile.in @@ -351,16 +351,18 @@ libttf_a_SOURCES = \ libttf/vhea.c \ libttf/vmtx.c -EXTRA_DIST = libttf/fixed.c libttf/interp.c libttf/stack.c \ - docs/ttfdump.dvi docs/ttfdump.html docs/ttfdump.ps $(TESTS) \ - tests/FonetikaDaniaIwonaeRegular.ttf tests/ttfdump.glyf \ - tests/ttfdump.gpos tests/ttfdump.gsub tests/ttfdump.head ILX \ +EXTRA_DIST = include/stack.h libttf/fixed.c libttf/interp.c \ + libttf/stack.c docs/ttfdump.dvi docs/ttfdump.html \ + docs/ttfdump.ps $(TESTS) tests/FonetikaDaniaIwonaeRegular.ttf \ + tests/texmfhome.otf tests/ttfdump.glyf tests/ttfdump.gpos \ + tests/ttfdump.gsub tests/ttfdump.head tests/ttfdump.os_2 ILX \ NOTE README.bg5 ttfdump_SOURCES = src/ttfdump.c LDADD = libttf.a $(KPATHSEA_LIBS) dist_man1_MANS = docs/ttfdump.1 TESTS = tests/ttfdump.test -DISTCLEANFILES = FonetikaDaniaIwonaeRegular.ttf ttftest.* +DISTCLEANFILES = FonetikaDaniaIwonaeRegular.ttf texmfhome.otf \ + ttftest.* all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/ttfdump/include/protos.h b/Build/source/texk/ttfdump/include/protos.h index 66523ab808f..b1ccb2923d4 100644 --- a/Build/source/texk/ttfdump/include/protos.h +++ b/Build/source/texk/ttfdump/include/protos.h @@ -14,9 +14,5 @@ extern void ttfPrintPCLT(FILE*, PCLTPtr); extern void ttfPrintVHEA(FILE*, VHEAPtr); extern void ttfPrintVMTX(FILE*, VMTXPtr); extern BYTE ttfGetBYTE(FILE*); -extern BYTE GetBYTE(VirtualMachine *); -extern SHORT GetSHORT(VirtualMachine *); -extern void Push(VirtualMachine *, LONG); -extern LONG Pop(VirtualMachine *); #endif diff --git a/Build/source/texk/ttfdump/include/stack.h b/Build/source/texk/ttfdump/include/stack.h new file mode 100644 index 00000000000..04e9bdc98ce --- /dev/null +++ b/Build/source/texk/ttfdump/include/stack.h @@ -0,0 +1,9 @@ +#ifndef __TTF_STACK_H +#define __TTF_STACK_H + +extern BYTE GetBYTE(VirtualMachine *); +extern SHORT GetSHORT(VirtualMachine *); +extern void Push(VirtualMachine *, LONG); +extern LONG Pop(VirtualMachine *); + +#endif /* __TTF_STACK_H */ diff --git a/Build/source/texk/ttfdump/include/tables.h b/Build/source/texk/ttfdump/include/tables.h index ed05e4f5385..027ac51b1c4 100644 --- a/Build/source/texk/ttfdump/include/tables.h +++ b/Build/source/texk/ttfdump/include/tables.h @@ -483,8 +483,15 @@ typedef struct SHORT sTypoLineGap; USHORT usWinAscent; USHORT usWinDescent; + /* only version 1 tables */ ULONG ulCodePageRange1; ULONG ulCodePageRange2; + /* only version 2 tables */ + SHORT sxHeight; + SHORT sCapHeight; + USHORT usDefaultChar; + USHORT usBreakChar; + USHORT usMaxContext; } OS_2, *OS_2Ptr; diff --git a/Build/source/texk/ttfdump/libttf/os2.c b/Build/source/texk/ttfdump/libttf/os2.c index b140c356d6b..ab5c95235f6 100644 --- a/Build/source/texk/ttfdump/libttf/os2.c +++ b/Build/source/texk/ttfdump/libttf/os2.c @@ -46,7 +46,7 @@ static void ttfLoadOS2(FILE *fp, OS_2Ptr os2, ULONG offset) os2->sFamilyClass = ttfGetSHORT(fp); if (fread(os2->panose, sizeof(CHAR), 10, fp) != 10) - ttfError("Error readind PANOSE\n"); + ttfError("Error reading PANOSE\n"); os2->ulUnicodeRange1 = ttfGetULONG(fp); os2->ulUnicodeRange2 = ttfGetULONG(fp); @@ -54,7 +54,7 @@ static void ttfLoadOS2(FILE *fp, OS_2Ptr os2, ULONG offset) os2->ulUnicodeRange4 = ttfGetULONG(fp); if (fread(os2->achVendID, sizeof(CHAR), 4, fp) != 4) - ttfError("Error readind achVendID\n"); + ttfError("Error reading achVendID\n"); os2->achVendID[4] = 0x0; os2->fsSelection = ttfGetUSHORT(fp); @@ -65,8 +65,21 @@ static void ttfLoadOS2(FILE *fp, OS_2Ptr os2, ULONG offset) os2->sTypoLineGap = ttfGetSHORT(fp); os2->usWinAscent = ttfGetUSHORT(fp); os2->usWinDescent = ttfGetUSHORT(fp); + + if (os2->version < 0x0001) + return; + os2->ulCodePageRange1 = ttfGetULONG(fp); os2->ulCodePageRange2 = ttfGetULONG(fp); + + if (os2->version < 0x0002) + return; + + os2->sxHeight = ttfGetSHORT(fp); + os2->sCapHeight = ttfGetSHORT(fp); + os2->usDefaultChar = ttfGetUSHORT(fp); + os2->usBreakChar = ttfGetUSHORT(fp); + os2->usMaxContext = ttfGetUSHORT(fp); } void ttfPrintOS2(FILE *fp,OS_2Ptr os2) @@ -147,10 +160,23 @@ void ttfPrintOS2(FILE *fp,OS_2Ptr os2) fprintf(fp,"\t sTypoLineGap:\t\t %d\n",os2->sTypoLineGap); fprintf(fp,"\t usWinAscent:\t\t %d\n",os2->usWinAscent); fprintf(fp,"\t usWinDescent:\t\t %d\n",os2->usWinDescent); + + if (os2->version < 0x0001) + return; + fprintf(fp,"\t CodePage Range 1( Bits 0 - 31 ):\t 0x%08x\n", os2->ulCodePageRange1); fprintf(fp,"\t CodePage Range 2( Bits 32- 63 ):\t 0x%08x\n", os2->ulCodePageRange2); + + if (os2->version < 0x0002) + return; + + fprintf(fp,"\t sxHeight:\t\t %d\n",os2->sxHeight); + fprintf(fp,"\t sCapHeight:\t\t %d\n",os2->sCapHeight); + fprintf(fp,"\t usDefaultChar:\t\t 0x%04x\n",os2->usDefaultChar); + fprintf(fp,"\t usBreakChar:\t\t 0x%04x\n",os2->usBreakChar); + fprintf(fp,"\t usMaxContext:\t\t %d\n",os2->usMaxContext); } void ttfFreeOS2(OS_2Ptr os2) diff --git a/Build/source/texk/ttfdump/tests/texmfhome.otf b/Build/source/texk/ttfdump/tests/texmfhome.otf Binary files differnew file mode 100644 index 00000000000..d0af1152ff4 --- /dev/null +++ b/Build/source/texk/ttfdump/tests/texmfhome.otf diff --git a/Build/source/texk/ttfdump/tests/ttfdump.os_2 b/Build/source/texk/ttfdump/tests/ttfdump.os_2 new file mode 100644 index 00000000000..2abb1d6dfc0 --- /dev/null +++ b/Build/source/texk/ttfdump/tests/ttfdump.os_2 @@ -0,0 +1,69 @@ +True Type Font File Dumper: v 0.5.5 +Copyright 1996-1998 ollie@ms1.hinet.net +Dumping File:texmfhome.otf + + +Offset Table +------------ + sfnt version: 'OTTO' + number of tables: 10 + 0. 'CFF ' - checksum = 0xedbe4dbb, offset = 0x00000540, len = 499 + 1. 'FFTM' - checksum = 0x5648ee58, offset = 0x00000734, len = 28 + 2. 'OS/2' - checksum = 0x55da5fc2, offset = 0x00000110, len = 96 + 3. 'cmap' - checksum = 0x000d03f5, offset = 0x000003dc, len = 322 + 4. 'head' - checksum = 0xf1a97fe4, offset = 0x000000ac, len = 54 + 5. 'hhea' - checksum = 0x04b90210, offset = 0x000000e4, len = 36 + 6. 'hmtx' - checksum = 0x042b0020, offset = 0x00000750, len = 10 + 7. 'maxp' - checksum = 0x00035000, offset = 0x00000108, len = 6 + 8. 'name' - checksum = 0x4777499b, offset = 0x00000170, len = 618 + 9. 'post' - checksum = 0xff860033, offset = 0x00000520, len = 32 + +'OS/2' Table - OS/2 and Windows Metrics +--------------------------------------- + 'OS/2' version: 3 + xAvgCharWidth: 525 + usWeightClass: 500 'Medium' + usWidthClass: 5 'Medium' + fsType: 0 + ySubscriptXSize: 650 + ySubscriptYSize: 699 + ySubscriptXOffset: 0 + ySubscriptYOffset: 140 + ySuperscriptXSize: 650 + ySuperscriptYSize: 699 + ySuperscriptXOffset: 0 + ySuperscriptYOffset: 479 + yStrikeoutSize: 49 + yStrikeoutPosition 258 + sFamilyClass: 0 subclass = 0 + PANOSE: + Family Kind: 2 'Text and Display' + Serif Style: 0 'Any' + Weight: 6 'Medium' + Proportion: 9 'Monospaced' + Contrast: 0 'Any' + Stroke: 0 'Any' + Arm Style: 0 'Any' + Lettreform: 0 'Any' + Midline: 0 'Any' + X-height: 0 'Any' + Unicode Range 1( Bits 0 - 31 ): 0x00000001 + Unicode Range 2( Bits 32 - 63 ): 0x00000000 + Unicode Range 3( Bits 64 - 95 ): 0x00000000 + Unicode Range 4( Bits 96 - 128 ): 0x00000000 + achVendID: 'PfEd' + fsSelection: 0x0040 'Regular ' + usFirstCharIndex: 0xffff + usLastCharIndex: 0x0000 + sTypoAscender: 800 + sTypoDescender: -200 + sTypoLineGap: 90 + usWinAscent: 611 + usWinDescent: 0 + CodePage Range 1( Bits 0 - 31 ): 0x00000001 + CodePage Range 2( Bits 32- 63 ): 0x00000000 + sxHeight: 0 + sCapHeight: 0 + usDefaultChar: 0x0020 + usBreakChar: 0x0020 + usMaxContext: 1 diff --git a/Build/source/texk/ttfdump/tests/ttfdump.test b/Build/source/texk/ttfdump/tests/ttfdump.test index 3d10381e51e..4e5c5fb77cb 100755 --- a/Build/source/texk/ttfdump/tests/ttfdump.test +++ b/Build/source/texk/ttfdump/tests/ttfdump.test @@ -9,8 +9,9 @@ export TEXMFCNF TTFONTS failed= -rm -rf FonetikaDaniaIwonaeRegular.ttf ttftest.* +rm -rf FonetikaDaniaIwonaeRegular.ttf texmfhome.otf ttftest.* cp $srcdir/tests/FonetikaDaniaIwonaeRegular.ttf . +cp $srcdir/tests/texmfhome.otf . ./ttfdump -t glyf -g 1 -o ttftest.glyf FonetikaDaniaIwonaeRegular.ttf \ && diff -b $srcdir/tests/ttfdump.glyf ttftest.glyf \ @@ -27,11 +28,16 @@ cp $srcdir/tests/FonetikaDaniaIwonaeRegular.ttf . && echo "ttfdump.gsub tests OK" \ || failed="$failed ttfdump.gsub" -./ttfdump -t head FonetikaDaniaIwonaeRegular.ttf > ttftest.head \ +./ttfdump -t head FonetikaDaniaIwonaeRegular.ttf >ttftest.head \ && diff -b $srcdir/tests/ttfdump.head ttftest.head \ && echo "ttfdump.head tests OK" \ || failed="$failed ttfdump.head" +./ttfdump -t OS/2 texmfhome.otf >ttftest.os_2 \ + && diff -b $srcdir/tests/ttfdump.os_2 ttftest.os_2 \ + && echo "ttfdump.os_2 tests OK" \ + || failed="$failed ttfdump.os_2" + test -z "$failed" && exit 0 echo "failed tests:$failed" exit 1 |