Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
These patches for
ftp://ftp.freetype.org/pub/freetype/ttfdump-0.5.5.tar.gz
are from
Nelson H. F. Beebe
Center for Scientific Computing
University of Utah
Department of Mathematics, 322 INSCC
155 S 1400 E RM 233
Salt Lake City, UT 84112-0090
USA
Email: beebe@math.utah.edu, beebe@acm.org, beebe@ieee.org (Internet)
WWW URL: http://www.math.utah.edu/~beebe
They are to be applied like this:
cd to ttfdump-0.5.5 directory
patch -p0 < this-file
They fix problems encountered in installing ttfdump on these
architectures:
DEC Alpha OSF/1 3.2
DECstation 5000 ULTRIX 4.3
HP 9000/735 HP-UX 10.01
Intel Pentium Linux 2.0.30
IBM PowerPC AIX 4.1
IBM PowerPC AIX 4.2
NeXT Turbostation Mach 3.3
SGI Indigo/2 IRIX 5.3
SGI O2 R10000-SC IRIX 6.3
SGI Origin 200 IRIX 6.4
Sun SPARC Solaris 2.5
Sun SPARC SunOS 4.1.3
With the patches in place, you can use the GNU standard incantation:
./configure && make all check install
to build, test, and install these programs, provided that you can
first obtain a suitable test file; if not, just omit the "check"
target, and cross your fingers!
For a test file, I used times.ttf, a copy of the Sun Solaris 2.6
/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman.ttf file. The
output of
./ttfdump times.ttf times.txt
is compared with correct output like this:
diff times.txt times.ok
However, I cannot give you this times.ttf file because it is a
licensed font.
I could not find a TTF font on my systems that I could consider freely
distributable.
One possibility is the TTF form of the Bakoma font representation of
TeX's cmr10 font, available at
ftp://ctan.tug.org/tex-archive/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf
Even so, there are some license restrictions on the Bakoma fonts that
may be relevant. Nevertheless, for your convenience, you can fetch
the cmr10.ok file from the same place you got this patch file, and the
cmr10.ttf file from the above source, then do
cp cmr10.ttf times.ttf
cp cmr10.ok times.ok
so that you can then do "make check" at top level. The cmr10.ok
file has been modified in line 3 to change cmr10 to times, so that
the diff step does not complain. Although testing with cmr10.ttf
worked on some of the above systems, on the IBM RS/6000 system,
it failed with an "Out of Memory" error. Tracing this back in the
debugger, I found that it arose from the call trace
ttfError(msg = "Out Of Memory\n"), line 56 in "ttfutil.c"
ttfLoadNameRecordData(0xf01324c0, 0x20002e38, 0xabe), line 133 in "name.c"
ttfLoadNAME(0xf01324c0, 0x20002da8, 0x9f8), line 70 in "name.c"
ttfInitNAME(0x20001858), line 36 in "name.c"
ttfLoadRequiredTables(0x20001858), line 74 in "font.c"
ttfLoadFont(0x20001858, 0x0), line 51 in "font.c"
ttfInitFont(0x20001744), line 37 in "font.c"
main(argc = 3, argv = 0x2ff228cc), line 171 in "ttfdump.c"
and it arises because in ttfLoadNameRecordData(), rec->length is 0,
and calloc() is called with a request for 0 bytes, which on this
system, it rejects. I have not investigated whether this happens on
other systems. It may be a coding error in ttfdump, or it may be a
problem with cmr10.ttf; the test with times.ttf (== TimesNewRoman.ttf)
works fine.
On at least one of these architectures (SunOS 4.1.3), is
needed to define SEEK_SET; that symbol is referred to by 23 source
files, none of which include . I therefore chose to put the
inclusion of that file in the ttf.h file, which then solves the
problem of missing SEEK_SET.
I have also used the Standard C EXIT_SUCCESS and EXIT_FAILURE symbols
for exit() calls; although they map to 0 and 1 on UNIX and DOS, on VAX
(Open)VMS and possibly other systems, their values are quite
different.
In src/ttfdump.c, I supplied a private version of the non-standard
function strdup(), renamed Strdup() to avoid conflicts with system
header file prototypes on those systems which do supply it.
On some systems, ranlib is needed to create an index for the libttf.a
library. Some systems lack ranlib, so "ar ts" is used as a fallback,
and if that too fails, then "true" is run; thus, that step in the
Makefile will always succeed.
In ttfdump.c, main() has been given type int, rather than the illegal
void; this matters on some systems.
The Makefiles (created from the patched Makefile.in files) now support
both check and install targets; they were missing from the original
version.
The build on IBM RS/6000 AIX 4.1 and 4.2 turned up another problem: a
but in the installed version of gcc that resulted in the blkcnt_t type
being unknown. I chose the quick way to patch this: a conditional
that supplies the missing typedef. A bug report to Cygnus and a new
build of gcc on getting a fix would take much too long.
On those systems, I also did a successful build with the native c89
compiler, and this turned up three problems. (1) You must have
-Dinline= among the CFLAGS options, because one file, libttf/ttf.h,
uses the nonstandard inline keyword. (2) libttf/interp.c uses the
nonstandard type "long long"; c89 truncates this to "long" with a
warning. (3) With CC=c89, the "make check" passes. With "CC=gcc",
there is one line of difference:
diff times.txt times.ok
1321c1321
< 52 65 67 75 6c 61 72 … > Regular
---
> 52 65 67 75 6c 61 72 > Regular
I have not further investigated this problem: I simply installed the
version compiled with c89, except that I compiled libttf/interp.c
manually with gcc to handle the "long long" type.
------------------------------------------------------------------------
Script started on Fri May 29 08:02:26 1998
You have new mail.
101 sunray::ttfdump-0.5.5> rcsdiff -c include/ttf.h
===================================================================
RCS file: include/RCS/ttf.h,v
retrieving revision 1.1
diff -c -r1.1 include/ttf.h
*** include/ttf.h 1998/05/29 00:52:16 1.1
--- include/ttf.h 1998/05/29 00:52:27
***************
*** 6,11 ****
--- 6,12 ----
#define __TTF_H
#include
+ #include
#include "config.h"
/* $Id: ttf.h,v 1.1 1998/05/29 00:52:16 beebe Exp beebe $ */
102 sunray::ttfdump-0.5.5> rcsdiff -c libttf/Makefile.in libttf/tabledir.c libttf/font.c src/Makefile.in src/ttfdump.c Makefile.in
===================================================================
RCS file: libttf/RCS/Makefile.in,v
retrieving revision 1.1
diff -c -r1.1 libttf/Makefile.in
*** libttf/Makefile.in 1998/05/28 22:51:52 1.1
--- libttf/Makefile.in 1998/05/29 00:32:06
***************
*** 85,90 ****
--- 85,91 ----
libttf.a: ${OBJS}
$(AR) r $@ $?
+ ranlib $@ || $(AR) ts $@ || true
clean:
rm -f *.a *.o *~
***************
*** 94,96 ****
--- 95,102 ----
rm -f tags TAGS Makefile
.PHONY: distclean
+ install:
+ @echo Nothing to install from this directory
+
+ check:
+ @echo Nothing to check in this directory
===================================================================
RCS file: src/RCS/Makefile.in,v
retrieving revision 1.1
diff -c -r1.1 src/Makefile.in
*** src/Makefile.in 1998/05/28 21:44:05 1.1
--- src/Makefile.in 1998/05/29 00:12:10
***************
*** 84,90 ****
${CC} ${CFLAGS} -o $@ ${OBJS} ../libttf/libttf.a ${LIBS}
test:ttfdump
! ./ttfdump times.ttf times.txt
depend:
co RCS/*
--- 84,92 ----
${CC} ${CFLAGS} -o $@ ${OBJS} ../libttf/libttf.a ${LIBS}
test:ttfdump
! -./ttfdump times.ttf times.txt
! @echo There should be no differences found:
! diff times.txt times.ok
depend:
co RCS/*
***************
*** 96,99 ****
distclean: clean
rm -f tags TAGS Makefile
! .PHONY: distclean
\ No newline at end of file
--- 98,114 ----
distclean: clean
rm -f tags TAGS Makefile
!
! .PHONY: distclean
!
! check: test
!
! install: ttfdump
! $(INSTALL_PROGRAM) ttfdump $(bindir)/ttfdump
! strip $(bindir)/ttfdump || true
! chmod 775 $(bindir)/ttfdump
! $(INSTALL_DATA) ../docs/ttfdump.1 $(mandir)/man1/ttfdump.1
! chmod 664 $(mandir)/man1/ttfdump.1
! @-rm -f $(mandir)/cat1/ttfdump.1
! @echo Installed files...
! ls -l $(bindir)/ttfdump $(mandir)/man1/ttfdump.1
===================================================================
RCS file: src/RCS/ttfdump.c,v
retrieving revision 1.1
diff -c -r1.1 src/ttfdump.c
*** src/ttfdump.c 1998/05/29 00:32:48 1.1
--- src/ttfdump.c 1998/05/29 00:37:03
***************
*** 60,66 ****
static void usage(void);
static void add_suffix(char *name, char *suffix);
! void main(int argc,char * argv[])
{
FILE *tt_file,*dp_file;
TTCHeaderPtr ttc;
--- 60,87 ----
static void usage(void);
static void add_suffix(char *name, char *suffix);
! #if !defined(EXIT_FAILURE)
! #define EXIT_FAILURE 1
! #endif
!
! #if !defined(EXIT_SUCCESS)
! #define EXIT_SUCCESS 0
! #endif
!
! char *Strdup(const char *s)
! {
! char *p;
! p = malloc(((s == (const char*)NULL) ? 0 : strlen(s)) + 1);
! if (p == (char*)NULL)
! {
! (void)fprintf(stderr,"Out of memory in Strdup()\n");
! exit(EXIT_FAILURE);
! }
! return (strcpy(p,s));
! }
!
!
! int main(int argc,char * argv[])
{
FILE *tt_file,*dp_file;
TTCHeaderPtr ttc;
***************
*** 77,83 ****
if (argc < 2)
{
usage();
! exit(1);
}
while ((c = getopt(argc, argv, "t:g:c:i:o:h")) != EOF)
--- 98,104 ----
if (argc < 2)
{
usage();
! exit(EXIT_FAILURE);
}
while ((c = getopt(argc, argv, "t:g:c:i:o:h")) != EOF)
***************
*** 85,91 ****
switch (c)
{
case 't':
! tablename = strdup(optarg);
break;
case 'g':
if (strcmp(optarg,"x") == 0)
--- 106,112 ----
switch (c)
{
case 't':
! tablename = Strdup(optarg);
break;
case 'g':
if (strcmp(optarg,"x") == 0)
***************
*** 105,111 ****
case 'h':
case '?':
usage();
! exit(1);
break;
}
}
--- 126,132 ----
case 'h':
case '?':
usage();
! exit(EXIT_FAILURE);
break;
}
}
***************
*** 134,140 ****
else if ((dp_file = fopen (dumpname,"w")) == NULL)
{
fprintf(stderr,"Can't open dumping file\n");
! exit(1);
}
if (strstr(ttfname,"ttc") != NULL)
--- 155,161 ----
else if ((dp_file = fopen (dumpname,"w")) == NULL)
{
fprintf(stderr,"Can't open dumping file\n");
! exit(EXIT_FAILURE);
}
if (strstr(ttfname,"ttc") != NULL)
***************
*** 150,156 ****
font = ttfInitFont(ttfname);
if (font == NULL)
! exit(1);
print_prologue(dp_file);
if (strstr(ttfname,"ttc") != NULL)
--- 171,177 ----
font = ttfInitFont(ttfname);
if (font == NULL)
! exit(EXIT_FAILURE);
print_prologue(dp_file);
if (strstr(ttfname,"ttc") != NULL)
***************
*** 194,199 ****
--- 215,221 ----
{
ttfFreeFont(font);
}
+ exit(EXIT_SUCCESS);
}
static void print_table(FILE *out,char *tablename)
{
***************
*** 437,443 ****
static void usage(void)
{
fprintf(stderr,"Usage: ttfdump ttfname dumpname [options]\n");
! exit(1);
}
static void
add_suffix(char *name, char *suffix)
--- 459,465 ----
static void usage(void)
{
fprintf(stderr,"Usage: ttfdump ttfname dumpname [options]\n");
! exit(EXIT_FAILURE);
}
static void
add_suffix(char *name, char *suffix)
===================================================================
RCS file: RCS/Makefile.in,v
retrieving revision 1.1
diff -c -r1.1 Makefile.in
*** Makefile.in 1998/05/29 00:07:03 1.1
--- Makefile.in 1998/05/29 00:07:10
***************
*** 77,83 ****
all:
.PHONY: all install uninstall
! all install uninstall: config.h Makefile all-local
@for subdir in $(SUBDIRS); do \
echo "making $@ in $$subdir"; \
( cd $$subdir && $(MAKE) $(FLAGS_TO_PASS) $@ ) || exit 1; \
--- 77,83 ----
all:
.PHONY: all install uninstall
! all check install uninstall: config.h Makefile all-local
@for subdir in $(SUBDIRS); do \
echo "making $@ in $$subdir"; \
( cd $$subdir && $(MAKE) $(FLAGS_TO_PASS) $@ ) || exit 1; \
===================================================================
RCS file: libttf/RCS/tabledir.c,v
retrieving revision 1.1
diff -c -r1.1 libttf/tabledir.c
*** libttf/tabledir.c 1998/05/29 00:49:57 1.1
--- libttf/tabledir.c 1998/05/29 15:43:02
***************
*** 68,74 ****
bcopy(&(p->tag),tagname,4);
tagname[4] = '\0';
#ifdef WORDS_BIGENDIAN
! FourByteSwap(tagname,4);
#endif
fprintf(fp,"'%s' - chechsum = 0x%08x, offset = 0x%08x, len = %9u \n",
--- 68,74 ----
bcopy(&(p->tag),tagname,4);
tagname[4] = '\0';
#ifdef WORDS_BIGENDIAN
! FourByteSwap((unsigned char *)tagname,4);
#endif
fprintf(fp,"'%s' - chechsum = 0x%08x, offset = 0x%08x, len = %9u \n",
===================================================================
RCS file: include/RCS/ttc.h,v
retrieving revision 1.1
diff -c -r1.1 include/ttc.h
*** include/ttc.h 1998/05/29 15:46:31 1.1
--- include/ttc.h 1998/05/29 15:46:44
***************
*** 15,18 ****
void ttfLoadTTCFont(TTCHeaderPtr ttc,FILE *fp);
void ttfFreeTTCFont(TTCHeaderPtr ttc);
! #endif __TTF_TTC_H
--- 15,18 ----
void ttfLoadTTCFont(TTCHeaderPtr ttc,FILE *fp);
void ttfFreeTTCFont(TTCHeaderPtr ttc);
! #endif /* __TTF_TTC_H */
===================================================================
RCS file: libttf/RCS/ttfread.c,v
retrieving revision 1.1
diff -c -r1.1 libttf/ttfread.c
*** libttf/ttfread.c 1998/05/29 16:10:44 1.1
--- libttf/ttfread.c 1998/05/29 16:11:03
***************
*** 5,10 ****
--- 5,15 ----
*/
#include
+ #if defined(__GNUC__) && defined(_IBMR2)
+ /* Workaround for missing typedef in gcc (egcs-2.90.27 980315 (egcs-1.0.2 release)) */
+ typedef long blkcnt_t; /* number of blocks in the file */
+ #endif
+
#include "ttf.h"
#include "ttfutil.h"