v11i059: xdvi, Patch11, Part01/02
Paul Vojta
vojta at math.berkeley.edu
Wed Feb 13 18:09:22 AEST 1991
Submitted-by: vojta at math.berkeley.edu (Paul Vojta)
Posting-number: Volume 11, Issue 59
Archive-name: xdvi/patch11.01
Patch-To: xdvi: Volume 3, Issues 37-39
Patch-To: xdvi: Volume 4, Issue 44 (xdvi, Patch4)
Patch-To: xdvi: Volume 4, Issue 96 (xdvi, dvi previewer, Patch5)
Patch-To: xdvi: Volume 5, Issue 35 (xdvi, dvi previewer, patch 6, part 1/2)
Patch-To: xdvi: Volume 5, Issue 36 (xdvi, dvi previewer, patch 6, part 2/2)
Patch-To: xdvi: Volume 6, Issue 5 (xdvi, Patch7)
Patch-To: xdvi: Volume 6, Issue 49 (xdvi, dvi previewer, patch 8)
Patch-To: xdvi: Volume 7, Issue 52 (xdvi, dvi previewer, patch 9, part 1/2)
Patch-To: xdvi: Volume 7, Issue 53 (xdvi, dvi previewer, patch 9, part 2/2)
Patch-To: xdvi: Volume 10, Issue 9 (xdvi, patch10, part01/02)
Patch-To: xdvi: Volume 10, Issue 10 (xdvi, patch10, part02/02)
Enclosed is patch 11 for xdvi. It includes more graceful handling of missing
characters in fonts, ability to automatically search font directories
recursively, a -keep option to match the `k' keystroke, and a modified
mksedscript routine so that the man page comes out cleaner.
Thanks to the following, among others, for suggestions and improvements:
karl%aten.cs.umb.edu at RELAY.CS.NET
allendorf at iowasp.physics.uiowa.edu
beebe at math.utah.edu
hideki at is.s.u-tokyo.ac.jp
maman at uranie.inria.fr
--Paul Vojta, vojta at math.berkeley.edu
-- cut here --
diff -cr old/Imakefile new/Imakefile
*** old/Imakefile Sun Oct 21 14:46:20 1990
--- new/Imakefile Fri Feb 1 19:05:02 1991
***************
*** 12,22 ****
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
DEFINES=$(DEFS) -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
ComplexProgramTarget(xdvi)
! xdvi.man: xdvi_man.sed
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
--- 12,23 ----
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
DEFINES=$(DEFS) -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\" \
! -DDEFAULT_SUBDIR_PATH=\"$(DEFAULT_SUBDIR_PATH)\"
ComplexProgramTarget(xdvi)
! xdvi.man: xdvi_man.sed mksedscript
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
diff -cr old/Makefile new/Makefile
*** old/Makefile Sun Oct 21 14:46:24 1990
--- new/Makefile Fri Feb 1 19:04:22 1991
***************
*** 8,31 ****
DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
DEFS=-DMSBITFIRST -DBMSHORT -DBUTTONS
FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
FONTFORMATS_C=gf.c pk.c pxl.c
FONTFORMATS_O=gf.o pk.o pxl.o
! LIBDIR=/usr/custom/x11/lib
! #LIBDIR=/tuna_a/x11r4/lib
! INCDIR=
! #INCDIR=/tuna_a/x11r4/include
XMULIB=-lXmu
EXTENSIONLIB=-lXext
! DESTDIR=/usr/local/x11
BINDIR=$(DESTDIR)/bin
MANDIR=$(DESTDIR)/man
INCLUDES=-I$(INCDIR)
CFLAGS=-O $(INCLUDES) $(DEFS)
LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt $(EXTENSIONLIB) -lX11 -lm
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
! CC=/tuna_a/gnu/bin/gcc
RM=rm -f
.c.o:
--- 8,32 ----
DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
DEFS=-DMSBITFIRST -DBMSHORT -DBUTTONS
FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\" \
! -DDEFAULT_SUBDIR_PATH=\"$(DEFAULT_SUBDIR_PATH)\"
FONTFORMATS_C=gf.c pk.c pxl.c
FONTFORMATS_O=gf.o pk.o pxl.o
! TOP=/usr/X11
! INCDIR=$(TOP)/include
! LIBDIR=$(TOP)/lib
XMULIB=-lXmu
EXTENSIONLIB=-lXext
! DESTDIR=$(TOP)
BINDIR=$(DESTDIR)/bin
MANDIR=$(DESTDIR)/man
INCLUDES=-I$(INCDIR)
CFLAGS=-O $(INCLUDES) $(DEFS)
LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt $(EXTENSIONLIB) -lX11 -lm
+ #LIBS=-L$(LIBDIR) -lX11 -lm
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
! CC=gcc
RM=rm -f
.c.o:
***************
*** 44,53 ****
pk.o: xdvi.h
pxl.o: xdvi.h
! pxl_open.o: xdvi.h
$(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
! xdvi.man: xdvi_man.sed
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
--- 45,54 ----
pk.o: xdvi.h
pxl.o: xdvi.h
! pxl_open.o: pxl_open.c xdvi.h
$(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
! xdvi.man: xdvi_man.sed mksedscript
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
diff -cr old/Makefile_10 new/Makefile_10
*** old/Makefile_10 Sun Oct 21 14:46:26 1990
--- new/Makefile_10 Fri Feb 1 19:04:12 1991
***************
*** 8,25 ****
DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
DEFS=-DX10
FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
FONTFORMATS_C=gf.c pk.c pxl.c
FONTFORMATS_O=gf.o pk.o pxl.o
! DESTDIR=/usr/local/x10
BINDIR=$(DESTDIR)/bin
MANDIR=$(DESTDIR)/man
! #INCLUDES=-I/usr/include/X
CFLAGS=-O $(INCLUDES) $(DEFS)
! LIBS=-L/products/ccs/X10/lib -lX -lm
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
! CC=/tuna_a/gnu/bin/gcc
RM=rm -f
.c.o:
--- 8,29 ----
DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
DEFS=-DX10
FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
! -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\" \
! -DDEFAULT_SUBDIR_PATH=\"$(DEFAULT_SUBDIR_PATH)\"
FONTFORMATS_C=gf.c pk.c pxl.c
FONTFORMATS_O=gf.o pk.o pxl.o
! TOP=/usr
! INCDIR=$(TOP)/include
! LIBDIR=$(TOP)/lib
! DESTDIR=$(TOP)
BINDIR=$(DESTDIR)/bin
MANDIR=$(DESTDIR)/man
! INCLUDES=-I$(INCDIR)
CFLAGS=-O $(INCLUDES) $(DEFS)
! LIBS=-L$(LIBDIR) -lX -lm
SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
! CC=gcc
RM=rm -f
.c.o:
***************
*** 38,47 ****
pk.o: xdvi.h
pxl.o: xdvi.h
! pxl_open.o: xdvi.h
$(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
! xdvi.man: xdvi_man.sed
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
--- 42,51 ----
pk.o: xdvi.h
pxl.o: xdvi.h
! pxl_open.o: pxl_open.c xdvi.h
$(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
! xdvi.man: xdvi_man.sed mksedscript
chmod u+x mksedscript
./mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFS) \
> sedscript
diff -cr old/README new/README
*** old/README Sun Oct 21 14:46:30 1990
--- new/README Sat Feb 2 17:04:23 1991
***************
*** 51,56 ****
--- 51,60 ----
ALTFONT (xdvi.c) Default font to use if the font named in the
dvi file cannot be found. Can be set to NULL. By
default, it is "cmr10".
+ SEARCH_SUBDIRECTORIES (pxl_open.c) Enable recursive searching of
+ subdirectories for font files (* and ** specifiers).
+ This also enables the TEXFONTS_SUBDIR environment
+ variable and the DEFAULT_SUBDIR_PATH makefile variable.
NOTOOL (X11 only; xdvi.c) Compile using raw X calls.
BUTTONS (xdvi.c) Put radio buttons on the right side of the
window for commonly used commands.
***************
*** 60,65 ****
--- 64,80 ----
================================================================
+ Note for IBM RS6000 users: some of the libraries are in non-obvious places:
+
+ libXmu /usr/lpp/X11/Xamples/lib/Xmu/libXmu.a
+ libXaw /usr/lpp/X11/Xamples/lib/Xaw/libXaw.a
+
+ These should be moved to /usr/lib or some more reasonable place (or use
+ symlinks), and ditto for the include files, which are initially placed
+ in /usr/lpp/X11/Xamples/include.
+
+ ================================================================
+
Notes of historical nature follow. Most recent changes are listed at the end
of the file.
***************
*** 175,179 ****
--- 190,199 ----
-- Patchlevel 10: --
24. Implemented arrow keys, expert mode, searching for the font's actual
size first, the -[xy]offset and -sw options, and numerous bug fixes.
+ -- Patchlevel 11: --
+ 25. Implemented recursive searching for font files in subdirectories.
+ 26. Changed +sw to -hushspecials and implemented -hush.
+ 27. Modified mksedscript so that the man page comes out neater.
+ 28. Added a -keep option and resource to match the `k' keystroke.
Paul Vojta, vojta at math.berkeley.edu
diff -cr old/README.VMS new/README.VMS
*** old/README.VMS Sun Oct 21 14:46:38 1990
--- new/README.VMS Mon Feb 4 13:08:20 1991
***************
*** 6,18 ****
SYNOPSIS
--------
! XDVI [+[page]] [-s shrink] [-density density] [-p pixels] [-l] [-rv] [-sw]
[-bw width] [-fg color] [-bg color] [-hl color] [-bd color] [-cr color]
[-margins dimen] [-sidemargin dimen] [-topmargin dimen]
! [-offsets dimen] [-xoffset dimen] [-yoffset dimen]
! [-paper papertype] [-mgs[n] size] [-altfont font] [-thorough] [-copy]
! [-geometry geometry] [-icongeometry geometry] [-iconic]
! [-display display] dvi_file
DESCRIPTION
-----------
--- 6,18 ----
SYNOPSIS
--------
! XDVI [+[page]] [-s shrink] [-density density] [-p pixels] [-l] [-rv]
[-bw width] [-fg color] [-bg color] [-hl color] [-bd color] [-cr color]
[-margins dimen] [-sidemargin dimen] [-topmargin dimen]
! [-offsets dimen] [-xoffset dimen] [-yoffset dimen] [-keep]
! [-hushspecials] [-hushchars] [-hush] [-paper papertype] [-mgs[n] size]
! [-altfont font] [-thorough] [-copy] [-geometry geometry]
! [-icongeometry geometry] [-iconic] [-display display] dvi_file
DESCRIPTION
-----------
***************
*** 61,70 ****
white characters on a black background, instead of vice
versa.
- -sw (.specialWarn) Causes XDVI to warn the user when it
- encounters a \special string which it cannot process.
- This option is on by default; to turn it off, use +sw.
-
-bw <width> (.borderWidth) Specifies the width of the border of
the window.
--- 61,66 ----
***************
*** 127,132 ****
--- 123,142 ----
-yoffset <dimen> (.yOffset) Specifies the size of the vertical offset
of the output on the page (see above).
+ -keep (.keepPosition) Sets a flag to indicate that XDVI
+ should not move to the home position when moving to a
+ new page. See also the `k' keystroke.
+
+ -hushspecials (.hushSpecials) Causes XDVI to suppress warnings about
+ \special strings which it cannot process.
+
+ -hushchars (.hushLostChars) Causes XDVI to suppress warnings
+ about references to characters which are not defined in
+ the font.
+
+ -hush (.Hush) Causes XDVI to suppress all suppressable
+ warnings.
+
-paper <papertype> (.paper) Specifies the size of the printed page. This
may be of the form WxH (or WxHcm), where W is the width
in inches (or cm) and H is the height in inches (or
***************
*** 188,194 ****
interpretation will depend on the particular keystroke. Note that the
keystrokes are case sensitive.
! q Quits the program. Control-C and control-D will do this, too.
n Moves to the next page (or to the nth next page if a number is given).
Synonyms are `f', Space, Return, Line Feed, and <Next Screen>.
--- 198,205 ----
interpretation will depend on the particular keystroke. Note that the
keystrokes are case sensitive.
! q Quits the program. Control-C, control-D, and control-Z will do this,
! too.
n Moves to the next page (or to the nth next page if a number is given).
Synonyms are `f', Space, Return, Line Feed, and <Next Screen>.
***************
*** 242,251 ****
R Forces the DVI file to be reread. This allows you to preview many
versions of the same file while running XDVI only once.
! k Normally when XDVI switches pages it moves to the home position as well.
! The `k' keystroke toggles a `keep-position' flag which, when set, will
! keep the same position when moving between pages. Also `0k' and `1k'
! clear and set this flag, respectively.
MOUSE ACTIONS
-------------
--- 253,262 ----
R Forces the DVI file to be reread. This allows you to preview many
versions of the same file while running XDVI only once.
! k Normally when XDVI switches pages, it moves to the home position as
! well. The `k' keystroke toggles a `keep-position' flag which, when set,
! will keep the same position when moving between pages. Also `0k' and
! `1k' clear and set this flag, respectively. See also the -keep option.
MOUSE ACTIONS
-------------
***************
*** 288,293 ****
--- 299,308 ----
(within a certain range), and if this fails, then it will use the font
specified as the alternate font (cf. -altfont).
+ For compatibilty with some versions of TeX, you may also use the logical name
+ "TEXFONTS" in place of "XDVIFONTS", although in that case the string should
+ not include any "%" specifiers.
+
The logical name "XDVISIZES" must be set to indicate which sizes of fonts are
available. It should consists of a list of numbers separated by slashes. If
the list begins with a slash, the system default sizes are used, as well.
***************
*** 400,404 ****
Eric Cooper, CMU, did a version for direct output to a QVSS.
Modified for X by Bob Scheifler, MIT Laboratory for Computer Science.
Modified for X11 by Mark Eichin, MIT SIPB.
! Modified for DECWindows by Scott Allendorf, University of Iowa.
Additional enhancements by many others.
--- 415,419 ----
Eric Cooper, CMU, did a version for direct output to a QVSS.
Modified for X by Bob Scheifler, MIT Laboratory for Computer Science.
Modified for X11 by Mark Eichin, MIT SIPB.
! Modified for VMS and DECWindows by Scott Allendorf, University of Iowa.
Additional enhancements by many others.
diff -cr old/XDVI.RNH new/XDVI.RNH
*** old/XDVI.RNH Sun Oct 21 14:46:47 1990
--- new/XDVI.RNH Mon Feb 4 13:09:35 1991
***************
*** 8,13 ****
--- 8,14 ----
.!
.! Merged with patchlevel 8.001 help file for VMS by Scott Allendorf.
.! Added new switches for patchlevel 10. Scott Allendorf.
+ .! Added new switches for patchlevel 11. Scott Allendorf.
.!
.NO PAGING
.NO FLAGS ALL
***************
*** 175,180 ****
--- 176,200 ----
.SKIP
The resource name is ".highlight".
.INDENT -1
+ 3 -hush
+ .BREAK
+ Causes XDVI to suppress all suppressable warnings.
+ .SKIP
+ The resource name is ".Hush".
+ .INDENT -1
+ 3 -hushchars
+ .BREAK
+ Causes XDVI to suppress warnings about references to characters which
+ are not defined in the font.
+ .SKIP
+ The resource name is ".hushLostChars".
+ .INDENT -1
+ 3 -hushspecials
+ .BREAK
+ Causes XDVI to suppress warnings about \special strings which it cannot process.
+ .SKIP
+ The resource name is ".hushSpecials".
+ .INDENT -1
3 -icongeometry
.BREAK
-icongeometry <geometry>
***************
*** 192,197 ****
--- 212,226 ----
.SKIP
The resource name is ".iconic".
.INDENT -1
+ 3 -keep
+ .BREAK
+ -keep
+ .SKIP
+ Sets a flag to indicate that XDVI should not move to the home position when
+ moving to a new page. See also `k' under the Keystrokes help entry.
+ .SKIP
+ The resource name is ".keepPosition".
+ .INDENT -1
3 -l
.BREAK
Causes the names of the fonts used to be listed.
***************
*** 198,212 ****
.SKIP
The resource name is ".listFonts".
.INDENT -1
- 3 -p
- .BREAK
- -p <pixels>
- .SKIP
- Defines the size of the fonts to use, in pixels per inch. The
- default value is 300.
- .SKIP
- The resource name is ".pixelsPerInch".
- .INDENT -1
3 -offsets
.BREAK
-offsets <dimen>
--- 227,232 ----
***************
*** 221,226 ****
--- 241,255 ----
.SKIP
The resource name is ".Offset".
.INDENT -1
+ 3 -p
+ .BREAK
+ -p <pixels>
+ .SKIP
+ Defines the size of the fonts to use, in pixels per inch. The
+ default value is 300.
+ .SKIP
+ The resource name is ".pixelsPerInch".
+ .INDENT -1
3 -paper
.BREAK
-paper <papertype>
***************
*** 292,304 ****
.SKIP
The resource name is ".sideMargin".
.INDENT -1
- 3 -sw
- .BREAK
- Causes XDVI to warn the user when it encounters a \special string which it
- cannot process. This option is on by default; to turn it off, use +sw.
- .SKIP
- The resource name is ".specialWarn".
- .INDENT -1
3 -thorough
.BREAK
XDVI will usually try to ensure that overstrike characters (e.g.,
--- 321,326 ----
***************
*** 348,354 ****
.INDENT -1
3 q
.BREAK
! Quits the program. Control-C and control-D will do this, too.
.INDENT -1
3 n
.BREAK
--- 370,376 ----
.INDENT -1
3 q
.BREAK
! Quits the program. Control-C, control-D, and control-Z will do this, too.
.INDENT -1
3 n
.BREAK
***************
*** 431,440 ****
.INDENT -1
3 k
.BREAK
! Normally when XDVI switches pages it moves to the home position as
well. The `k' keystroke toggles a `keep-position' flag which, when
set, will keep the same position when moving between pages. Also `0k'
! and `1k' clear and set this flag, respectively.
.INDENT -1
2 Mouse_Actions
--- 453,462 ----
.INDENT -1
3 k
.BREAK
! Normally when XDVI switches pages, it moves to the home position as
well. The `k' keystroke toggles a `keep-position' flag which, when
set, will keep the same position when moving between pages. Also `0k'
! and `1k' clear and set this flag, respectively. See also the -keep option.
.INDENT -1
2 Mouse_Actions
***************
*** 489,494 ****
--- 511,521 ----
font cannot be found at all, then XDVI will try to vary the point size
of the font (within a certain range), and if this fails, then it will
use the font specified as the alternate font (cf. -altfont).
+ .SKIP
+ For compatibilty with some versions of TeX, you may also use the logical name
+ "TEXFONTS" in place of "XDVIFONTS", although in that case the string should
+ not include any "%" specifiers.
+
.INDENT -1
3 XDVISIZES
.BREAK
diff -cr old/dvi_draw.c new/dvi_draw.c
*** old/dvi_draw.c Sun Oct 21 14:46:57 1990
--- new/dvi_draw.c Tue Jan 15 15:22:16 1991
***************
*** 74,80 ****
};
#endif /* BMLONG */
! char *malloc();
void exit();
Boolean check_dvi_file();
void applicationDoSpecial();
--- 74,80 ----
};
#endif /* BMLONG */
! char *xmalloc();
void exit();
Boolean check_dvi_file();
void applicationDoSpecial();
***************
*** 136,142 ****
{
char *s;
! Printf("%4d %4d ", PXL_H, PXL_V);
if (ch <= SETCHAR0 + 127) {
Printf("SETCHAR%-3d", ch - SETCHAR0);
if (isprint(ch))
--- 136,144 ----
{
char *s;
! if (stackp != NULL) Printf("%4d %4d ", PXL_H, PXL_V);
! else Fputs(" ", stdout);
!
if (ch <= SETCHAR0 + 127) {
Printf("SETCHAR%-3d", ch - SETCHAR0);
if (isprint(ch))
***************
*** 159,168 ****
**/
void
! alloc_bitmap(bitmap, fontname, ch)
register struct bitmap *bitmap;
- char *fontname;
- ubyte ch;
{
register unsigned int size;
--- 161,168 ----
**/
void
! alloc_bitmap(bitmap)
register struct bitmap *bitmap;
{
register unsigned int size;
***************
*** 170,179 ****
bitmap->bytes_wide = ROUNDUP(bitmap->w, BITS_PER_BMUNIT) *
BYTES_PER_BMUNIT;
size = bitmap->bytes_wide * bitmap->h;
! bitmap->bits = malloc(size != 0 ? size : 1);
! if (bitmap->bits == NULL)
! oops("Can't allocate bitmap for character %d of font %s (%d by %d)",
! ch, fontname, bitmap->w, bitmap->h);
}
char sample_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
--- 170,176 ----
bitmap->bytes_wide = ROUNDUP(bitmap->w, BITS_PER_BMUNIT) *
BYTES_PER_BMUNIT;
size = bitmap->bytes_wide * bitmap->h;
! bitmap->bits = xmalloc(size != 0 ? size : 1, "character bitmap");
}
char sample_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
***************
*** 256,262 ****
g->bitmap2.h = shrunk_height = g->y2 +
ROUNDUP(g->bitmap.h - cols, shrink_factor) + 1;
if (g->bitmap2.bits) free(g->bitmap2.bits);
! alloc_bitmap(&g->bitmap2, "(shrunken)", 0);
old_ptr = (BMUNIT *) g->bitmap.bits;
new_ptr = (BMUNIT *) g->bitmap2.bits;
shrunk_bytes_wide = g->bitmap2.bytes_wide;
--- 253,259 ----
g->bitmap2.h = shrunk_height = g->y2 +
ROUNDUP(g->bitmap.h - cols, shrink_factor) + 1;
if (g->bitmap2.bits) free(g->bitmap2.bits);
! alloc_bitmap(&g->bitmap2);
old_ptr = (BMUNIT *) g->bitmap.bits;
new_ptr = (BMUNIT *) g->bitmap2.bits;
shrunk_bytes_wide = g->bitmap2.bytes_wide;
***************
*** 311,323 ****
if (ch > maxchar ||
(g = ¤t_font->glyph[ch])->bitmap.bits == NULL) {
! if (ch > maxchar || g->addr == 0)
! oops("Character %d not defined in font %s", ch,
! current_font->fontname);
open_pxl_file(current_font);
Fseek(current_font->file, g->addr, 0);
(*current_font->read_char)(current_font, ch);
- g->dvi_adv = g->dvi_adv * current_font->factor;
if (debug & DBG_BITMAP) print_char(ch, g);
}
--- 308,322 ----
if (ch > maxchar ||
(g = ¤t_font->glyph[ch])->bitmap.bits == NULL) {
! if (ch > maxchar || g->addr == 0) {
! if (!hush_chars)
! Fprintf(stderr, "Character %d not defined in font %s", ch,
! current_font->fontname);
! return;
! }
open_pxl_file(current_font);
Fseek(current_font->file, g->addr, 0);
(*current_font->read_char)(current_font, ch);
if (debug & DBG_BITMAP) print_char(ch, g);
}
***************
*** 406,414 ****
if (cmdlen < nbytes) {
if (cmd) free(cmd);
! cmd = malloc((unsigned) nbytes+1);
! if (cmd == NULL)
! oops("Can't allocate memory for special (%d bytes)", nbytes);
cmdlen = nbytes;
}
Fread(cmd, sizeof(char), (int) nbytes, dvi_file);
--- 405,411 ----
if (cmdlen < nbytes) {
if (cmd) free(cmd);
! cmd = xmalloc((unsigned) nbytes + 1, "special");
cmdlen = nbytes;
}
Fread(cmd, sizeof(char), (int) nbytes, dvi_file);
***************
*** 450,459 ****
break;
case SETRULE:
! a = spellfour(dvi_file);
b = spellfour(dvi_file);
! if (a > 0 && b > 0)
! set_rule(pixel_round(a), pixel_round(b));
DVI_H += b;
break;
--- 447,460 ----
break;
case SETRULE:
! /* Be careful, dvicopy outputs rules with
! height = 0x80000000. We don't want any
! SIGFPE here. */
! a = sfour(dvi_file);
b = spellfour(dvi_file);
! if (a > 0 && b > 0)
! set_rule(pixel_round((long) a * fraction),
! pixel_round(b));
DVI_H += b;
break;
diff -cr old/dvi_init.c new/dvi_init.c
*** old/dvi_init.c Sun Oct 21 14:47:06 1990
--- new/dvi_init.c Sat Feb 2 16:52:32 1991
***************
*** 65,71 ****
* DVI preamble and postamble information.
*/
int current_page;
! Boolean spec_warn_now;
int total_pages;
double fraction;
int maxstack;
--- 65,71 ----
* DVI preamble and postamble information.
*/
int current_page;
! Boolean hush_spec_now;
int total_pages;
double fraction;
int maxstack;
***************
*** 91,96 ****
--- 91,113 ----
FILE *pxl_open();
/*
+ * General (program-wide) utility routines.
+ */
+
+ char *
+ xmalloc(size, why)
+ unsigned size;
+ char *why;
+ {
+ char *mem = malloc(size);
+
+ if (mem == NULL)
+ oops("! Cannot allocate %u bytes for %s.\n", size, why);
+ return mem;
+ }
+
+
+ /*
* define_font reads the rest of the fntdef command and then reads in
* the specified pixel file, adding it to the global linked-list holding
* all of the fonts used in the job.
***************
*** 107,121 ****
int design;
int size;
! fontp = (struct font *) malloc((unsigned) sizeof(struct font));
! if (fontp == NULL)
! oops("Can't allocate memory for font");
fontp->TeXnumber = num(dvi_file, (ubyte) cmnd - FNTDEF1 + 1);
(void) four(dvi_file); /* checksum */
fontp->scale = four(dvi_file);
design = four(dvi_file);
len = one(dvi_file) + one(dvi_file);
! fontp->fontname = malloc((unsigned) len + 1);
Fread(fontp->fontname, sizeof(char), len, dvi_file);
fontp->fontname[len] = '\0';
if(debug & DBG_PK)
--- 124,137 ----
int design;
int size;
! fontp = (struct font *) xmalloc((unsigned) sizeof(struct font),
! "font structure");
fontp->TeXnumber = num(dvi_file, (ubyte) cmnd - FNTDEF1 + 1);
(void) four(dvi_file); /* checksum */
fontp->scale = four(dvi_file);
design = four(dvi_file);
len = one(dvi_file) + one(dvi_file);
! fontp->fontname = xmalloc((unsigned) len + 1, "font name");
Fread(fontp->fontname, sizeof(char), len, dvi_file);
fontp->fontname[len] = '\0';
if(debug & DBG_PK)
***************
*** 130,136 ****
*/
for (;;) {
fontp1 = *fontpp;
! if (fontp1 == NULL) {
read_font_index_proc read_font_index;
char *font_found;
int size_found;
--- 146,152 ----
*/
for (;;) {
fontp1 = *fontpp;
! if (fontp1 == NULL) { /* if font not already loaded */
read_font_index_proc read_font_index;
char *font_found;
int size_found;
***************
*** 140,146 ****
if (n_fonts_left == 0)
close_a_file();
fontp->file = pxl_open(fontp->fontname, &font_found,
! fsize, &size_found, &fontp->factor, &fontp->filename);
if (fontp->file == NULL) {
Fprintf(stderr, "Can't find font %s.\n", fontp->fontname);
font_not_found = True;
--- 156,162 ----
if (n_fonts_left == 0)
close_a_file();
fontp->file = pxl_open(fontp->fontname, &font_found,
! fsize, &size_found, &fontp->filename);
if (fontp->file == NULL) {
Fprintf(stderr, "Can't find font %s.\n", fontp->fontname);
font_not_found = True;
***************
*** 159,165 ****
Fprintf(stderr,
"Can't find font %s at %d dpi; using %d dpi instead.\n",
fontp->fontname, dpi, (size_found + 2) / 5);
- fontp->factor = fontp->factor * fsize / size_found;
maxchar = 255;
magic = two(fontp->file);
if (magic == GF_MAGIC) read_font_index = read_GF_index;
--- 175,180 ----
***************
*** 182,187 ****
--- 197,203 ----
if (strcmp(fontp->fontname, fontp1->fontname) == 0
&& size == fontp1->size) {
*fontpp = fontp1->next;
+ fontp1->TeXnumber = fontp->TeXnumber;
free(fontp->fontname);
free((char *) fontp);
fontp = fontp1;
***************
*** 339,351 ****
int i;
stack = (struct frame *)
! malloc((unsigned) sizeof(struct frame) * (maxstack+1));
! if (stack == NULL)
! oops("Can't allocate stack space (%d frames)", maxstack);
! page_offset = (long *) malloc((unsigned) total_pages * sizeof(long));
! if (page_offset == NULL)
! oops("Can't allocate page directory (%d pages)",
! total_pages);
i = total_pages;
page_offset[--i] = last_page_offset;
Fseek(dvi_file, last_page_offset, 0);
--- 355,364 ----
int i;
stack = (struct frame *)
! xmalloc((unsigned) sizeof(struct frame) * (maxstack+1),
! "stack frame");
! page_offset = (long *) xmalloc((unsigned) total_pages * sizeof(long),
! "page directory");
i = total_pages;
page_offset[--i] = last_page_offset;
Fseek(dvi_file, last_page_offset, 0);
***************
*** 380,386 ****
prepare_pages();
init_page();
if (current_page >= total_pages) current_page = total_pages - 1;
! spec_warn_now = spec_warn;
}
/**
--- 393,399 ----
prepare_pages();
init_page();
if (current_page >= total_pages) current_page = total_pages - 1;
! hush_spec_now = hush_spec;
}
/**
***************
*** 400,406 ****
perror(dvi_name);
exit(1);
}
! dvi_name = malloc((unsigned) n + sizeof(".dvi"));
Sprintf(dvi_name, "%s.dvi", file);
if ((dvi_file = fopen(dvi_name, OPEN_MODE)) == NULL) {
perror(dvi_name);
--- 413,420 ----
perror(dvi_name);
exit(1);
}
! dvi_name = xmalloc((unsigned) n + sizeof(".dvi"),
! "dvi file name");
Sprintf(dvi_name, "%s.dvi", file);
if ((dvi_file = fopen(dvi_name, OPEN_MODE)) == NULL) {
perror(dvi_name);
diff -cr old/gf.c new/gf.c
*** old/gf.c Sun Oct 21 14:47:12 1990
--- new/gf.c Tue Nov 13 13:31:41 1990
***************
*** 99,106 ****
(void) four(GF_file); /* skip checksum */
hppp = sfour(GF_file);
vppp = sfour(GF_file);
! if (debug && hppp != vppp)
! oops("Warning: aspect ratio not 1:1 for font %s", fontp->fontname);
(void) four(GF_file); /* skip min_m */
(void) four(GF_file); /* skip max_m */
(void) four(GF_file); /* skip min_n */
--- 99,106 ----
(void) four(GF_file); /* skip checksum */
hppp = sfour(GF_file);
vppp = sfour(GF_file);
! if (hppp != vppp && (debug & DBG_PK))
! Printf("Font has non-square aspect ratio %d:%d\n", vppp, hppp);
(void) four(GF_file); /* skip min_m */
(void) four(GF_file); /* skip max_m */
(void) four(GF_file); /* skip min_n */
***************
*** 124,140 ****
g = &fontp->glyph[ch];
switch (cmnd) {
case CHAR_LOC:
! g->dvi_adv = sfour(GF_file);
(void) four(GF_file); /* skip dy */
break;
case CHAR_LOC0:
! g->dvi_adv = one(GF_file) << 16;
break;
default:
oops("Non-char_loc command found in GF preamble: %d",
cmnd);
}
! (void) four(GF_file); /* skip width */
addr = four(GF_file);
if (addr != -1) g->addr = addr;
if (debug & DBG_PK)
--- 124,142 ----
g = &fontp->glyph[ch];
switch (cmnd) {
case CHAR_LOC:
! /* g->pxl_adv = sfour(GF_file); */
! (void) four(GF_file);
(void) four(GF_file); /* skip dy */
break;
case CHAR_LOC0:
! /* g->pxl_adv = one(GF_file) << 16; */
! (void) one(GF_file);
break;
default:
oops("Non-char_loc command found in GF preamble: %d",
cmnd);
}
! g->dvi_adv = ((double) fontp->scale * sfour(GF_file)) / (1 << 20);
addr = four(GF_file);
if (addr != -1) g->addr = addr;
if (debug & DBG_PK)
***************
*** 208,214 ****
Printf(", size=%dx%d, dvi_adv=%d\n", g->bitmap.w, g->bitmap.h,
g->dvi_adv);
! alloc_bitmap(&g->bitmap, fontp->fontname, ch);
cp = basep = (BMUNIT *) g->bitmap.bits;
/*
* Read character data into *basep
--- 210,216 ----
Printf(", size=%dx%d, dvi_adv=%d\n", g->bitmap.w, g->bitmap.h,
g->dvi_adv);
! alloc_bitmap(&g->bitmap);
cp = basep = (BMUNIT *) g->bitmap.bits;
/*
* Read character data into *basep
diff -cr old/mksedscript new/mksedscript
*** old/mksedscript Sun Oct 21 14:47:14 1990
--- new/mksedscript Sat Feb 2 15:42:44 1991
***************
*** 5,10 ****
--- 5,11 ----
if ($x == -DX10) set x10
if ($x == -DBUTTONS) set buttons
if ($x == -DA4) set a4
+ if ($x == -DSEARCH_SUBDIRECTORIES) set subdir
end
if ($?x10) then
echo /^\#ifx11/,/^\#/d
***************
*** 14,19 ****
--- 15,21 ----
echo s/%%dot%%/./
endif
if (! $?buttons) echo /^\#ifbuttons/,/^\#/d
+ if (! $?subdir) echo /^\#ifsubdir/,/^\#/d
echo /^\#/d
if ($?a4) then
echo 's/%%defaultpagesize%%/21 x 29.7 cm (A4 size)/'
***************
*** 20,24 ****
else
echo s/%%defaultpagesize%%/8.5 x 11 inches/
endif
! echo s\;%%DEFAULT_FONT_PATH%%\;$1\;
! echo s/%%DEFAULT_FONT_SIZES%%/$2/
--- 22,30 ----
else
echo s/%%defaultpagesize%%/8.5 x 11 inches/
endif
! echo "s@%%DEFAULT_FONT_PATH%%@.TP\\
! $1@" | sed -e "s@:@\\\\
! .TP\\\\
! @g"
! echo s/%%DEFAULT_FONT_SIZES%%/$2/ | sed -e "s/:/ :\\\\
! /g"
diff -cr old/patchlevel.h new/patchlevel.h
*** old/patchlevel.h Sun Oct 21 14:47:16 1990
--- new/patchlevel.h Wed Dec 12 16:30:04 1990
***************
*** 1 ****
! #define PATCHLEVEL 10
--- 1 ----
! #define PATCHLEVEL 11
diff -cr old/pk.c new/pk.c
*** old/pk.c Sun Oct 21 14:47:21 1990
--- new/pk.c Sat Nov 10 17:28:28 1990
***************
*** 134,142 ****
(void) four(fontp->file); /* skip checksum */
hppp = sfour(fontp->file);
vppp = sfour(fontp->file);
! if( debug && hppp != vppp )
! Fprintf(stderr, "Warning: aspect ratio not 1:1 for font %s\n",
! fontp->fontname);
/*fontp->f_scale = (int)((((float) hppp * 72.27) / (float) 65536) + 0.5);*/
/*if (fontp->f_scale == 0) fontp->f_scale = 1000;*/
--- 134,141 ----
(void) four(fontp->file); /* skip checksum */
hppp = sfour(fontp->file);
vppp = sfour(fontp->file);
! if (hppp != vppp && (debug & DBG_PK))
! Printf("Font has non-square aspect ratio %d:%d\n", vppp, hppp);
/*fontp->f_scale = (int)((((float) hppp * 72.27) / (float) 65536) + 0.5);*/
/*if (fontp->f_scale == 0) fontp->f_scale = 1000;*/
***************
*** 233,239 ****
Putchar('\n');
}
! alloc_bitmap(&g->bitmap, fontp->fontname, ch);
cp = (BMUNIT *) g->bitmap.bits;
/*
* read character data into *cp
--- 232,238 ----
Putchar('\n');
}
! alloc_bitmap(&g->bitmap);
cp = (BMUNIT *) g->bitmap.bits;
/*
* read character data into *cp
diff -cr old/pxl.c new/pxl.c
*** old/pxl.c Sun Oct 21 14:47:28 1990
--- new/pxl.c Sat Nov 10 17:28:34 1990
***************
*** 131,137 ****
bitmap = &fontp->glyph[ch].bitmap;
/* in file, bitmap rows are multiples of 32 bits wide */
! alloc_bitmap(bitmap, fontp->fontname, ch);
ptr = (BMUNIT *) bitmap->bits;
#ifndef BMLONG
padding_length = 3 - (bitmap->bytes_wide + 3) % 4;
--- 131,137 ----
bitmap = &fontp->glyph[ch].bitmap;
/* in file, bitmap rows are multiples of 32 bits wide */
! alloc_bitmap(bitmap);
ptr = (BMUNIT *) bitmap->bits;
#ifndef BMLONG
padding_length = 3 - (bitmap->bytes_wide + 3) % 4;
--
Dan Heller
------------------------------------------------
O'Reilly && Associates Zyrcom Inc
Senior Writer President
argv at ora.com argv at zipcode.com
More information about the Comp.sources.x
mailing list