v20i031: hp2pk - HP font conversion tool, Part01/04
Steve McConnel
steve at txsil.sil.org
Mon Jun 3 12:11:24 AEST 1991
Submitted-by: Steve McConnel <steve at txsil.sil.org>
Posting-number: Volume 20, Issue 31
Archive-name: hp2pk/part01
HP2PK converts Hewlett-Packard LaserJet Soft Fonts into PK font bitmap files
and TFM font metric files. TFM files are used by TeX, and PK files are used
by most DVI drivers. (A DVI driver is a program that converts TeX DeVice
Independent output into device specific form to send to a printing device
or a graphical display screen.)
HP2PK is of interest to the TeX community as an easy way to gain access to
a wider variety of fonts. I believe that groff (the GNU troff clone) also
produces DVI files, so groff users might also benefit from this program.
Since TeX runs on almost every type of computer system in common use today,
HP2PK has been written to be as portable as possible. The systems that it
has been ported to (and tested on) include SCO UNIX V/386, SunOS, the NeXT,
MSDOS (both Microsoft C and Turbo C), and the Macintosh (Lightspeed Think C).
A VMS port would be welcome, but I haven't yet tried to do one.
--
Stephen McConnel PHONE: 214-709-2418
Summer Institute of Linguistics UUCP: ...!{convex|utafll}!txsil!steve
7500 W. Camp Wisdom Road Internet: steve at txsil.sil.org
Dallas, TX 75236 (or) steve at utafll.uta.edu
-----------------------------------cut here-----------------------------------
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 4)."
# Contents: HP2PK.PRJ INSTALL MANIFEST Makefile Makefile.MSC
# Makefile.SCO README bitmap.h fixnum.h getopt.c hp2pk.1 memcmp.c
# memcpy.c memset.c patchlevel.h pk.h sfp.h strtol.c tfm.h
# Wrapped by steve at txsil on Thu May 30 10:36:55 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'HP2PK.PRJ' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'HP2PK.PRJ'\"
else
echo shar: Extracting \"'HP2PK.PRJ'\" \(212 characters\)
sed "s/^X//" >'HP2PK.PRJ' <<'END_OF_FILE'
Xhp2pk.c (sfp.h) (tfm.h) (pk.h) (fixnum.h)
Xreadsfp.c (sfp.h)
Xbigendio.c
Xwritepk.c (pk.h) (fixnum.h)
Xwritepl.c (tfm.h) (fixnum.h)
Xwritetfm.c (tfm.h) (fixnum.h)
Xfixnum.c (fixnum.h)
Xmyalloc.c
Xgetopt.c
Xstrtol.c
END_OF_FILE
if test 212 -ne `wc -c <'HP2PK.PRJ'`; then
echo shar: \"'HP2PK.PRJ'\" unpacked with wrong size!
fi
# end of 'HP2PK.PRJ'
fi
if test -f 'INSTALL' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'INSTALL'\"
else
echo shar: Extracting \"'INSTALL'\" \(2111 characters\)
sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
XFor UNIX:
X---------
XEdit the Makefile to make your choices for CC, CFLAGS, DEST, and DOCDEST.
XIf your system's C library is deficient, you may need to add one or more of
Xgetopt.o, memcmp.o, memcpy.o, memset.o, and strtol.o to OBJS. After fixing
Xthe Makefile to your liking, type "make" and sit back and relax. When you're
Xsatisfied that HP2PK is working okay, you can "make install" (possibly su'ing
Xto root or bin or whatever first, depending on your setup). This last step
Xmerely copies hp2pk to the DEST directory and strips it, then copies hp2pk.1
Xto the DOCDEST directory and tries "man hp2pk" to see what happens.
X
XFor MSDOS Microsoft C:
X----------------------
XHP2PK should compile right out of the box after unpacking the sources, at
Xleast for Microsoft C 6.00A. Rename MAKEFILE to MAKEFILE.UNX, rename
XMAKEFILE.MSC to MAKEFILE, and then just type "nmake" and sit back and relax.
XIf you want to "nmake install", edit MAKEFILE to change the values of DEST
Xand DOCDEST to appropriate values for your system. This step merely copies
XHP2PK.EXE to an appropriate place, and copies HP2PK.LPT to an appropriate
Xplace, renaming it HP2PK.DOC.
X
XFor MSDOS Turbo C:
X------------------
XHP2PK.PRJ is a Turbo C project file. Do whatever it takes to use this to
Xcompile and proceed with testing and installation. (I've never used Turbo C,
Xso I can't be more specific than this.)
X
XFor Macintosh Lightspeed Think C:
X---------------------------------
XCreate a project file for HP2PK containing the following files:
X bigendio.c
X fixnum.c
X hp2pk.c
X readsfp.c
X writepk.c
X writepl.c
X writetfm.c
X ----------
X getopt.c
X myalloc.c
X ----------
X ANSI
X unix
X ----------
X MacTraps
XThe last three items are libraries supplied with Think C. The dashed lines
Xindicate segment divisions. After getting the project file set up, just
Xfollow your intuition. :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-)
END_OF_FILE
if test 2111 -ne `wc -c <'INSTALL'`; then
echo shar: \"'INSTALL'\" unpacked with wrong size!
fi
# end of 'INSTALL'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(964 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X File Name Archive # Description
X-----------------------------------------------------------
X HP2PK.PRJ 1
X INSTALL 1
X MANIFEST 1
X Makefile 1
X Makefile.MSC 1
X Makefile.SCO 1
X README 1
X bigendio.c 2
X bitmap.h 1
X fixnum.c 2
X fixnum.h 1
X getopt.c 1
X hp2pk.1 1
X hp2pk.c 3
X hp2pk.lpt 2
X memcmp.c 1
X memcpy.c 1
X memset.c 1
X myalloc.c 2
X patchlevel.h 1
X pk.h 1
X readsfp.c 4
X sfp.h 1
X strtol.c 1
X tfm.h 1
X writepk.c 3
X writepl.c 2
X writetfm.c 2
END_OF_FILE
if test 964 -ne `wc -c <'MANIFEST'`; then
echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(1858 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# UNIX Makefile for hp2pk program, Steve McConnel, 12-Apr-91
X# includes changes for NeXT 1.0 w/ gcc Tom Ridgeway 10/23/90
X
X# GNU C compiler
X#CC = gcc -g -Wall
X# pre-ANSI compilers don't have "signed" keyword
XCC = cc -Dsigned=
X# on SCO UNIX V/386, the AT&T compiler
X#CC = rcc -Dsigned=
X# on NeXT it *is* gcc, but goes by name cc (because there isn't a cc)
X#CC = cc -g -Wall
X
X# System V variants
X#CFLAGS = -O -DUNIX
X# BSD variants
XCFLAGS = -O -DUNIX -DBSD
X# NeXT *is* something like BSD4.3, let us even say *strict* bsd
X#CFLAGS = -bsd -O -DUNIX -DBSD
X
X# directory for locally installed programs
XDEST=/usr/local/bin
X# directory for locally installed program man pages
XDOCDEST=/usr/local/man/man.1
X#DOCDEST=/usr/man/local
X
XOBJS = hp2pk.o readsfp.o bigendio.o writepk.o writepl.o writetfm.o \
X fixnum.o myalloc.o
X# getopt.o memcmp.o memcpy.o memset.o strtol.o
X
Xhp2pk: $(OBJS)
X $(CC) $(CFLAGS) -o hp2pk $(OBJS)
X
Xhp2pk.o: hp2pk.c sfp.h tfm.h pk.h fixnum.h patchlevel.h
Xreadsfp.o: readsfp.c sfp.h
Xwritepk.o: writepk.c pk.h fixnum.h
Xwritepl.o: writepl.c tfm.h fixnum.h
Xwritetfm.o: writetfm.c tfm.h fixnum.h
Xbigendio.o: bigendio.c
Xfixnum.o: fixnum.c fixnum.h
X
X# the following sources are included for portability
X# the first is PD, the rest were written by Steve McConnel
Xgetopt.o: getopt.c
Xmemcmp.o: memcmp.c
Xmemcpy.o: memcpy.c
Xmemset.o: memset.c
Xstrtol.o: strtol.c
X
X# various common pseudo-targets
X
Xall: hp2pk
X
Xinstall: hp2pk
X cp hp2pk $(DEST) ; strip $(DEST)/hp2pk
X cp hp2pk.1 $(DOCDEST) ; man hp2pk
X
Xclean:
X rm -f *.o core hp2pk
X
XLINT_FLAGS=-DUNIX -Dsigned=
X#LINT_FLAGS=-DUNIX -Dsigned= -DBSD
X
XSOURCES = hp2pk.c readsfp.c bigendio.c writepk.c writepl.c writetfm.c \
X fixnum.c myalloc.c
X# getopt.c memcmp.c memcpy.c memset.c strtol.c
XHEADERS = bitmap.h fixnum.h pk.h sfp.h tfm.h patchlevel.h
X
Xlint: $(SOURCES)
X lint $(LINT_FLAGS) $(SOURCES)
END_OF_FILE
if test 1858 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'Makefile.MSC' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile.MSC'\"
else
echo shar: Extracting \"'Makefile.MSC'\" \(1267 characters\)
sed "s/^X//" >'Makefile.MSC' <<'END_OF_FILE'
X# MSDOS Microsoft C Makefile for hp2pk program, Steve McConnel, 30-Jan-91
X# This requires a genuine MAKE such as Microsoft C 6.0's NMAKE program.
X
XCFLAGS= -DMSC -AL -O
X
X# directory where freeware programs are put
XDEST=c:\pd
X# directory where documentation for freeware programs is put
XDOCDEST=c:\pddoc
X
X# the next two lines (or the equivalent) may be needed
X#.c.obj:
X# cl -c $(CFLAGS) $*.c
X
XOBJS=hp2pk.obj readsfp.obj bigendio.obj writepk.obj writepl.obj \
X writetfm.obj fixnum.obj myalloc.obj getopt.obj
XLINK_OBJS=hp2pk+readsfp+bigendio+writepk+writepl+writetfm+fixnum+myalloc+getopt
X
Xhp2pk.exe: $(OBJS)
X link $(LINK_OBJS),hp2pk/stack:4000;
X
Xhp2pk.obj: hp2pk.c sfp.h tfm.h pk.h fixnum.h
Xreadsfp.obj: readsfp.c sfp.h
Xwritepk.obj: writepk.c pk.h fixnum.h
Xwritepl.obj: writepl.c tfm.h fixnum.h
Xwritetfm.obj: writetfm.c tfm.h fixnum.h
Xbigendio.obj: bigendio.c
Xfixnum.obj: fixnum.c fixnum.h
Xmyalloc.obj: myalloc.c
X
X# the following sources are included for portability
X# the first is Public Domain, the rest were written by Steve McConnel
Xgetopt.obj: getopt.c
Xmemcmp.obj: memcmp.c
Xmemcpy.obj: memcpy.c
Xmemset.obj: memset.c
Xstrtol.obj: strtol.c
X
Xinstall: hp2pk.exe
X copy hp2pk.exe $(DEST)
X copy hp2pk.lpt $(DOCDEST)\hp2pk.doc
X
Xclean:
X del *.obj
END_OF_FILE
if test 1267 -ne `wc -c <'Makefile.MSC'`; then
echo shar: \"'Makefile.MSC'\" unpacked with wrong size!
fi
# end of 'Makefile.MSC'
fi
if test -f 'Makefile.SCO' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile.SCO'\"
else
echo shar: Extracting \"'Makefile.SCO'\" \(2811 characters\)
sed "s/^X//" >'Makefile.SCO' <<'END_OF_FILE'
X# SCO UNIX V/386 Makefile for hp2pk program, Steve McConnel, 17-Jan-91
X
X.SUFFIXES: .og .or .obj
X#
X# use the GNU C compiler by default
X#
XCC = gcc -g -Wall
XCFLAGS = -O -DUNIX
X.c.og:
X $(CC) $(CFLAGS) -o $@ -c $<
XOBJS = hp2pk.og readsfp.og bigendio.og writepk.og writepl.og writetfm.og \
X fixnum.og
X#
X# use the AT&T compiler on request
X#
XATT_CC = rcc
XATT_CFLAGS = -O -DUNIX -Dsigned=
X.c.or:
X $(ATT_CC) $(ATT_CFLAGS) -c $<
X mv $*.o $@
XATT_OBJS = hp2pk.or readsfp.or bigendio.or writepk.or writepl.or writetfm.or \
X fixnum.or
X#
X# compile for MSDOS on request (always large memory model)
X#
XMSDOS_CC = cc -dos -M0le
XMSDOS_CFLAGS= -Ot -DMSC
X.SUFFIXES: .obj
X.c.obj:
X $(MSDOS_CC) $(MSDOS_CFLAGS) -Fo$@ -c $<
X
XMSDOS_OBJS = hp2pk.obj readsfp.obj bigendio.obj writepk.obj writepl.obj \
X writetfm.obj fixnum.obj
X#
X# special libraries
X#
X# libopac for myalloc()
X# libcport for maybe getopt(), memcmp(), memcpy(), memset(), and strtol()
X#
XLIBS=../../opaclib/libopac.a -lcport
XDOS_LIBS=../../opaclib/Ldlibopac.a -lcport
X
XSOURCES = hp2pk.c readsfp.c bigendio.c writepk.c writepl.c writetfm.c \
X fixnum.c ../../opaclib/myalloc.c
XHEADERS = bitmap.h fixnum.h pk.h sfp.h tfm.h patchlevel.h
X
Xhp2pk: $(OBJS)
X $(CC) $(CFLAGS) -o hp2pk $(OBJS) $(LIBS)
X
Xhp2pk-r: $(ATT_OBJS)
X $(ATT_CC) $(ATT_CFLAGS) -o hp2pk-r $(ATT_OBJS) $(LIBS) -lm
X
Xhp2pk.exe: $(MSDOS_OBJS)
X $(MSDOS_CC) $(MSDOS_CFLAGS) -F 4000 -o hp2pk.exe $(MSDOS_OBJS) $(DOS_LIBS)
X
Xhp2pk.og hp2pk.or hp2pk.obj: hp2pk.c sfp.h tfm.h pk.h fixnum.h patchlevel.h
X
Xreadsfp.og readsfp.or readsfp.obj: readsfp.c sfp.h
Xwritepk.og writepk.or writepk.obj: writepk.c pk.h fixnum.h
Xwritepl.og writepl.or writepl.obj: writepl.c tfm.h fixnum.h patchlevel.h
Xwritetfm.og writetfm.or writetfm.obj: writetfm.c tfm.h fixnum.h
Xbigendio.og bigendio.or bigendio.obj: bigendio.c
Xfixnum.og fixnum.or fixnum.obj: fixnum.c fixnum.h
X
X# the following sources are included for portability
X# the first is PD, the rest were written by Steve McConnel
Xgetopt.og getopt.or getopt.obj: getopt.c
Xmemcmp.og memcmp.or memcmp.obj: memcmp.c
Xmemcpy.og memcpy.or memcpy.obj: memcpy.c
Xmemset.og memset.or memset.obj: memset.c
Xstrtol.og strtol.or strtol.obj: strtol.c
X
Xall: hp2pk hp2pk.exe hp2pk-r
X
Xlint: $(SOURCES)
X lint -DUNIX -Dsigned= $(SOURCES)
X
Xclean:
X rm -f *.or *.og *.obj core hp2pk hp2pk.exe hp2pk-r
X
Xshar: $(SOURCES) $(HEADERS) hp2pk.1 Makefile.SCO Makefile.UNIX Makefile.MSDOS \
X HP2PK.PRJ README
X shar -a -pX README Makefile.MSDOS Makefile.SCO Makefile.UNIX \
X bigendio.c bitmap.h fixnum.c fixnum.h hp2pk.c >hp2pk.sh01
X shar -a -pX getopt.c hp2pk.1 memcmp.c memcpy.c memset.c myalloc.c \
X pk.h readsfp.c sfp.h >hp2pk.sh02
X shar -a -pX strtol.c tfm.h writepk.c writepl.c writetfm.c \
X HP2PK.PRJ patchlevel.h >hp2pk.sh03
X wc -c hp2pk.sh01 hp2pk.sh02 hp2pk.sh03
END_OF_FILE
if test 2811 -ne `wc -c <'Makefile.SCO'`; then
echo shar: \"'Makefile.SCO'\" unpacked with wrong size!
fi
# end of 'Makefile.SCO'
fi
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(4507 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XHP2PK converts Hewlett-Packard LaserJet Soft Fonts into PK font bitmap files
Xand TFM font metric files. TFM files are used by TeX and PK files are used
Xby most DVI drivers. (A DVI driver is a program that converts TeX DeVice
XIndependent output into device specific form to send to a printing device
Xor a graphical display screen.)
X
XHP2PK is of interest to the TeX community as an easy way to gain access to
Xa wider variety of fonts. I believe that groff (the GNU troff clone) also
Xproduces DVI files, so groff users would also benefit from this program.
X
XSince TeX runs on almost every type of computer system in common use today,
XHP2PK has been written to be as portable as possible. The systems that it
Xhas been ported to (and tested on) include SCO UNIX V/386, SunOS, the NeXT,
XMSDOS (both Microsoft C and Turbo C), and the Macintosh (Lightspeed Think C).
XA VMS port would be welcome, but I haven't yet tried to do one.
X
X
XSYSTEM DEPENDENCIES
X-------------------
XA C compiler should be only thing needed to get HP2PK up and running. :-)
XSome form of MAKE (or the equivalent) would also be useful, of course.
X
X
XLIMITATIONS AND KNOWN BUGS
X--------------------------
X
XHP2PK has the following limitations:
X 1. Only bitmap fonts (either Class 1 bitmap or Class 2 compressed bitmap)
X are handled. The program cannot process Intellifont Scalable Fonts.
X 2. Character bitmaps larger than 32767 bytes are not handled.
X 3. The font's pixel density must be a integral number of dots per inch.
X
X
XAUTHOR
X------
X
XHP2PK was written by Stephen McConnel as part of a project for the Summer
XInstitute of Linguistics.
X
XStephen McConnel PHONE: 214-709-2418
XSummer Institute of Linguistics UUCP: ...!{convex|utafll}!txsil!steve
X7500 W. Camp Wisdom Road Internet: steve at txsil.sil.org
XDallas, TX 75236 (or) steve at utafll.uta.edu
X
XChris Paris, Kevin Streater, Klaus U Schallhorn, and Thomas Ridgeway served
Xas beta testers for HP2PK. Their feedback contributed greatly to its utility
Xand quality. Any remaining bugs, of course, are not their fault!
X
X
XCURRENT PATCHLEVEL
X------------------
XHP2PK is currently (April 12, 1991) at Version 1, Revision 0, Patchlevel 0.
X
X
XCOPYRIGHT NOTICE
X----------------
X
XHP2PK is copyright 1991 by the Summer Institute of Linguistics. The program,
Xeither in executable form or as source code, and its documentation may be
Xfreely distributed and used, subject to the following restrictions:
X
X 1. Neither HP2PK nor derivative programs incorporating any portion of its
X source code may be sold commercially without prior written consent of
X the Summer Institute of Linguistics. A nominal fee may be charged for
X noncommercial distribution, provided that recipients are informed that
X they may freely redistribute the program.
X
X 2. The copyright notices must not be removed from any of the files.
X
X 3. Modified versions must be clearly marked as such.
X
XUsers are encouraged to return bug fixes and enhancements to the author, with
Xthe understanding than any material received may appear in future releases
Xunder the copyright terms given above.
X
X
XNO WARRANTY
X-----------
X
XBecause HP2PK is distributed free of charge, the Summer Institute of
XLinguistics provides absolutely no warranty, to the extent permitted by
Xapplicable law. Except when otherwise stated in writing, the Summer
XInstitute of Linguistics provides HP2PK ``as is'' without warranty of any
Xkind, either expressed or implied, including, but not limited to, the
Ximplied warranties of merchantability and fitness for a particular purpose.
XThe user assumes the entire risk as to the quality and performance of HP2PK.
XShould HP2PK prove defective, the user assumes the cost of all necessary
Xservicing, repair or correction. In no event, unless required by applicable
Xlaw, will the Summer Institute of Linguistics, or any other party who may
Xmodify and/or redistribute HP2PK as permitted in accordance with the
Xcopyright restrictions, be liable for damages, including any lost profits,
Xlost monies, or other special, incidental or consequential damages arising
Xout of the use or inability to use (including but not limited to loss of
Xdata or data being rendered inaccurate or losses sustained by third parties
Xor a failure of HP2PK to operate with programs not distributed by the Summer
XInstitute of Linguistics) HP2PK, even if the user has been advised of the
Xpossibility of such damages, or for any claim by any other party.
END_OF_FILE
if test 4507 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'bitmap.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bitmap.h'\"
else
echo shar: Extracting \"'bitmap.h'\" \(879 characters\)
sed "s/^X//" >'bitmap.h' <<'END_OF_FILE'
X/* BITMAP.H - structure to hold a character bitmap
X ***************************************************************************
X *
X * struct character_bitmap
X *
X ***************************************************************************
X *
X * EDIT HISTORY
X * 19-Oct-90 SRMc - split out from HP2PK.C to improve modularity
X *
X ***************************************************************************
X * Copyright 1990 by the Summer Institute of Linguistics, Inc.
X * All rights reserved.
X */
X
X/****************************************************************************
X * structure to hold a character bitmap
X */
Xstruct character_bitmap
X {
X long *raster; /* dynamically allocated raster */
X short raster_width; /* number of 32-bit words/row */
X short raster_height; /* number of rows */
X unsigned raster_size; /* currently allocated size in bytes */
X };
END_OF_FILE
if test 879 -ne `wc -c <'bitmap.h'`; then
echo shar: \"'bitmap.h'\" unpacked with wrong size!
fi
# end of 'bitmap.h'
fi
if test -f 'fixnum.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fixnum.h'\"
else
echo shar: Extracting \"'fixnum.h'\" \(766 characters\)
sed "s/^X//" >'fixnum.h' <<'END_OF_FILE'
X/* FIXNUM.H - definitions for 32-bit fixed-point (20-bit fraction) numbers
X ***************************************************************************
X * EDIT HISTORY
X * 19-Oct-90 SRMc - split out from HP2PK.C to improve modularity
X * 20-Oct-90 SRMc - enclose macro args in () for safety
X ***************************************************************************
X * Copyright 1990 by the Summer Institute of Linguistics, Inc.
X * All rights reserved.
X */
X#ifndef FIXNUM_H_ALREADY_LOADED /* allow to be loaded multiple places */
X#define FIXNUM_H_ALREADY_LOADED
X
Xtypedef long fixnum; /* 2's complement: 12-bit integer, 20-bit fraction */
X
X#define int_to_fixnum(a) ((a) << 20)
X#define fixnum_to_int(a) ((a) >> 20)
X
X#define TWO_20th 1048576.0 /* 2.0 ** 20 */
X#endif
END_OF_FILE
if test 766 -ne `wc -c <'fixnum.h'`; then
echo shar: \"'fixnum.h'\" unpacked with wrong size!
fi
# end of 'fixnum.h'
fi
if test -f 'getopt.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'getopt.c'\"
else
echo shar: Extracting \"'getopt.c'\" \(2923 characters\)
sed "s/^X//" >'getopt.c' <<'END_OF_FILE'
X/*
X * Here's something you've all been waiting for: the AT&T public domain
X * source for getopt(3). It is the code which was given out at the 1985
X * UNIFORUM conference in Dallas. I obtained it by electronic mail
X * directly from AT&T. The people there assure me that it is indeed
X * in the public domain.
X *
X * There is no manual page. That is because the one they gave out at
X * UNIFORUM was slightly different from the current System V Release 2
X * manual page. The difference apparently involved a note about the
X * famous rules 5 and 6, recommending using white space between an option
X * and its first argument, and not grouping options that have arguments.
X * Getopt itself is currently lenient about both of these things White
X * space is allowed, but not mandatory, and the last option in a group can
X * have an argument. That particular version of the man page evidently
X * has no official existence, and my source at AT&T did not send a copy.
X * The current SVR2 man page reflects the actual behavor of this getopt.
X * However, I am not about to post a copy of anything licensed by AT&T.
X */
X/*
X * modified for DECUS C on RT-11 by Stephen McConnel, 11-Mar-87
X */
X/* This include is needed only to get "index" defined as "strchr" on Sys V. */
X#ifndef BSD
X#define index strchr
X#endif
X
X/*LINTLIBRARY*/
X#define NULL 0
X#define EOF (-1)
X
X#ifdef THINK_C
X#include <string.h>
X#else
Xextern int strcmp(), strlen();
Xextern char *index();
X#endif
X
Xstatic ERR(argv0, s, c)
Xchar *argv0;
Xchar *s;
Xchar c;
X{
Xstatic char errbuf[2];
X#ifdef RT11
Xregister char *p;
Xmsg("?ERROR\200"); /* .PRINT without <CR><LF> */
Xfor ( p = s ; *p++ != '\0' ; )
X ;
X*--p = '\200';
Xmsg(s); /* .PRINT without <CR><LF> */
X*p = '\0';
Xerrbuf[0] = c;
Xerrbuf[1] = '\0';
Xmsg(errbuf); /* .PRINT with <CR><LF> */
X#else
X(void) write(2, argv0, (unsigned)strlen(argv0));
X(void) write(2, s, (unsigned)strlen(s));
Xerrbuf[0] = c;
Xerrbuf[1] = '\n';
X(void) write(2, errbuf, 2);
X#endif
X}
X
Xint opterr = 1;
Xint optind = 1;
Xint optopt;
Xchar *optarg;
X
Xint
Xgetopt(argc, argv, opts)
Xint argc;
Xchar **argv, *opts;
X{
X static int sp = 1;
X register int c;
X register char *cp;
X
X if(sp == 1)
X if(optind >= argc ||
X argv[optind][0] != '-' || argv[optind][1] == '\0')
X return(EOF);
X else if(strcmp(argv[optind], "--") == NULL) {
X optind++;
X return(EOF);
X }
X optopt = c = argv[optind][sp];
X if(c == ':' || (cp=index(opts, c)) == NULL) {
X if (opterr)
X ERR(argv[0], ": illegal option -- ", c);
X if(argv[optind][++sp] == '\0') {
X optind++;
X sp = 1;
X }
X return('?');
X }
X if(*++cp == ':') {
X if(argv[optind][sp+1] != '\0')
X optarg = &argv[optind++][sp+1];
X else if(++optind >= argc) {
X if (opterr)
X ERR(argv[0], ": option requires an argument -- ", c);
X sp = 1;
X return('?');
X } else
X optarg = argv[optind++];
X sp = 1;
X } else {
X if(argv[optind][++sp] == '\0') {
X sp = 1;
X optind++;
X }
X optarg = NULL;
X }
X return(c);
X}
END_OF_FILE
if test 2923 -ne `wc -c <'getopt.c'`; then
echo shar: \"'getopt.c'\" unpacked with wrong size!
fi
# end of 'getopt.c'
fi
if test -f 'hp2pk.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hp2pk.1'\"
else
echo shar: Extracting \"'hp2pk.1'\" \(3853 characters\)
sed "s/^X//" >'hp2pk.1' <<'END_OF_FILE'
X.TH HP2PK 1L "9 February 1991"
X.SH NAME
Xhp2pk \- convert Hewlett-Packard soft fonts into TeX fonts
X.SH SYNOPSIS
X.B hp2pk
X[
X.B -b
X.I density
X] [
X.B -d
X.I size
X] [
X.B -h
X] [
X.B -l
X.IR pl-file[.pl]
X] [
X.B -m
X.I magnification
X] [
X.B -p
X.IR pk-file[.pk]
X] [
X.B -r
X.IR {l|u}
X] [
X.B -s
X.IR space-width
X] [
X.B -t
X.IR tfm-file[.tfm]
X] [
X.B -v
X]
X.IR sfp-file[.sfp]
X.br
X.SH DESCRIPTION
X.I Hp2pk
Xconverts Hewlett-Packard Soft Font/Portrait (SFP) files into the
X.I TFM
Xand
X.I PK
Xfiles needed by
X.I TeX.
X(Okay, okay, so TeX itself doesn't need PK files---the DVI driver programs
Xassociated with TeX generally do!)
XOnly bitmap fonts, either Class 1 bitmap or Class 2 compressed bitmap, are
Xhandled by
X.I hp2pk .
XThe program cannot process Intellifont Scalable Fonts.
X.PP
XFor all files read or written by
X.I hp2pk,
Xan appropriate filename extension is automatically appended to the filename
Xif one is not specified explicitly.
X.SH OPTIONS
XThe command line options are described below.
X.IP "\-b density"
XThe \-b option specifies the pixel density of the font in dots per inch.
XIf this is not given on the command line,
X.I hp2pk
Xassumes a value of 300 dpi.
X.IP "\-d size"
XThe \-d option specifies the design size of the font in points.
XIf this is not given on the command line,
X.I hp2pk
Xcalculates a value from the information given in the input font header,
Xwriting the computed value to the standard output.
X.IP "\-h"
XThe \-h option causes a brief description of the command line options to be
Xwritten to the standard error output (normally the screen).
XNo other action is performed when this option is used.
X.IP "\-m magnification"
XThe \-m option specifies the magnification of the font.
XThe default value is 1000, which indicates no magnification.
X.IP "\-l pl-file"
XThe \-l option specifies a
X.I Property List (PL)
Xfont metric output file.
XThis is a human-readable form of a TeX font metric file.
X.IP "\-p pk-file"
XThe \-p option specifies the font
X.I PacKed bitmap (PK)
Xoutput file.
XIf it is not given on the command line,
X.I hp2pk
Xproduces a PK file with the same basic name as the input file, but with
Xa ".pk" filetype extension.
X.IP "\-r {l|u}"
XThe \-rl option specifies that only the lower 128 character codes be converted
Xand written to the output files.
XThe \-ru option specifies that only the upper 128 character codes be converted,
Xwith the codes translated from the range 128-255 to the range 0-127.
XThis allows font files to be prepared for antiquated DVI drivers that cannot
Xhandle 8-bit fonts.
X.IP "\-s space-width"
XThe \-s option specifies the basic width of a space character in points, if
Xnone exists in the soft font.
XCharacter code 32 (octal 040) is assumed to be a space character if it exists.
XIf the space character is not defined in the font, and the \-s option is not
Xused, then the width of the x character (decimal code 120, octal code 170) is
Xused.
X.IP "\-t tfm-file"
XThe \-t option specifies the
X.I TeX Font Metric (TFM)
Xoutput file.
XIf neither a TFM (\-t) nor a PL (\-l) file is given on the command line,
X.I hp2pk
Xproduces a TFM file with the same basic name as the input file, but with
Xa ".tfm" filetype extension.
X.IP "\-v"
XThe \-v option tells
X.I hp2pk
Xto be more talkative as it works.
X.SH "SEE ALSO"
XTFtoPL(1), PLtoTF(1), GFtoPK(1)
X.SH BUGS
XThe Hewlett-Packard Soft Font file provides neither kerning nor ligature
Xinformation.
XIt also does not supply the slant information for italic fonts.
XIf needed, these values must be supplied by editing the PL file and then
Xrunning
X.I PLtoTF
Xto produce the TFM file.
X
XThe font's pixel density must be a integral number of dots per inch.
X
XBitmaps larger than 32767 bytes are not (yet) handled.
X(Such a bitmap would be larger than 510 dots square!)
X.SH AUTHOR
XStephen McConnel (steve at txsil.sil.org)
X.br
XSummer Institute of Linguistics
X.br
X7500 W. Camp Wisdom Road
X.br
XDallas, TX 75236, U.S.A.
END_OF_FILE
if test 3853 -ne `wc -c <'hp2pk.1'`; then
echo shar: \"'hp2pk.1'\" unpacked with wrong size!
fi
# end of 'hp2pk.1'
fi
if test -f 'memcmp.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'memcmp.c'\"
else
echo shar: Extracting \"'memcmp.c'\" \(982 characters\)
sed "s/^X//" >'memcmp.c' <<'END_OF_FILE'
X/* FILE: MEMCMP.C
X * DATE WRITTEN: 10-Feb-87 BY: Steve McConnel
X * DATE MODIFIED: 7-Apr-87 BY: SMc - handle NULL arguments
X *
X * FUNCTIONS: memcmp - as defined by Unix System V
X */
X#define NULL (char *)0
X/************************************************************************
X * NAME
X * memcmp
X * ARGUMENTS
X * s1 - address of first memory area
X * s2 - address of second memory area
X * n - number of characters to compare
X * DESCRIPTION
X * Compare the first n characters of memory area s1 with the first n
X * characters of memory area s2.
X * RETURN VALUE
X * integer less than, equal to, or greater than zero, indicating that
X * s1 is lexicographically less than, equal to, or greater than s2
X */
Xint memcmp( s1, s2, n )
Xregister char *s1, *s2;
Xregister int n;
X{
Xif ((s1 != NULL) && (s2 != NULL))
X {
X while (n--)
X {
X if (*s1 < *s2)
X return( -1 );
X else if (*s1++ > *s2++)
X return( 1 );
X }
X }
Xreturn( 0 ); /* strings lexically equal */
X}
END_OF_FILE
if test 982 -ne `wc -c <'memcmp.c'`; then
echo shar: \"'memcmp.c'\" unpacked with wrong size!
fi
# end of 'memcmp.c'
fi
if test -f 'memcpy.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'memcpy.c'\"
else
echo shar: Extracting \"'memcpy.c'\" \(865 characters\)
sed "s/^X//" >'memcpy.c' <<'END_OF_FILE'
X/* FILE: MEMCPY.C
X * DATE WRITTEN: 10-Feb-87 BY: Steve McConnel
X * DATE MODIFIED: 7-Apr-87 BY: SMc - handle NULL arguments
X *
X * FUNCTIONS: memcpy - as defined by Unix System V
X */
X#define NULL (char *)0
X/************************************************************************
X * NAME
X * memcpy
X * ARGUMENTS
X * s1 - address of destination memory area
X * s2 - address of source memory area
X * n - number of characters to move
X * DESCRIPTION
X * Copy n characters from memory area s2 to memory area s1. Note that
X * overlapping moves are officially unpredictable.
X * RETURN VALUE
X * address of memory area s1 (ie, original value of s1)
X */
Xchar *memcpy( s1, s2, n )
Xregister char *s1, *s2;
Xregister int n;
X{
Xregister char *rp;
X
Xif ((s1 == NULL) || (s2 == NULL))
X return( NULL );
Xfor ( rp = s1 ; n-- ; *s1++ = *s2++ )
X ;
Xreturn( rp );
X}
END_OF_FILE
if test 865 -ne `wc -c <'memcpy.c'`; then
echo shar: \"'memcpy.c'\" unpacked with wrong size!
fi
# end of 'memcpy.c'
fi
if test -f 'memset.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'memset.c'\"
else
echo shar: Extracting \"'memset.c'\" \(750 characters\)
sed "s/^X//" >'memset.c' <<'END_OF_FILE'
X/* FILE: MEMSET.C
X * DATE WRITTEN: 10-Feb-87 BY: Steve McConnel
X * DATE MODIFIED: 7-Apr-87 BY: SMc - handle NULL argument
X *
X * FUNCTIONS: memset - as defined by Unix System V
X */
X#define NULL (char *)0
X/************************************************************************
X * NAME
X * memset
X * ARGUMENTS
X * s - address of memory area
X * c - character to fill s with
X * n - number of characters to fill
X * DESCRIPTION
X * Set the first n characters of memory area s to the value of
X * character c.
X * RETURN VALUE
X * address of memory area s (ie, original value of s)
X */
Xchar *memset( s, c, n )
Xchar *s;
Xregister int c, n;
X{
Xregister char *p;
X
Xif (s != NULL)
X {
X for ( p = s ; n-- ; *p++ = c )
X ;
X }
Xreturn( s );
X}
END_OF_FILE
if test 750 -ne `wc -c <'memset.c'`; then
echo shar: \"'memset.c'\" unpacked with wrong size!
fi
# end of 'memset.c'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(176 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define VERSION 1
X#define REVISION 0
X#define PATCHLEVEL 0
X#define PATCHDATE "April 12, 1991"
X#define COPYRIGHT "Copyright 1991 by Summer Institute of Linguistics, Inc."
END_OF_FILE
if test 176 -ne `wc -c <'patchlevel.h'`; then
echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
if test -f 'pk.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pk.h'\"
else
echo shar: Extracting \"'pk.h'\" \(2041 characters\)
sed "s/^X//" >'pk.h' <<'END_OF_FILE'
X/* PK.H - structures and constants for TeX's PK font files
X ***************************************************************************
X *
X * struct pk_preamble
X * struct pk_chardata
X *
X ***************************************************************************
X *
X * Source of information for TeX PK font files:
X *
X * GFtoPK.WEB by Tomas Rokicki
X *
X ***************************************************************************
X * EDIT HISTORY
X * 19-Oct-90 SRMc - split out from HP2PK.C to improve modularity
X *
X ***************************************************************************
X * Copyright 1990 by the Summer Institute of Linguistics, Inc.
X * All rights reserved.
X */
X#include "fixnum.h"
X
X/****************************************************************************
X * PK Font command byte values
X */
X#define PK_ID 0x59 /* version number of PK file */
X#define PK_XXX1 0xF0 /* */
X#define PK_YYY 0xF4 /* */
X#define PK_POST 0xF5 /* postamble command */
X#define PK_NO_OP 0xF6 /* no-op command */
X#define PK_PRE 0xF7 /* preamble command */
X
X/****************************************************************************
X * structure to hold a PK Font Preamble
X */
Xstruct pk_preamble
X {
X unsigned char preamble;
X unsigned char ident;
X unsigned char comment_size;
X char comment[256];
X fixnum designsize;
X long checksum;
X long hppp; /* horizontal pixels per point * 2**16 */
X long vppp; /* vertical pixels per point * 2**16 */
X };
X
X/****************************************************************************
X * structure to hold PK Font Character Data
X */
Xstruct pk_chardata
X {
X unsigned char flag_byte;
X long packet_length;
X long char_code; /* character code (0..255) */
X fixnum tfm_width; /* fixed-point number */
X long dx; /* horizontal escapement (pixels * 2**16) */
X long dy; /* vertical escapement (pixels * 2**16) */
X long pixel_width;
X long pixel_height;
X long hoff; /* horizontal offset */
X long voff; /* vertical offset */
X };
END_OF_FILE
if test 2041 -ne `wc -c <'pk.h'`; then
echo shar: \"'pk.h'\" unpacked with wrong size!
fi
# end of 'pk.h'
fi
if test -f 'sfp.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'sfp.h'\"
else
echo shar: Extracting \"'sfp.h'\" \(4174 characters\)
sed "s/^X//" >'sfp.h' <<'END_OF_FILE'
X/* SFP.H - structures and constants for Hewlett-Packard Soft Font files
X ***************************************************************************
X *
X * struct hp_font_descriptor
X * struct hp_character_descriptor
X *
X ***************************************************************************
X *
X * Sources of information for HP Soft Font Format:
X *
X * LaserJet Printer Family Technical Reference Manual,
X * Hewlett-Packard, January 1986.
X *
X * LaserJet series II Printer Technical Reference Manual,
X * Hewlett-Packard, May 1987.
X *
X * LaserJet III Technical Reference Manual, Hewlett-Packard,
X * March 1990.
X *
X ***************************************************************************
X * EDIT HISTORY
X * 18-Oct-90 SRMc - split out from HP2PK.C to improve modularity
X * 31-Jan-91 SRMc - incorporate new information from LaserJet III
X * Technical Reference Manual
X ***************************************************************************
X * Copyright 1990, 1991 by the Summer Institute of Linguistics, Inc.
X * All rights reserved.
X */
X/****************************************************************************
X * structure to hold the HP Soft Font's Font Descriptor
X */
Xstruct hp_font_descriptor
X {
X unsigned short font_descriptor_size; /* 0-1 *//* number of bytes */
X unsigned char header_format; /* 2 *//* 1987 == reserved */
X unsigned char font_type; /* 3 *//* 0..2 */
X unsigned char style_msb; /* 4 *//* 1987 == reserved */
X unsigned char reserved_fd_5; /* 5 */
X unsigned short baseline_distance; /* 6-7 *//* PCL dots */
X unsigned short cell_width; /* 8-9 *//* 1..4200 PCL dots */
X unsigned short cell_height; /* 10-11 *//* 1..4200 PCL dots */
X unsigned char orientation; /* 12 *//* 0..1 */
X unsigned char spacing; /* 13 *//* 0..1 */
X unsigned short symbol_set; /* 14-15 *//* 0..2047 */
X char *symbol_set_string; /* (ASCII string equivalent of symbol_set) */
X unsigned short pitch; /* 16-17 *//* 0..16800 quarter-dots */
X unsigned short height; /* 18-19 *//* 0..10922 quarter-dots */
X unsigned short xheight; /* 20-21 *//* quarter-dots */
X signed char width_type; /* 22 *//* -2..2 */
X unsigned char style; /* 23 *//* 0..1+ */
X signed char stroke_weight; /* 24 *//* -7..7 */
X unsigned char typeface; /* 25 *//* 0..24+ */
X/***************** end of minimum header, rest is optional *****************/
X unsigned char typeface_msb; /* 26 *//* 1987 == reserved */
X unsigned char serif_style; /* 27 *//* 0..8+ */
X unsigned char quality; /* 28 *//* 1987 == reserved */
X unsigned char placement; /* 29 *//* 1987 == reserved */
X signed char underline_distance; /* 30 *//* dots */
X unsigned char underline_height; /* 31 *//* dots */
X unsigned short text_height; /* 32-33 *//* quarter-dots */
X unsigned short text_width; /* 34-35 *//* quarter-dots */
X short firstcode; /* 36-37 *//* 1987 == reserved */
X short lastcode; /* 38-39 *//* 1987 == reserved */
X unsigned char pitch_extended; /* 40 *//* 1024th-dots */
X unsigned char height_extended; /* 41 *//* 1024th-dots */
X unsigned short cap_height; /* 42-43 *//* 1987 == reserved */
X unsigned long font_number; /* 44-47 *//* 1987 == reserved */
X char font_name[16]; /* 48-63 *//* ASCII characters */
X };
X
X/****************************************************************************
X * structure to hold an HP Soft Font Character Descriptor and Raster
X */
Xstruct hp_character_descriptor
X {
X unsigned char format; /* LaserJet Series II -> 4 */
X unsigned char continuation; /* 0 = new char, 1 = continuation */
X unsigned char descriptor_size; /* LaserJet Series II -> 14 */
X unsigned char class; /* LaserJet Series II -> 1 */
X unsigned char orientation; /* 0 = portrait, 1 = landscape */
X unsigned char reserved_cd_5;
X short left_offset; /* [-4200..4200] dots */
X short top_offset; /* [-4200..4200] dots */
X unsigned short character_width; /* [1..4200] dots */
X unsigned short character_height; /* [1..4200] dots */
X short delta_x; /* [0..16800] quarter-dots */
X };
END_OF_FILE
if test 4174 -ne `wc -c <'sfp.h'`; then
echo shar: \"'sfp.h'\" unpacked with wrong size!
fi
# end of 'sfp.h'
fi
if test -f 'strtol.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'strtol.c'\"
else
echo shar: Extracting \"'strtol.c'\" \(3805 characters\)
sed "s/^X//" >'strtol.c' <<'END_OF_FILE'
X/* FILE: STRTOL.C
X * DATE WRITTEN: 20-Feb-87 BY: Steve McConnel
X * DATE MODIFIED:
X *
X * FUNCTIONS: strtol - as defined by Unix System V
X * static is_dig
X * static to_num
X */
X#include <ctype.h>
X
X#define NULL ((char *)0)
X#define NUL '\0'
X
X/************************************************************************
X * NAME
X * strtol
X * ARGUMENTS
X * str - character string representing a number
X * ptr - address of a pointer to the end of the number
X * base - number base from 2 to 36 (0 is special case)
X * DESCRIPTION
X * Convert the value represented by the character string pointed to
X * by str to a long integer in the given base. Leading whitespace is
X * ignored, and an optional sign (+ or -) character is allowed.
X * If base is between 2 and 36, it is used as the number base for the
X * conversion. If base is zero, the number string itself is used to
X * determine the base according to the normal C conventions. (Leading
X * 0x means hexadecimal, and leading 0 means octal.)
X * If ptr is not NULL, the address of the character terminating the
X * scan is stored in the location pointed to by ptr.
X * Note that overflow conditions are ignored. In this implementation,
X * invalid values for base cause 0L to be returned, with no adjustment
X * to *ptr.
X * RETURN VALUE
X * binary equivalent of the ASCII number string
X */
Xlong strtol(str, ptr, base)
Xchar *str, **ptr;
Xint base;
X{
Xregister char *p;
Xlong val;
Xregister int sign;
X/*
X * check for valid base
X */
Xif ((base > 36) || (base < 0) || (base == 1))
X return( 0L );
X/*
X * skip leading whitespace
X */
Xfor ( p = str ; (*p != NUL) && isspace(*p) ; ++p )
X ;
X/*
X * check for optional sign character
X */
Xsign = 0;
Xif (*p == '+')
X ++p;
Xelse if (*p == '-')
X ++p, sign = -1;
X/*
X * allow for null digit string
X */
Xif (*p == NUL)
X {
X if (ptr != (char **)NULL)
X *ptr = p;
X return( 0L );
X }
X/*
X * check for leading 0x for base 16
X */
Xif ((base == 16) && (*p == '0'))
X {
X ++p;
X if ((*p == 'x') || (*p == 'X'))
X ++p;
X }
X/*
X * are we letting the digit string choose the base?
X */
Xelse if (base == 0)
X {
X if (*p == '0')
X {
X ++p;
X if ((*p == 'x') || (*p == 'X'))
X ++p, base = 16; /* leading 0x => hexadecimal */
X else
X base = 8; /* leading 0 => octal */
X }
X else
X base = 10; /* default = decimal */
X }
X/*
X * now we're all set to convert the number
X */
Xfor ( val = 0L ; is_dig(*p,base) ; ++p )
X {
X val *= base;
X val += to_num( *p );
X }
X/*
X * return what we have
X */
Xif (ptr != (char **)NULL)
X *ptr = p;
Xreturn( (sign < 0) ? -val : val );
X}
X
X/************************************************************************
X * NAME
X * is_dig
X * ARGUMENTS
X * c - possible digit character
X * base - number base
X * DESCRIPTION
X * Check whether or not c represents a valid digit in the indicated
X * number base.
X * RETURN VALUE
X * nonzero if c is a valid character for a digit in the desired base
X */
Xstatic int is_dig(c,base)
Xregister int c;
Xint base;
X{
Xif ((c >= '0') && (c <= '9'))
X c -= '0';
Xelse if ((c >= 'A') && (c <= 'Z'))
X c -= ('A' - 10);
Xelse if ((c >= 'a') && (c <= 'z'))
X c -= ('a' - 10);
Xelse
X c = 9999;
Xreturn( c < base );
X}
X
X/************************************************************************
X * NAME
X * to_num
X * ARGUMENTS
X * c - digit character
X * DESCRIPTION
X * Convert the digit character to its actual numeric value, assuming
X * base 36.
X * RETURN VALUE
X * numeric value of input digit character
X */
Xstatic int to_num(c)
Xregister int c;
X{
Xif ((c >= '0') && (c <= '9'))
X return( (c - '0') );
Xelse if ((c >= 'A') && (c <= 'Z'))
X return( (c - 'A' + 10) );
Xelse if ((c >= 'a') && (c <= 'z'))
X return( (c - 'a' + 10) );
Xelse
X return( 0 ); /* just in case */
X}
END_OF_FILE
if test 3805 -ne `wc -c <'strtol.c'`; then
echo shar: \"'strtol.c'\" unpacked with wrong size!
fi
# end of 'strtol.c'
fi
if test -f 'tfm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tfm.h'\"
else
echo shar: Extracting \"'tfm.h'\" \(3312 characters\)
sed "s/^X//" >'tfm.h' <<'END_OF_FILE'
X/* TFM.H - structures and constants for TeX's TFM font metric files
X ***************************************************************************
X *
X * struct tfm_top
X * struct tfm_header
X * struct tfm_chardata
X * struct tfm_param
X *
X ***************************************************************************
X *
X * Sources of information for TeX font metric files:
X *
X * The METAFONTbook by Donald E. Knuth (appendix F)
X * PLtoTF.WEB by Donald E. Knuth, Leo Guibas, et al.
X * TFtoPL.WEB by Donald E. Knuth, Leo Guibas, et al.
X *
X ***************************************************************************
X * EDIT HISTORY
X * 19-Oct-90 SRMc - split out from HP2PK.C to improve modularity
X *
X ***************************************************************************
X * Copyright 1990 by the Summer Institute of Linguistics, Inc.
X * All rights reserved.
X */
X#include "fixnum.h"
X
X/****************************************************************************
X * structure to hold the TFM file description info
X */
Xstruct tfm_top
X {
X short tfm_lf; /* length of the entire file, in words */
X short tfm_lh; /* length of the header data, in words */
X short tfm_bc; /* smallest character code in the font */
X short tfm_ec; /* largest character code in the font */
X short tfm_nw; /* number of words in the width table */
X short tfm_nh; /* number of words in the height table */
X short tfm_nd; /* number of words in the depth table */
X short tfm_ni; /* number of words in the italic correction table */
X short tfm_nl; /* number of words in the lig/kern table */
X short tfm_nk; /* number of words in the kern table */
X short tfm_ne; /* number of words in the extensible character table */
X short tfm_np; /* number of font parameter words */
X };
X
X/****************************************************************************
X * structure to hold the TFM File Header
X */
Xstruct tfm_header
X {
X long tfm_checksum;
X fixnum tfm_design_size;
X char tfm_coding[40];
X char tfm_fontid[20];
X unsigned char tfm_7bitsafe;
X char tfm_unused[2];
X unsigned char tfm_face;
X };
X#define ROMAN 0 /* constants for tfm_face flag */
X#define ITALIC 1
X#define MEDIUM 0
X#define BOLD 2
X#define LIGHT 4
X#define REGULAR 0
X#define CONDENSED 6
X#define EXTENDED 12
X
X/****************************************************************************
X * structure to hold the TFM Character Data
X */
Xstruct tfm_chardata
X {
X fixnum charwd; /* width */
X fixnum charht; /* height */
X fixnum chardp; /* depth */
X fixnum charic; /* italic correction */
X long char_info; /* compact form for output */
X };
X
X/****************************************************************************
X * structure to hold the TFM Font Parameters
X */
Xstruct tfm_param
X {
X fixnum tfm_slant; /* italic slant */
X fixnum tfm_space; /* standard spacing between words */
X fixnum tfm_space_stretch; /* glue stretch between words */
X fixnum tfm_space_shrink; /* glue shrink between words */
X fixnum tfm_x_height; /* accent height */
X fixnum tfm_quad; /* em-space */
X fixnum tfm_extra_space; /* extra space between sentences */
X };
X
X#define MAX_TFM_WIDTH 256
X#define MAX_TFM_HEIGHT 16
X#define MAX_TFM_DEPTH 16
X#define MAX_TFM_CHARIC 64
END_OF_FILE
if test 3312 -ne `wc -c <'tfm.h'`; then
echo shar: \"'tfm.h'\" unpacked with wrong size!
fi
# end of 'tfm.h'
fi
echo shar: End of archive 1 \(of 4\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 4 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.
More information about the Comp.sources.misc
mailing list