v04i001: dvi previewer (patch level 3), Patch3
Dan Heller
argv at island.uu.net
Wed May 17 14:56:06 AEST 1989
Submitted-by: Donald Richardson <donr at crystal.mie.clarkson.edu>
Posting-number: Volume 4, Issue 1
Archive-name: dvi.pach3/patch3
[ I can't test this as we don't use dvi --argv ]
Enclosed is patch 3 for xdvi. Mostly it contains bug fixes, and also
it includes an option to specify a default font (e.g. cmr10) if it can't
find the one you want---see the -altfont option in the man page. Many
thanks to those who have sent me these patches.
---- cut here ----
diff -cr old/AUTHOR new/AUTHOR
*** old/AUTHOR Wed May 10 19:48:19 1989
--- new/AUTHOR Wed May 10 20:02:18 1989
***************
*** 7,12 ****
--- 7,13 ----
Mark Eichin, MIT SIPB
Paul Vojta, UC Berkeley
Jeffrey Lee, U of Toronto
+ Donald Richardson, Clarkson Univ.
At the present time, the person to send bug reports to is Paul Vojta,
vojta at math.berkeley.edu.
This address will be valid at least through August, 1989.
diff -cr old/README new/README
*** old/README Wed May 10 19:48:33 1989
--- new/README Wed May 10 19:56:41 1989
***************
*** 46,51 ****
--- 46,53 ----
ENVIRONMENT section of the man page for details on
how to get xdvi to recognize the directory structure
you use for storing fonts.
+ SYSV (dvi_init pxl_open xdvi.c) Set for System V
+ compilation.
MSBITFIRST (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c) Store
bitmaps internally with the most significant bit at
the left. For performance reasons, it would be best
***************
*** 61,66 ****
--- 63,71 ----
bitmaps in long integers instead of bytes.
MAXCHARS (dvi_init.c dvi_draw.c gf.c pk.c pxl.c) Set to 256 for
256-character fonts. Default is 128.
+ ALTFONT 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".
All flags should be set in the appropriate Makefile.
================================================================
***************
*** 118,122 ****
--- 123,136 ----
-- Patchlevel 2: --
12. Added MAXCHARS compilation option. Eliminated the nonsense with
generating table.h.
+ -- Patchlevel 3: --
+ 13. Added -altfont command line option and SYSV compilation option.
Paul Vojta, vojta at math.berkeley.edu
+ ================================================================================
+
+ 4/1989 Modified for System V boxes. -DSYSV compiler option.
+
+ Donald Richardson, donr at crystal.mie.clarkson.edu
+
+ ================================================================================
diff -cr old/dvi_draw.c new/dvi_draw.c
*** old/dvi_draw.c Wed May 10 19:48:44 1989
--- new/dvi_draw.c Wed May 10 20:16:56 1989
***************
*** 11,18 ****
--- 11,20 ----
* 12/1988 Added 'R' option, toolkit, magnifying glass
* --Paul Vojta, UC Berkeley.
* 2/1989 Added tpic support --Jeffrey Lee, U of Toronto
+ * 4/1989 Modified for System V by Donald Richardson, Clarkson Univ.
*
* Compilation options:
+ * SYSV compile for System V
* X10 compile for X10
* MSBITFIRST store bitmaps internally in with significant bit first
* BMSHORT store bitmaps in shorts instead of bytes
***************
*** 424,431 ****
--- 426,435 ----
case SET1:
case PUT1:
ch1 = one(dvi_file);
+ #if MAXCHARS < 256
if (ch1 >= MAXCHARS)
oops("Character code too large: %d", ch1);
+ #endif MAXCHARS
set_char(ch1);
if (ch == SET1)
DVI_H += current_font->glyph[ch1].dvi_adv;
diff -cr old/dvi_init.c new/dvi_init.c
*** old/dvi_init.c Wed May 10 19:48:50 1989
--- new/dvi_init.c Wed May 10 20:16:57 1989
***************
*** 11,18 ****
--- 11,20 ----
* 12/1988 Added 'R' option, toolkit, magnifying glass
* --Paul Vojta, UC Berkeley.
* 2/1989 Added tpic support --Jeffrey Lee, U of Toronto
+ * 4/1989 Modified for System V by Donald Richardson, Clarkson Univ.
*
* Compilation options:
+ * SYSV compile for System V
* X10 compile for X10
* MSBITFIRST store bitmaps internally in with significant bit first
* BMSHORT store bitmaps in shorts instead of bytes
***************
*** 27,32 ****
--- 29,35 ----
#include <sys/stat.h>
#define dvi_oops(str) longjmp(dvi_env, (int) str);
+ extern char *alt_font;
static struct stat fstatbuf; /* mechanism to see if file was */
time_t dvi_time; /* modified since last usage */
***************
*** 60,82 ****
*/
static long last_page_offset;
! char *malloc(), *sprintf();
FILE *pxl_open();
static Boolean
! define_new_font(fontp)
register struct font *fontp;
{
read_font_index_proc read_font_index;
if (n_fonts_left == 0)
close_a_file();
! fontp->file = pxl_open(font_path, fontp->fontname, fontp->size,
(fontp->size + 2) / 5, &fontp->filename, &read_font_index);
if (fontp->file == NULL) {
! Fprintf(stderr, "%s at %d dpi [not found]\n", fontp->fontname,
(fontp->size + 2) / 5);
- font_not_found = True;
return(False);
}
(*read_font_index)(fontp);
--- 63,88 ----
*/
static long last_page_offset;
! #ifndef SYSV
! char *sprintf();
! #endif
! char *malloc();
FILE *pxl_open();
static Boolean
! define_new_font(fontp, fontname)
register struct font *fontp;
+ char *fontname;
{
read_font_index_proc read_font_index;
if (n_fonts_left == 0)
close_a_file();
! fontp->file = pxl_open(font_path, fontname, fontp->size,
(fontp->size + 2) / 5, &fontp->filename, &read_font_index);
if (fontp->file == NULL) {
! Fprintf(stderr, "Font %s at %d dpi [not found]\n", fontname,
(fontp->size + 2) / 5);
return(False);
}
(*read_font_index)(fontp);
***************
*** 153,159 ****
for (;;) {
fontp1 = *fontpp;
if (fontp1 == NULL) {
! if (!define_new_font(fontp)) return;
break;
}
if (strcmp(fontp->fontname, fontp1->fontname) == 0
--- 159,176 ----
for (;;) {
fontp1 = *fontpp;
if (fontp1 == NULL) {
! if (!define_new_font(fontp, fontp->fontname)) {
! if (alt_font == NULL || !define_new_font(fontp, alt_font)) {
! font_not_found = True;
! return;
! }
! Fprintf(stderr,
! "Can't find <%s>, using <%s> instead at %d dpi\n",
! fontp->fontname, alt_font, (size + 2) / 5);
! free(fontp->fontname);
! fontp->fontname = malloc((unsigned) strlen(alt_font)+1);
! (void) strcpy(fontp->fontname, alt_font);
! }
break;
}
if (strcmp(fontp->fontname, fontp1->fontname) == 0
diff -cr old/patchlevel.h new/patchlevel.h
*** old/patchlevel.h Wed May 10 19:48:56 1989
--- new/patchlevel.h Wed May 10 19:56:43 1989
***************
*** 1 ****
! #define PATCHLEVEL 2
--- 1 ----
! #define PATCHLEVEL 3
diff -cr old/pxl_open.c new/pxl_open.c
*** old/pxl_open.c Wed May 10 19:49:10 1989
--- new/pxl_open.c Wed May 10 19:56:45 1989
***************
*** 43,49 ****
read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
! char *malloc(), *index(), *sprintf();
#define Strcpy (void) strcpy
#define Sprintf (void) sprintf
--- 43,52 ----
read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
! #ifndef SYSV
! char *sprintf();
! #endif
! char *malloc(), *index();
#define Strcpy (void) strcpy
#define Sprintf (void) sprintf
diff -cr old/xdvi.c new/xdvi.c
*** old/xdvi.c Wed May 10 19:49:32 1989
--- new/xdvi.c Wed May 10 20:16:56 1989
***************
*** 11,23 ****
--- 11,26 ----
* 12/1988 Added 'R' option, toolkit, magnifying glass
* --Paul Vojta, UC Berkeley.
* 2/1989 Added tpic support --Jeffrey Lee, U of Toronto
+ * 4/1989 Modified for System V by Donald Richardson, Clarkson Univ.
*
* Compilation options:
+ * SYSV compile for System V
* X10 compile for X10
* MSBITFIRST store bitmaps internally in with significant bit first
* BMSHORT store bitmaps in shorts instead of bytes
* BMLONG store bitmaps in longs instead of bytes
* MAXCHARS set to 256 for 256 character fonts (default = 128)
+ * ALTFONT default for -altfont option.
*/
#ifndef lint
#include "patchlevel.h"
***************
*** 29,34 ****
--- 32,41 ----
#endif X10
#endif lint
+ #ifndef ALTFONT
+ #define ALTFONT "cmr10"
+ #endif ALTFONT
+
#ifndef X10
#undef Boolean
***************
*** 92,97 ****
--- 99,105 ----
#define MAGBORD 1 /* border size for magnifier */
char *font_path;
char default_font_path[] = DEFAULT_FONT_PATH;
+ char *alt_font = ALTFONT;
/*
* Command line flags.
***************
*** 118,124 ****
/* fg and bg colors */
static Arg fore_args = {XtNforeground, (XtArgVal) 0};
static Arg back_args = {XtNbackground, (XtArgVal) 0};
! static XColor hl_Color, cr_Color;
#endif X10
static char *fore_color;
--- 126,132 ----
/* fg and bg colors */
static Arg fore_args = {XtNforeground, (XtArgVal) 0};
static Arg back_args = {XtNbackground, (XtArgVal) 0};
! static Pixel hl_Pixel, cr_Pixel;
#endif X10
static char *fore_color;
***************
*** 173,180 ****
static void can_exposures(), read_events();
! char *malloc(), *index(), *rindex(), *sprintf(), *getenv(),
! *strcpy(), *strcat();
double atof();
--- 181,190 ----
static void can_exposures(), read_events();
! #ifndef SYSV
! char *sprintf();
! #endif
! char *malloc(), *index(), *rindex(), *getenv(), *strcpy(), *strcat();
double atof();
***************
*** 977,982 ****
--- 987,993 ----
static void
enable_intr() {
+ #ifndef SYSV
int socket = ConnectionNumber(DISP);
if (!isatty(0)) {
puts("trying...");
***************
*** 986,991 ****
--- 997,1003 ----
(void) signal(SIGIO, handle_intr);
(void) fcntl(socket, F_SETOWN, getpid());
(void) fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | FASYNC);
+ #endif
}
static
***************
*** 1039,1045 ****
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
[-mgs[n] <size>] [-geometry <geometry>] [#<geometry>]\n\
! [-display <host:display>] dvi_file\n", stderr);
#else X10
fputs("\
Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-rv]\n\
--- 1051,1057 ----
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
[-mgs[n] <size>] [-geometry <geometry>] [#<geometry>]\n\
! [-altfont <font>] [-display <host:display>] dvi_file\n", stderr);
#else X10
fputs("\
Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-rv]\n\
***************
*** 1047,1053 ****
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
[-mgs[n] <size>] [-geometry <geometry> | =<geometry>]\n\
! [-display <host:display> | host:display] dvi_file\n", stderr);
#endif X10
exit(1);
}
--- 1059,1066 ----
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
[-mgs[n] <size>] [-geometry <geometry> | =<geometry>]\n\
! [-altfont <font>] [-display <host:display> | host:display] dvi_file\n",
! stderr);
#endif X10
exit(1);
}
***************
*** 1069,1074 ****
--- 1082,1088 ----
{"-margins", ".margins", XrmoptionSepArg, (caddr_t) NULL},
{"-sidemargin", ".sideMargin", XrmoptionSepArg, (caddr_t) NULL},
{"-topmargin", ".topMargin", XrmoptionSepArg, (caddr_t) NULL},
+ {"-altfont", ".altFont", XrmoptionSepArg, (caddr_t) NULL},
{"-l", ".listFonts", XrmoptionNoArg, (caddr_t) "on"},
{"+l", ".listFonts", XrmoptionNoArg, (caddr_t) "off"},
{"-fg", ".foreground", XrmoptionSepArg, (caddr_t) NULL},
***************
*** 1105,1110 ****
--- 1119,1126 ----
(Cardinal) &sidemargin, XtRString, NULL},
{"topMargin", "Margin", XtRString, sizeof(char *),
(Cardinal) &topmargin, XtRString, NULL},
+ {"altFont", "AltFont", XtRString, sizeof(char *),
+ (Cardinal) &alt_font, XtRString, (caddr_t) ALTFONT},
{"listFonts", "ListFonts", XtRBoolean, sizeof(Boolean),
(Cardinal) &list_fonts, XtRBoolean, (caddr_t) &list_fonts},
{"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean),
***************
*** 1117,1128 ****
(Cardinal)&back_args.value, XtRPixel, (caddr_t) &back_args.value},
{"background", "Background", XtRString, sizeof(char *),
(Cardinal)&back_color, XtRString, NULL},
! {"highlight", "Highlight", XtRColor, sizeof(XColor),
! (Cardinal)&hl_Color, XtRColor, (caddr_t) &hl_Color},
{"highlight", "Highlight", XtRString, sizeof(char *),
(Cardinal)&high_color, XtRString, NULL},
! {"cursorColor", "CursorColor", XtRColor, sizeof(XColor),
! (Cardinal)&cr_Color, XtRColor, (caddr_t) &cr_Color},
{"cursorColor", "CursorColor", XtRString, sizeof(char *),
(Cardinal)&curs_color, XtRString, NULL},
{"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
--- 1133,1144 ----
(Cardinal)&back_args.value, XtRPixel, (caddr_t) &back_args.value},
{"background", "Background", XtRString, sizeof(char *),
(Cardinal)&back_color, XtRString, NULL},
! {"highlight", "Highlight", XtRPixel, sizeof(Pixel),
! (Cardinal)&hl_Pixel, XtRPixel, (caddr_t) &hl_Pixel},
{"highlight", "Highlight", XtRString, sizeof(char *),
(Cardinal)&high_color, XtRString, NULL},
! {"cursorColor", "CursorColor", XtRPixel, sizeof(Pixel),
! (Cardinal)&cr_Pixel, XtRPixel, (caddr_t) &cr_Pixel},
{"cursorColor", "CursorColor", XtRString, sizeof(char *),
(Cardinal)&curs_color, XtRString, NULL},
{"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
***************
*** 1286,1306 ****
}
highGC = ruleGC;
if (high_color)
! highGC = MakeGC(GXcopy, hl_Color.pixel, back_args.value);
}
ready_cursor = XCreateFontCursor(DISP, XC_cross);
redraw_cursor = XCreateFontCursor(DISP, XC_watch);
if (!curs_color)
! if (high_color) cr_Color = hl_Color;
! else {
! cr_Color.pixel = fore_args.value;
! XQueryColor(DISP, DefaultColormapOfScreen(SCRN), &cr_Color);
! }
{
! XColor bg_Color;
bg_Color.pixel = back_args.value;
XQueryColor(DISP, DefaultColormapOfScreen(SCRN), &bg_Color);
XRecolorCursor(DISP, ready_cursor, &cr_Color, &bg_Color);
XRecolorCursor(DISP, redraw_cursor, &cr_Color, &bg_Color);
}
--- 1302,1321 ----
}
highGC = ruleGC;
if (high_color)
! highGC = MakeGC(GXcopy, hl_Pixel, back_args.value);
}
ready_cursor = XCreateFontCursor(DISP, XC_cross);
redraw_cursor = XCreateFontCursor(DISP, XC_watch);
if (!curs_color)
! cr_Pixel = high_color ? hl_Pixel : fore_args.value;
{
! XColor bg_Color, cr_Color;
!
bg_Color.pixel = back_args.value;
XQueryColor(DISP, DefaultColormapOfScreen(SCRN), &bg_Color);
+ cr_Color.pixel = cr_Pixel;
+ XQueryColor(DISP, DefaultColormapOfScreen(SCRN), &cr_Color);
XRecolorCursor(DISP, ready_cursor, &cr_Color, &bg_Color);
XRecolorCursor(DISP, redraw_cursor, &cr_Color, &bg_Color);
}
***************
*** 1343,1348 ****
--- 1358,1364 ----
{"-margins", "margins", SepArg, StringArg, (caddr_t) &margins},
{"-sidemargin", "sideMargin", SepArg, StringArg, (caddr_t) &sidemargin},
{"-topmargin", "topMargin", SepArg, StringArg, (caddr_t) &topmargin},
+ {"-altfont", "altFont", SepArg, StringArg, (caddr_t) &alt_font},
{"-l", "listFonts", TrueArg, BooleanArg, (caddr_t) &list_fonts},
{"+l", NULL, FalseArg, BooleanArg, (caddr_t) &list_fonts},
{"-rv", "reverseVideo", TrueArg, BooleanArg, (caddr_t) &reverse},
diff -cr old/xdvi.man.sed new/xdvi.man.sed
*** old/xdvi.man.sed Wed May 10 19:49:47 1989
--- new/xdvi.man.sed Wed May 10 20:11:40 1989
***************
*** 1,14 ****
! .TH XDVI SIPB "17 January 1989" "X Version 11"
.SH NAME
xdvi \- DVI Previewer for the X Window System
.SH SYNOPSIS
.B xdvi
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP] [\-hl \fIcolor\fP]
! [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [-thorough] [\-margins \fIinches\fP]
! [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
[\-mgs[\fIn\fP] \fIsize\fP] [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
[%\fIgeometry\fP] [\-display \fIdisplay\fP] file
.SH DESCRIPTION
.I Xdvi
is a program which runs under the X window system. It is used to preview
--- 1,16 ----
! .TH XDVI SIPB "8 May 1989" "X Version 11"
.SH NAME
xdvi \- DVI Previewer for the X Window System
.SH SYNOPSIS
.B xdvi
+ .nh
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-altfont \fIfont\fP] [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
! [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [-thorough]
! [\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
[\-mgs[\fIn\fP] \fIsize\fP] [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
[%\fIgeometry\fP] [\-display \fIdisplay\fP] file
+ .hy
.SH DESCRIPTION
.I Xdvi
is a program which runs under the X window system. It is used to preview
***************
*** 53,58 ****
--- 55,65 ----
(.pixelsPerInch)
Defines the size of the fonts to use, in pixels per inch. The
default value is 300.
+ .TP
+ .BI \-altfont " font"
+ (.altFont)
+ Declares a default font to use when the font in the dvi file cannot be found.
+ This is useful, for example, with PostScript <tm> fonts.
.TP
.B \-l
(.listFonts)
diff -cr old/xdvi10.man.s new/xdvi10.man.s
*** old/xdvi10.man.s Wed May 10 19:49:51 1989
--- new/xdvi10.man.s Wed May 10 20:11:40 1989
***************
*** 1,14 ****
! .TH XDVI SIPB "17 January 1989" "X Version 10"
.SH NAME
xdvi \- DVI Previewer for the X Window System
.SH SYNOPSIS
.B xdvi
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP] [\-hl \fIcolor\fP]
! [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [\-margins \fIinches\fP]
! [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
[\-mgs[\fIn\fP] \fIsize\fP] [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
[\-display \fIdisplay\fP | \fIhost\fP:\fIdisplay\fP] file
.SH DESCRIPTION
.I Xdvi
is a program which runs under the X window system. It is used to preview
--- 1,16 ----
! .TH XDVI SIPB "8 May 1989" "X Version 10"
.SH NAME
xdvi \- DVI Previewer for the X Window System
.SH SYNOPSIS
.B xdvi
+ .nh
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-altfont \fIfont\fP] [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
! [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP]
! [\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
[\-mgs[\fIn\fP] \fIsize\fP] [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
[\-display \fIdisplay\fP | \fIhost\fP:\fIdisplay\fP] file
+ .hy
.SH DESCRIPTION
.I Xdvi
is a program which runs under the X window system. It is used to preview
***************
*** 53,58 ****
--- 55,65 ----
(pixelsPerInch)
Defines the size of the fonts to use, in pixels per inch. The
default value is 300.
+ .TP
+ .BI \-altfont " font"
+ (altFont)
+ Declares a default font to use when the font in the dvi file cannot be found.
+ This is useful, for example, with PostScript <tm> fonts.
.TP
.B \-l
(listFonts)
More information about the Comp.sources.x
mailing list