diff options
Diffstat (limited to 'Build/source/texk/ttfdump/libttf/ttc.c')
-rw-r--r-- | Build/source/texk/ttfdump/libttf/ttc.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/Build/source/texk/ttfdump/libttf/ttc.c b/Build/source/texk/ttfdump/libttf/ttc.c index 853fcc103b5..72741083869 100644 --- a/Build/source/texk/ttfdump/libttf/ttc.c +++ b/Build/source/texk/ttfdump/libttf/ttc.c @@ -10,19 +10,11 @@ #include "ttfutil.h" #include "ttc.h" -#ifdef MEMCHECK -#include <dmalloc.h> -#endif - /* $Id: ttc.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */ -#ifndef lint -static char vcid[] = "$Id: ttc.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $"; -#endif /* lint */ - TTCHeaderPtr ttfLoadTTCHeader(char * filename) { - ULONG tag = 't' | 't' << 8 | 'c' << 16 | 'f' << 24; + ULONG tag = FT_MAKE_TAG ('t', 't', 'c', 'f'); TTCHeaderPtr ttc; FILE *fp; @@ -31,24 +23,14 @@ TTCHeaderPtr ttfLoadTTCHeader(char * filename) fprintf(stderr,"Can't open ttc file %s\n",filename); return NULL; } - ttc = (TTCHeaderPtr) calloc(1, sizeof(TTCHeader)); + ttc = XCALLOC1 (TTCHeader); /* True Type Collection's TTCHeader */ - if ((ttc->TTCTag = (ULONG) ttfGetLSB32(fp)) == tag) + if ((ttc->TTCTag = ttfGetULONG(fp)) == tag) { ttc->version = ttfGetFixed(fp); ttc->DirCount = (USHORT) ttfGetULONG(fp); - ttc->offset = (ULONG *) calloc(ttc->DirCount, - sizeof(ULONG)); - if (fread(ttc->offset, sizeof(ULONG), - ttc->DirCount,fp) != ttc->DirCount) - { - ttfError("Error when reading Table Direcotry Offset/n"); - } -#ifndef WORDS_BIGENDIAN - FourByteSwap((unsigned char *) ttc->offset, - ttc->DirCount*sizeof(ULONG)); -#endif + ttc->offset = ttfMakeULONG (ttc->DirCount, fp); ttfLoadTTCFont(ttc,fp); return ttc; } @@ -61,13 +43,8 @@ void ttfLoadTTCFont(TTCHeaderPtr ttc,FILE *fp) { int i; - ttc->font = (TTFontPtr) calloc(ttc->DirCount, sizeof(TTFont)); + ttc->font = XCALLOC (ttc->DirCount, TTFont); - if (ttc->font == NULL) - { - ttfError("Out of Memory"); - return; - } /* currently, we are loading all fonts in a TTC file. * I still can't find a good way to share the data. */ for (i=0;i<ttc->DirCount;i++) |