home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xdvi / part05 < prev    next >
Encoding:
Text File  |  1992-03-22  |  37.5 KB  |  1,252 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: vojta@powdermilk.berkeley.edu (Paul Vojta)
  4. Subject: v17i027: xdvi, dvi previewer, Part05/05
  5. Message-ID: <1992Mar23.173222.15498@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i023-xdvi@uunet.UU.NET>
  10. Date: Mon, 23 Mar 1992 17:32:22 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: vojta@powdermilk.berkeley.edu (Paul Vojta)
  14. Posting-number: Volume 17, Issue 27
  15. Archive-name: xdvi/part05
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of shell archive."
  24. # Contents:  mksedscript tpic.c util.c xdvi.icon xdvi_man.sed
  25. # Wrapped by vojta@powdermilk.berkeley.edu on Tue Mar 17 17:50:25 1992
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'mksedscript' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'mksedscript'\"
  29. else
  30. echo shar: Extracting \"'mksedscript'\" \(895 characters\)
  31. sed "s/^X//" >'mksedscript' <<'END_OF_FILE'
  32. X#! /bin/csh -f
  33. Xunset    x10 buttons a4
  34. Xset    noglob
  35. Xforeach x ($argv[4-])
  36. X    if ($x == -DX10)    set x10
  37. X    if ($x == -DBUTTONS)    set buttons
  38. X    if ($x == -DA4)        set a4
  39. X    if ($x == -DSEARCH_SUBDIRECTORIES) set subdir
  40. X    if ($x == -DXDVIFONTS_ONLY) set texfonts
  41. Xend
  42. Xif ($?x10) then
  43. X    echo    /^\#ifx11/,/^\#/d
  44. X    echo    s/%%dot%%//
  45. Xelse
  46. X    echo    /^\#ifx10/,/^\#/d
  47. X    echo    s/%%dot%%/./
  48. Xendif
  49. Xif (! $?buttons)    echo /^\#ifbuttons/,/^\#/d
  50. Xif (! $?subdir)        echo /^\#ifsubdir/,/^\#/d
  51. Xif ($?texfonts)        echo /^\#iftexfonts/,/^\#/d
  52. Xecho    /^\#/d
  53. Xif ($?a4) then
  54. X    echo    's/%%defaultpagesize%%/21 x 29.7 cm (A4 size)/'
  55. Xelse
  56. X    echo    s/%%defaultpagesize%%/8.5 x 11 inches/
  57. Xendif
  58. Xecho    "s@%%DEFAULT_FONT_PATH%%@.TP\\
  59. X$1@" | sed -e "s@:@\\\\
  60. X.TP\\\\
  61. X@g"
  62. Xecho    s/%%DEFAULT_FONT_SIZES%%/$2/ | sed -e "s/:/ :\\\\
  63. X/g"
  64. Xif ($3 != "") then
  65. X    echo    "s@%%DEFAULT_VF_PATH%%@.TP\\
  66. X$3@" | sed -e "s@:@\\\\
  67. X.TP\\\\
  68. X@g"
  69. Xelse
  70. X    echo    's@%%DEFAULT_VF_PATH%%.*$@@'
  71. Xendif
  72. END_OF_FILE
  73. if test 895 -ne `wc -c <'mksedscript'`; then
  74.     echo shar: \"'mksedscript'\" unpacked with wrong size!
  75. fi
  76. chmod +x 'mksedscript'
  77. # end of 'mksedscript'
  78. fi
  79. if test -f 'tpic.c' -a "${1}" != "-c" ; then 
  80.   echo shar: Will not clobber existing file \"'tpic.c'\"
  81. else
  82. echo shar: Extracting \"'tpic.c'\" \(10160 characters\)
  83. sed "s/^X//" >'tpic.c' <<'END_OF_FILE'
  84. X/*
  85. X * Support drawing routines for TeXsun and TeX
  86. X *
  87. X *      Copyright, (C) 1987, 1988 Tim Morgan, UC Irvine
  88. X *
  89. X * At the time these routines are called, the values of hh and vv should
  90. X * have been updated to the upper left corner of the graph (the position
  91. X * the \special appears at in the dvi file).  Then the coordinates in the
  92. X * graphics commands are in terms of a virtual page with axes oriented the
  93. X * same as the Imagen and the SUN normally have:
  94. X *
  95. X *                      0,0
  96. X *                       +-----------> +x
  97. X *                       |
  98. X *                       |
  99. X *                       |
  100. X *                      \ /
  101. X *                       +y
  102. X *
  103. X * Angles are measured in the conventional way, from +x towards +y.
  104. X * Unfortunately, that reverses the meaning of "counterclockwise"
  105. X * from what it's normally thought of.
  106. X *
  107. X * A lot of floating point arithmetic has been converted to integer
  108. X * arithmetic for speed.  In some places, this is kind-of kludgy, but
  109. X * it's worth it.
  110. X */
  111. X
  112. X#include <math.h>
  113. X#include <ctype.h>
  114. X
  115. X#include "xdvi.h"
  116. X
  117. X#ifndef    X_NOT_STDC_ENV
  118. X#include <stdlib.h>
  119. X#endif
  120. X
  121. X#define    MAXPOINTS    300    /* Max points in a path */
  122. X#define    TWOPI        (3.14159265359*2.0)
  123. X#define    MAX_PEN_SIZE    7    /* Max pixels of pen width */
  124. X
  125. X
  126. Xstatic    int    xx[MAXPOINTS], yy[MAXPOINTS];    /* Path in milli-inches */
  127. Xstatic    int    path_len = 0;    /* # points in current path */
  128. Xstatic    int    pen_size = 1;    /* Pixel width of lines drawn */
  129. X
  130. Xstatic    Boolean    whiten = False;
  131. Xstatic    Boolean    shade = False;
  132. Xstatic    Boolean    blacken = False;
  133. X
  134. X/* Unfortunately, these values also appear in dvisun.c */
  135. X#define    xRESOLUTION    (pixels_per_inch/shrink_factor)
  136. X#define    yRESOLUTION    (pixels_per_inch/shrink_factor)
  137. X
  138. X
  139. X/*
  140. X * Issue warning messages
  141. X */
  142. Xstatic    void
  143. XWarning(fmt, msg)
  144. X    char    *fmt, *msg;
  145. X{
  146. X    Fprintf(stderr, fmt, msg);
  147. X    (void) fputc('\n', stderr);
  148. X}
  149. X
  150. X
  151. X/*
  152. X * Set the size of the virtual pen used to draw in milli-inches
  153. X */
  154. X/* ARGSUSED */
  155. Xstatic    void
  156. Xset_pen_size(cp)
  157. X    char *cp;
  158. X{
  159. X    int    ps;
  160. X
  161. X    if (sscanf(cp, " %d ", &ps) != 1) {
  162. X        Warning("illegal .ps command format: %s", cp);
  163. X        return;
  164. X    }
  165. X    pen_size = (ps * (xRESOLUTION + yRESOLUTION) + 1000) / 2000;
  166. X    if (pen_size < 1) pen_size = 1;
  167. X    else if (pen_size > MAX_PEN_SIZE) pen_size = MAX_PEN_SIZE;
  168. X}
  169. X
  170. X
  171. X/*
  172. X * Print the line defined by previous path commands
  173. X */
  174. Xstatic    void
  175. Xflush_path()
  176. X{
  177. X    register int i;
  178. X    int    last_min_x, last_max_x, last_min_y, last_max_y;
  179. X
  180. X    last_min_x = 30000;
  181. X    last_min_y = 30000;
  182. X    last_max_x = -30000;
  183. X    last_max_y = -30000;
  184. X    for (i = 1; i < path_len; i++) {
  185. X        if (xx[i] > last_max_x) last_max_x = xx[i];
  186. X        if (xx[i] < last_min_x) last_min_x = xx[i];
  187. X        if (yy[i] > last_max_y) last_max_y = yy[i];
  188. X        if (yy[i] < last_min_y) last_min_y = yy[i];
  189. X        line_btw(xx[i], yy[i], xx[i+1], yy[i+1]);
  190. X    }
  191. X    if (xx[path_len] > last_max_x) last_max_x = xx[path_len];
  192. X    if (xx[path_len] < last_min_x) last_min_x = xx[path_len];
  193. X    if (yy[path_len] > last_max_y) last_max_y = yy[path_len];
  194. X    if (yy[path_len] < last_min_y) last_min_y = yy[path_len];
  195. X    path_len = 0;
  196. X    do_attribute_path(last_min_x, last_max_x, last_min_y, last_max_y);
  197. X}
  198. X
  199. X
  200. X/*
  201. X * Print a dashed line along the previously defined path, with
  202. X * the dashes/inch defined.
  203. X */
  204. X
  205. Xstatic    void
  206. Xflush_dashed(cp, dotted)
  207. X    char    *cp;
  208. X    int    dotted;
  209. X{
  210. X    int    i;
  211. X    int    numdots;
  212. X    int    lx0, ly0, lx1, ly1;
  213. X    int    cx0, cy0, cx1, cy1;
  214. X    float    inchesperdash;
  215. X    double    d, spacesize, a, b, dx, dy, milliperdash;
  216. X
  217. X    if (sscanf(cp, " %f ", &inchesperdash) != 1) {
  218. X        Warning("illegal format for dotted/dashed line: %s", cp);
  219. X        return;
  220. X    }
  221. X    if (path_len <= 1 || inchesperdash <= 0.0) {
  222. X        Warning("illegal conditions for dotted/dashed line", "");
  223. X        return;
  224. X    }
  225. X    milliperdash = inchesperdash * 1000.0;
  226. X    lx0 = xx[1];    ly0 = yy[1];
  227. X    lx1 = xx[2];    ly1 = yy[2];
  228. X    dx = lx1 - lx0;
  229. X    dy = ly1 - ly0;
  230. X    if (dotted) {
  231. X        numdots = sqrt(dx*dx + dy*dy) / milliperdash + 0.5;
  232. X        if (numdots == 0) numdots = 1;
  233. X        for (i = 0; i <= numdots; i++) {
  234. X        a = (float) i / (float) numdots;
  235. X        cx0 = lx0 + a * dx + 0.5;
  236. X        cy0 = ly0 + a * dy + 0.5;
  237. X        dot_at(cx0, cy0);
  238. X        }
  239. X    }
  240. X    else {
  241. X        d = sqrt(dx*dx + dy*dy);
  242. X        numdots = d / (2.0 * milliperdash) + 1.0;
  243. X        if (numdots <= 1)
  244. X        line_btw(lx0, ly0, lx1, ly1);
  245. X        else {
  246. X        spacesize = (d - numdots * milliperdash) / (numdots - 1);
  247. X        for (i = 0; i < numdots - 1; i++) {
  248. X            a = i * (milliperdash + spacesize) / d;
  249. X            b = a + milliperdash / d;
  250. X            cx0 = lx0 + a * dx + 0.5;
  251. X            cy0 = ly0 + a * dy + 0.5;
  252. X            cx1 = lx0 + b * dx + 0.5;
  253. X            cy1 = ly0 + b * dy + 0.5;
  254. X            line_btw(cx0, cy0, cx1, cy1);
  255. X            b += spacesize / d;
  256. X        }
  257. X        cx0 = lx0 + b * dx + 0.5;
  258. X        cy0 = ly0 + b * dy + 0.5;
  259. X        line_btw(cx0, cy0, lx1, ly1);
  260. X        }
  261. X    }
  262. X    path_len = 0;
  263. X}
  264. X
  265. X
  266. X/*
  267. X * Add a point to the current path
  268. X */
  269. Xstatic    void
  270. Xadd_path(cp)
  271. X    char    *cp;
  272. X{
  273. X    int    pathx, pathy;
  274. X
  275. X    if (++path_len >= MAXPOINTS) oops("Too many points");
  276. X    if (sscanf(cp, " %d %d ", &pathx, &pathy) != 2)
  277. X        oops("Malformed path command");
  278. X    xx[path_len] = pathx;
  279. X    yy[path_len] = pathy;
  280. X}
  281. X
  282. X
  283. X/*
  284. X * Draw to a floating point position
  285. X */
  286. Xstatic void
  287. Xim_fdraw(x, y)
  288. X    double    x,y;
  289. X{
  290. X    if (++path_len >= MAXPOINTS) oops("Too many arc points");
  291. X    xx[path_len] = x + 0.5;
  292. X    yy[path_len] = y + 0.5;
  293. X}
  294. X
  295. X
  296. X/*
  297. X * Draw an ellipse with the indicated center and radices.
  298. X */
  299. Xstatic    void
  300. Xdraw_ellipse(xc, yc, xr, yr)
  301. X    int    xc, yc, xr, yr;
  302. X{
  303. X    double    angle, theta;
  304. X    int    n;
  305. X    int    px0, py0, px1, py1;
  306. X
  307. X    angle = (xr + yr) / 2.0;
  308. X    theta = sqrt(1.0 / angle);
  309. X    n = TWOPI / theta + 0.5;
  310. X    if (n < 12) n = 12;
  311. X    else if (n > 80) n = 80;
  312. X    n /= 2;
  313. X    theta = TWOPI / n;
  314. X
  315. X    angle = 0.0;
  316. X    px0 = xc + xr;        /* cos(0) = 1 */
  317. X    py0 = yc;        /* sin(0) = 0 */
  318. X    while ((angle += theta) <= TWOPI) {
  319. X        px1 = xc + xr*cos(angle) + 0.5;
  320. X        py1 = yc + yr*sin(angle) + 0.5;
  321. X        line_btw(px0, py0, px1, py1);
  322. X        px0 = px1;
  323. X        py0 = py1;
  324. X    }
  325. X    line_btw(px0, py0, xc + xr, yc);
  326. X}
  327. X
  328. X/*
  329. X * Draw an arc
  330. X */
  331. Xstatic    void
  332. Xarc(cp)
  333. X    char    *cp;
  334. X{
  335. X    int    xc, yc, xrad, yrad, n;
  336. X    float    start_angle, end_angle, angle, theta, r;
  337. X    double    xradius, yradius, xcenter, ycenter;
  338. X
  339. X    if (sscanf(cp, " %d %d %d %d %f %f ", &xc, &yc, &xrad, &yrad,
  340. X        &start_angle, &end_angle) != 6) {
  341. X        Warning("illegal arc specification: %s", cp);
  342. X        return;
  343. X    }
  344. X    /* We have a specialized fast way to draw closed circles/ellipses */
  345. X    if (start_angle <= 0.0 && end_angle >= 6.282) {
  346. X        draw_ellipse(xc, yc, xrad, yrad);
  347. X        return;
  348. X    }
  349. X    xcenter = xc;
  350. X    ycenter = yc;
  351. X    xradius = xrad;
  352. X    yradius = yrad;
  353. X    r = (xradius + yradius) / 2.0;
  354. X    theta = sqrt(1.0 / r);
  355. X    n = 0.3 * TWOPI / theta + 0.5;
  356. X    if (n < 12) n = 12;
  357. X    else if (n > 80) n = 80;
  358. X    n /= 2;
  359. X    theta = TWOPI / n;
  360. X    flush_path();
  361. X    im_fdraw(xcenter + xradius * cos(start_angle),
  362. X        ycenter + yradius * sin(start_angle));
  363. X    angle = start_angle + theta;
  364. X    while (angle < end_angle) {
  365. X        im_fdraw(xcenter + xradius * cos(angle),
  366. X        ycenter + yradius * sin(angle));
  367. X        angle += theta;
  368. X    }
  369. X    im_fdraw(xcenter + xradius * cos(end_angle),
  370. X        ycenter + yradius * sin(end_angle));
  371. X    flush_path();
  372. X}
  373. X
  374. X
  375. X/*
  376. X * APPROXIMATE integer distance between two points
  377. X */
  378. X#define    dist(x0, y0, x1, y1)    (abs(x0-x1)+abs(y0-y1))
  379. X
  380. X
  381. X/*
  382. X * Draw a spline along the previously defined path
  383. X */
  384. Xstatic    void
  385. Xflush_spline()
  386. X{
  387. X    int    xp, yp;
  388. X    int    N;
  389. X    int    lastx    = -1;
  390. X    int    lasty;
  391. X    int    t1, t2, t3;
  392. X    int    steps;
  393. X    int    j;
  394. X    register int i, w;
  395. X
  396. X#ifdef    lint
  397. X    lasty = -1;
  398. X#endif
  399. X    N = path_len + 1;
  400. X    xx[0] = xx[1];
  401. X    yy[0] = yy[1];
  402. X    xx[N] = xx[N-1];
  403. X    yy[N] = yy[N-1];
  404. X    for (i = 0; i < N - 1; i++) {    /* interval */
  405. X        steps = (dist(xx[i], yy[i], xx[i+1], yy[i+1]) +
  406. X        dist(xx[i+1], yy[i+1], xx[i+2], yy[i+2])) / 80;
  407. X        for (j = 0; j < steps; j++) {    /* points within */
  408. X        w = (j * 1000 + 500) / steps;
  409. X        t1 = w * w / 20;
  410. X        w -= 500;
  411. X        t2 = (750000 - w * w) / 10;
  412. X        w -= 500;
  413. X        t3 = w * w / 20;
  414. X        xp = (t1*xx[i+2] + t2*xx[i+1] + t3*xx[i] + 50000) / 100000;
  415. X        yp = (t1*yy[i+2] + t2*yy[i+1] + t3*yy[i] + 50000) / 100000;
  416. X        if (lastx > -1) line_btw(lastx, lasty, xp, yp);
  417. X        lastx = xp;
  418. X        lasty = yp;
  419. X        }
  420. X    }
  421. X    path_len = 0;
  422. X}
  423. X
  424. X
  425. X/*
  426. X * Shade the last box, circle, or ellipse
  427. X */
  428. Xstatic    void
  429. Xshade_last()
  430. X{
  431. X    blacken = whiten = False;
  432. X    shade = True;
  433. X}
  434. X
  435. X
  436. X/*
  437. X * Make the last box, circle, or ellipse, white inside (shade with white)
  438. X */
  439. Xstatic    void
  440. Xwhiten_last()
  441. X{
  442. X    whiten = True;
  443. X    blacken = shade = False;
  444. X}
  445. X
  446. X
  447. X/*
  448. X * Make last box, etc, black inside
  449. X */
  450. Xstatic    void
  451. Xblacken_last()
  452. X{
  453. X    blacken = True;
  454. X    whiten = shade = False;
  455. X}
  456. X
  457. X
  458. X/*
  459. X *    The following copyright message applies to the rest of this file.  --PV
  460. X */
  461. X
  462. X/*
  463. X *    This program is Copyright (C) 1987 by the Board of Trustees of the
  464. X *    University of Illinois, and by the author Dirk Grunwald.
  465. X *
  466. X *    This program may be freely copied, as long as this copyright
  467. X *    message remaines affixed. It may not be sold, although it may
  468. X *    be distributed with other software which is sold. If the
  469. X *    software is distributed, the source code must be made available.
  470. X *
  471. X *    No warranty, expressed or implied, is given with this software.
  472. X *    It is presented in the hope that it will prove useful.
  473. X *
  474. X *    Hacked in ignorance and desperation by jonah@db.toronto.edu
  475. X */
  476. X
  477. X/*
  478. X *      The code to handle the \specials generated by tpic was modified
  479. X *      by Dirk Grunwald using the code Tim Morgan at Univ. of Calif, Irvine
  480. X *      wrote for TeXsun.
  481. X */
  482. X
  483. X#define    COMLEN    4
  484. X
  485. Xvoid
  486. XapplicationDoSpecial(cp)
  487. X    char    *cp;
  488. X{
  489. X    char    command[COMLEN], *orig_cp;
  490. X    register int len;
  491. X
  492. X    orig_cp = cp;
  493. X    while (isspace(*cp)) ++cp;
  494. X    len = 0;
  495. X    while (!isspace(*cp) && *cp && len < COMLEN-1) command[len++] = *cp++;
  496. X    command[len] = '\0';
  497. X    if (strcmp(command, "pn") == 0) set_pen_size(cp);
  498. X    else if (strcmp(command, "fp") == 0) flush_path();
  499. X    else if (strcmp(command, "da") == 0) flush_dashed(cp, 0);
  500. X    else if (strcmp(command, "dt") == 0) flush_dashed(cp, 1);
  501. X    else if (strcmp(command, "pa") == 0) add_path(cp);
  502. X    else if (strcmp(command, "ar") == 0) arc(cp);
  503. X    else if (strcmp(command, "sp") == 0) flush_spline();
  504. X    else if (strcmp(command, "sh") == 0) shade_last();
  505. X    else if (strcmp(command, "wh") == 0) whiten_last();
  506. X    else if (strcmp(command, "bk") == 0) blacken_last();
  507. X    /* throw away the path -- jansteen */
  508. X    else if (strcmp(command, "ip") == 0) path_len = 0;
  509. X    else if (!hush_spec_now)
  510. X        Fprintf(stderr, "%s:  special \"%s\" not implemented\n", prog,
  511. X        orig_cp);
  512. X}
  513. END_OF_FILE
  514. if test 10160 -ne `wc -c <'tpic.c'`; then
  515.     echo shar: \"'tpic.c'\" unpacked with wrong size!
  516. fi
  517. # end of 'tpic.c'
  518. fi
  519. if test -f 'util.c' -a "${1}" != "-c" ; then 
  520.   echo shar: Will not clobber existing file \"'util.c'\"
  521. else
  522. echo shar: Extracting \"'util.c'\" \(3976 characters\)
  523. sed "s/^X//" >'util.c' <<'END_OF_FILE'
  524. X/*
  525. X * DVI previewer for X.
  526. X *
  527. X * Eric Cooper, CMU, September 1985.
  528. X *
  529. X * Code derived from dvi-imagen.c.
  530. X *
  531. X * Modification history:
  532. X * 1/1986    Modified for X.10 by Bob Scheifler, MIT LCS.
  533. X * 7/1988    Modified for X.11 by Mark Eichin, MIT
  534. X * 12/1988    Added 'R' option, toolkit, magnifying glass
  535. X *            --Paul Vojta, UC Berkeley.
  536. X * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  537. X * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  538. X * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  539. X *
  540. X *    Compilation options:
  541. X *    SYSV    compile for System V
  542. X *    VMS    compile for VMS
  543. X *    X10    compile for X10
  544. X *    NOTOOL    compile without toolkit (X11 only)
  545. X *    BUTTONS    compile with buttons on the side of the window (needs toolkit)
  546. X *    MSBITFIRST    store bitmaps internally with most significant bit first
  547. X *    BMSHORT    store bitmaps in shorts instead of bytes
  548. X *    BMLONG    store bitmaps in longs instead of bytes
  549. X *    ALTFONT    default for -altfont option
  550. X *    A4    use European size paper
  551. X */
  552. X
  553. X#include "xdvi.h"
  554. X#include <errno.h>
  555. Xint    errno;
  556. X
  557. X#ifdef VMS
  558. X#include <rmsdef.h>
  559. X#endif /* VMS */
  560. X
  561. X#ifndef    X_NOT_STDC_ENV
  562. X#include <stdlib.h>
  563. X#else
  564. Xchar    *malloc();
  565. Xvolatile void    exit();
  566. X#endif
  567. X#if    defined(macII) && !defined(__STDC__) /* stdlib.h doesn't define these */
  568. Xchar    *malloc();
  569. X#endif /* macII */
  570. X
  571. X#if    NeedVarargsPrototypes        /* this is for oops */
  572. X#include <stdarg.h>
  573. X#else
  574. X#include <varargs.h>
  575. X#endif
  576. X
  577. X/*
  578. X *    General utility routines.
  579. X */
  580. X
  581. X/*
  582. X *    Print error message and quit.
  583. X */
  584. X
  585. X#if    NeedVarargsPrototypes
  586. Xvolatile void
  587. Xoops(_Xconst char *message, ...)
  588. X#else
  589. X/* VARARGS */
  590. Xvolatile void
  591. Xoops(va_alist)
  592. X    va_dcl
  593. X#endif
  594. X{
  595. X#if    !NeedVarargsPrototypes
  596. X    _Xconst char *message;
  597. X#endif
  598. X    va_list    args;
  599. X
  600. X    Fprintf(stderr, "%s: ", prog);
  601. X#if    NeedVarargsPrototypes
  602. X    va_start(args, message);
  603. X#else
  604. X    va_start(args);
  605. X    message = va_arg(args, _Xconst char *);
  606. X#endif
  607. X    (void) vfprintf(stderr, message, args);
  608. X    va_end(args);
  609. X    Putc('\n', stderr);
  610. X    exit(1);
  611. X}
  612. X
  613. X/*
  614. X *    Either allocate storage or fail with explanation.
  615. X */
  616. X
  617. Xchar *
  618. Xxmalloc(size, why)
  619. X    unsigned    size;
  620. X    _Xconst char    *why;
  621. X{
  622. X    char *mem = malloc(size);
  623. X
  624. X    if (mem == NULL)
  625. X        oops("! Cannot allocate %u bytes for %s.\n", size, why);
  626. X    return mem;
  627. X}
  628. X
  629. X/*
  630. X *    Allocate bitmap for given font and character
  631. X */
  632. X
  633. Xvoid
  634. Xalloc_bitmap(bitmap)
  635. X    register struct bitmap *bitmap;
  636. X{
  637. X    register unsigned int    size;
  638. X
  639. X    /* width must be multiple of 16 bits for raster_op */
  640. X    bitmap->bytes_wide = ROUNDUP(bitmap->w, BITS_PER_BMUNIT) *
  641. X        BYTES_PER_BMUNIT;
  642. X    size = bitmap->bytes_wide * bitmap->h;
  643. X    bitmap->bits = xmalloc(size != 0 ? size : 1, "character bitmap");
  644. X}
  645. X
  646. X
  647. X/*
  648. X *    Close the pixel file for the least recently used font.
  649. X */
  650. X
  651. Xstatic    void
  652. Xclose_a_file()
  653. X{
  654. X    register struct font *fontp;
  655. X    unsigned short oldest = ~0;
  656. X    struct font *f = NULL;
  657. X
  658. X    for (fontp = font_head; fontp != NULL; fontp = fontp->next)
  659. X        if (fontp->file != NULL && fontp->timestamp <= oldest) {
  660. X        f = fontp;
  661. X        oldest = fontp->timestamp;
  662. X        }
  663. X    if (f == NULL)
  664. X        oops("Can't find an open pixel file to close");
  665. X    Fclose(f->file);
  666. X    f->file = NULL;
  667. X    ++n_files_left;
  668. X}
  669. X
  670. X/*
  671. X *    Open a file in the given mode.
  672. X */
  673. X
  674. XFILE *
  675. Xxfopen(filename)
  676. X    _Xconst char    *filename;
  677. X{
  678. X    FILE    *f;
  679. X
  680. X    if (n_files_left == 0) close_a_file();
  681. X    f = fopen(filename, OPEN_MODE);
  682. X#ifndef    VMS
  683. X    if (f == NULL && errno == EMFILE)
  684. X#else    /* VMS */
  685. X    if (f == NULL && errno == EVMSERR && vaxc$errno == RMS$_ACC)
  686. X#endif    /* VMS */
  687. X    {
  688. X        n_files_left = 0;
  689. X        close_a_file();
  690. X        f = fopen(filename, OPEN_MODE);
  691. X    }
  692. X    return f;
  693. X}
  694. X
  695. X
  696. X/*
  697. X *
  698. X *      Read size bytes from the FILE fp, constructing them into a
  699. X *      signed/unsigned integer.
  700. X *
  701. X */
  702. X
  703. Xunsigned long
  704. Xnum(fp, size)
  705. X    register FILE *fp;
  706. X    register ubyte size;
  707. X{
  708. X    register long x = 0;
  709. X
  710. X    while (size--) x = (x << 8) | one(fp);
  711. X    return x;
  712. X}
  713. X
  714. Xlong
  715. Xsnum(fp, size)
  716. X    register FILE *fp;
  717. X    register ubyte size;
  718. X{
  719. X    register long x;
  720. X
  721. X#ifdef    __STDC__
  722. X    x = (signed char) getc(fp);
  723. X#else
  724. X    x = (unsigned char) getc(fp);
  725. X    if (x & 0x80) x -= 0x100;
  726. X#endif
  727. X    while (--size) x = (x << 8) | one(fp);
  728. X    return x;
  729. X}
  730. END_OF_FILE
  731. if test 3976 -ne `wc -c <'util.c'`; then
  732.     echo shar: \"'util.c'\" unpacked with wrong size!
  733. fi
  734. # end of 'util.c'
  735. fi
  736. if test -f 'xdvi.icon' -a "${1}" != "-c" ; then 
  737.   echo shar: Will not clobber existing file \"'xdvi.icon'\"
  738. else
  739. echo shar: Extracting \"'xdvi.icon'\" \(1874 characters\)
  740. sed "s/^X//" >'xdvi.icon' <<'END_OF_FILE'
  741. X#define xdvi_width 48
  742. X#define xdvi_height 48
  743. Xstatic char xdvi_bits[] = {
  744. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
  745. X   0x22, 0x00, 0x00, 0x01, 0x00, 0x00, 0xa2, 0xe0, 0x44, 0x38, 0x95, 0x13,
  746. X   0x9e, 0x17, 0x45, 0x45, 0x55, 0xf4, 0x82, 0xf0, 0x28, 0x3d, 0xd5, 0x13,
  747. X   0x82, 0x10, 0x28, 0x05, 0x55, 0x10, 0x82, 0xe0, 0x10, 0x39, 0x8a, 0x13,
  748. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  749. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x00,
  750. X   0x79, 0x18, 0x18, 0x13, 0x16, 0x00, 0x69, 0x10, 0x18, 0x0e, 0x16, 0x00,
  751. X   0xcf, 0x20, 0x1c, 0x0e, 0xd6, 0x00, 0xe9, 0xc3, 0x7b, 0x84, 0x3f, 0x01,
  752. X   0x09, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x00, 0x00, 0x70, 0xcc,
  753. X   0x08, 0x00, 0x00, 0x00, 0x30, 0x52, 0x0a, 0x00, 0x00, 0x00, 0x30, 0x52,
  754. X   0x0a, 0xc0, 0xff, 0x03, 0x30, 0x4c, 0x0a, 0x00, 0x00, 0x00, 0x10, 0x00,
  755. X   0x0a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0a, 0xc0, 0xff, 0x03, 0x10, 0x00,
  756. X   0x0a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00,
  757. X   0x0a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0xf0, 0x17,
  758. X   0x0b, 0x0c, 0x3c, 0xc0, 0x93, 0x20, 0x0c, 0x0e, 0x43, 0x20, 0x96, 0x40,
  759. X   0x0c, 0x8e, 0x81, 0x10, 0x96, 0xbe, 0x0a, 0x8d, 0x81, 0x19, 0x90, 0x82,
  760. X   0x8a, 0x8c, 0x81, 0x0d, 0x90, 0x42, 0x48, 0x8c, 0x81, 0xed, 0x91, 0x3e,
  761. X   0x6a, 0x0c, 0xc3, 0x1d, 0x96, 0x12, 0x38, 0x0c, 0xbc, 0x0d, 0x1c, 0x02,
  762. X   0xf8, 0x3f, 0x80, 0x0d, 0x1c, 0x3e, 0x0b, 0x0c, 0x80, 0x0c, 0x1c, 0x00,
  763. X   0x0b, 0x0c, 0xc3, 0x18, 0x1c, 0x00, 0x0a, 0x0c, 0x63, 0x10, 0x16, 0x00,
  764. X   0x89, 0x3f, 0x1e, 0xe0, 0x11, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00,
  765. X   0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x10, 0x00,
  766. X   0xff, 0xff, 0xff, 0xff, 0x1f, 0xae, 0x0f, 0x00, 0x80, 0x84, 0x0a, 0xae,
  767. X   0x87, 0x64, 0x86, 0x84, 0x08, 0x42, 0x42, 0x45, 0xe2, 0x1c, 0x07, 0x42};
  768. END_OF_FILE
  769. if test 1874 -ne `wc -c <'xdvi.icon'`; then
  770.     echo shar: \"'xdvi.icon'\" unpacked with wrong size!
  771. fi
  772. # end of 'xdvi.icon'
  773. fi
  774. if test -f 'xdvi_man.sed' -a "${1}" != "-c" ; then 
  775.   echo shar: Will not clobber existing file \"'xdvi_man.sed'\"
  776. else
  777. echo shar: Extracting \"'xdvi_man.sed'\" \(17227 characters\)
  778. sed "s/^X//" >'xdvi_man.sed' <<'END_OF_FILE'
  779. X#ifx11
  780. X.TH XDVI 1 "27 March 1990" "X Version 11"
  781. X#ifx10
  782. X.TH XDVI 1 "27 March 1990" "X Version 10"
  783. X#endif
  784. X.SH NAME
  785. Xxdvi \- DVI Previewer for the X Window System
  786. X.SH SYNOPSIS
  787. X.B xdvi
  788. X.nh
  789. X[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP] [\-l]
  790. X[\-paper \fIpapertype\fP] [\-mgs[\fIn\fP] \fIsize\fP]
  791. X[\-hushspecials] [\-hushchars] [\-hush] [\-altfont \fIfont\fP]
  792. X[\-margins \fIdimen\fP] [\-sidemargin \fIdimen\fP] [\-topmargin \fIdimen\fP]
  793. X[\-offsets \fIdimen\fP] [\-xoffset \fIdimen\fP] [\-yoffset \fIdimen\fP]
  794. X[\-keep] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
  795. X[\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [\-bw \fIwidth\fP]
  796. X#ifx11
  797. X[\-geometry \fIgeometry\fP] [\-icongeometry \fIgeometry\fP] [\-iconic]
  798. X[\-display \fIdisplay\fP] [\-copy] [\-thorough]
  799. X#ifbuttons
  800. X[\-expert]
  801. X#ifx10
  802. X[\-geometry \fIgeometry\fP | =\fIgeometry\fP]
  803. X[\-display \fIhost\fP:\fIdisplay\fP | \fIhost\fP:\fIdisplay\fP]
  804. X#endif
  805. Xdvi_file
  806. X.hy
  807. X.SH DESCRIPTION
  808. X.I Xdvi
  809. Xis a program which runs under the X window system. It is used to preview
  810. XDVI files, such as are produced by TeX.
  811. X.PP
  812. XThis program has the capability of showing the file shrunken by various
  813. X(integer) factors, and also has a ``magnifying glass'' which allows one
  814. Xto see a small part of the unshrunk image momentarily.
  815. X.PP
  816. XBefore displaying any page or part thereof, it checks to see if the dvi
  817. Xfile has changed since the last time it was displayed.  If this is the case,
  818. Xthen \fIxdvi\fR will reinitialize itself for the new dvi file.  For this reason,
  819. Xexposing parts of the \fIxdvi\fR window while \fITeX\fR is running should be
  820. Xavoided.  This feature allows you to preview many versions
  821. Xof the same file while running \fIxdvi\fR only once.
  822. X#ifbuttons
  823. X.PP
  824. XIn addition to using keystrokes to move within the file, \fIxdvi\fR provides
  825. Xbuttons on the right side of the window, which are synonymous with various
  826. Xsequences of keystrokes.
  827. X#endif
  828. X.SH OPTIONS
  829. XIn addition to specifying the .\fPdvi\fR file (with or without the .\fPdvi\fR),
  830. X\fIXdvi\fR supports the following command line options.
  831. XIf the option begins with a
  832. X.RB ` + '
  833. Xinstead of a
  834. X.RB ` \- ',
  835. X#ifx11
  836. Xthe option is restored to its default value.  By default, these options can
  837. Xbe set via the resource names given in parentheses in the description of
  838. Xeach option.
  839. X#ifx10
  840. Xthe option is restored to its default value.  These options override those
  841. Xset in the ``.Xdefaults'' file (via the resource names given in parentheses
  842. Xin the description of each option).
  843. X#endif
  844. X.TP
  845. X.IB + page
  846. XSpecifies the first page to show.  If \fI+\fR is given without a
  847. Xnumber, the last page is assumed; the first page is the default.
  848. X.TP
  849. X.BI \-s " shrink"
  850. X(%%dot%%shrinkFactor)
  851. XDefines the initial shrink factor.  The default value is 3.
  852. X.TP
  853. X.BI \-S " density"
  854. X(%%dot%%densityPercent)
  855. XDetermines the density used when shrinking bitmaps for fonts.
  856. XA higher value produces a lighter font.  The default value is 40.
  857. X.TP
  858. X.BI \-density " density"
  859. XSame as \fB-S\fR.
  860. X.TP
  861. X.BI \-p " pixels"
  862. X(%%dot%%pixelsPerInch)
  863. XDefines the size of the fonts to use, in pixels per inch.  The
  864. Xdefault value is 300.
  865. X.TP
  866. X.BI \-altfont " font"
  867. X(%%dot%%altFont)
  868. XDeclares a default font to use when the font in the dvi file cannot be found.
  869. XThis is useful, for example, with PostScript <tm> fonts.
  870. X.TP
  871. X.B \-l
  872. X(%%dot%%listFonts)
  873. XCauses the names of the fonts used to be listed.
  874. X.TP
  875. X.B \-hushspecials
  876. X(%%dot%%hushSpecials)
  877. XCauses \fIxdvi\fR to suppress warnings about \\special strings
  878. Xwhich it cannot process.
  879. X.TP
  880. X.B \-hushchars
  881. X(%%dot%%hushLostChars)
  882. XCauses \fIxdvi\fR to suppress warnings about references to characters which
  883. Xare not defined in the font.
  884. X.TP
  885. X.B \-hush
  886. X(%%dot%%Hush)
  887. XCauses \fIxdvi\fR to suppress all suppressable warnings.
  888. X.TP
  889. X.B \-rv
  890. X(%%dot%%reverseVideo)
  891. XCauses the page to be displayed with white characters on a
  892. Xblack background, instead of vice versa.
  893. X.TP
  894. X.BI \-bw " width"
  895. X(%%dot%%borderWidth)
  896. XSpecifies the width of the border of the window.
  897. X.TP
  898. X.BI \-borderwidth " width"
  899. XSame as \fB-bw\fR.
  900. X.TP
  901. X.BI \-fg " color"
  902. X(%%dot%%foreground)
  903. XDetermines the color of the text (foreground).
  904. X.TP
  905. X.BI \-foreground " color"
  906. XSame as \fB-fg\fR.
  907. X.TP
  908. X.BI \-bg " color"
  909. X(%%dot%%background)
  910. XDetermines the color of the background.
  911. X.TP
  912. X.BI \-background " color"
  913. XSame as \fB-bg\fR.
  914. X.TP
  915. X.BI \-hl " color"
  916. X(%%dot%%highlight)
  917. XDetermines the color of the page border.  The default is the foreground color.
  918. X.TP
  919. X.BI \-bd " color"
  920. X(%%dot%%borderColor)
  921. XDetermines the color of the window border.
  922. X.TP
  923. X.BI \-bordercolor " color"
  924. XSame as \fB-bd\fR.
  925. X.TP
  926. X.BI \-cr " color"
  927. X(%%dot%%cursorColor)
  928. XDetermines the color of the cursor.  The default is the color of the page
  929. Xborder.
  930. X#ifx11
  931. X.TP
  932. X.B \-thorough
  933. X(.thorough)
  934. X\fIXdvi\fR will usually try to ensure that overstrike characters (\fIe.g.\fR
  935. X\\notin) are printed correctly.  On monochrome displays, this is always
  936. Xpossible with one logical operation, either \fIand\fR or \fIor\fR.  On
  937. Xcolor displays, however, this may take two operations, one to set the
  938. Xappropriate bits and one to clear other bits.  If this is the case, then
  939. Xby default \fIxdvi\fR will instead use the \fIcopy\fR operation,
  940. Xwhich does not handle overstriking correctly.  The ``thorough'' option
  941. Xchooses the slower but more correct choice.  See also \fI-copy\fR, below.
  942. X.TP
  943. X.B \-copy
  944. X(.copy)
  945. XAlways use the \fIcopy\fR operation when writing characters to the display.
  946. XThis option may be necessary for correct operation on a color display, but
  947. Xoverstrike characters will be incorrect.
  948. X.TP
  949. X.B \-keep
  950. X(.keepPosition)
  951. XSets a flag to indicate that \fIxdvi\fR should not move to the home position
  952. Xwhen moving to a new page.  See also the `k' keystroke.
  953. X#ifbuttons
  954. X.TP
  955. X.B \-expert
  956. X(.expert)
  957. XPrevent the buttons from appearing.  See also the `x' keystroke.
  958. X#endif
  959. X.TP
  960. X.BI \-margins " dimen"
  961. X(%%dot%%Margin)
  962. XSpecifies the size of both the top margin and side margin.
  963. XThis should be a decimal number optionally followed by "cm", e.g., 1.5 or 3cm,
  964. Xgiving a measurement in inches or centimeters.  It determines
  965. Xthe ``home'' position of the page within the window as follows.  If the entire
  966. Xpage fits in the window, then the margin settings are ignored.  If, even
  967. Xafter removing the margins from the left, right, top, and bottom, the page
  968. Xstill cannot fit in the window, then the page is put in the window such that
  969. Xthe top and left margins are hidden, and presumably the upper left-hand corner
  970. Xof the text on the page will be in the upper left-hand corner of the window.
  971. XOtherwise, the text is centered in the window.  See also `\fBM\fR' under
  972. Xthe KEY\%STROKES section.
  973. X.TP
  974. X.BI \-sidemargin " dimen"
  975. X(%%dot%%sideMargin)
  976. XSpecifies the side margin (see above).
  977. X.TP
  978. X.BI \-topmargin " dimen"
  979. X(%%dot%%topMargin)
  980. XSpecifies the top and bottom margins (see above).
  981. X.TP
  982. X.BI \-offsets " dimen"
  983. X(%%dot%%Offset)
  984. XSpecifies the size of both the horizontal and vertical offsets of the
  985. Xoutput on the page.  This should be a decimal number optionally followed by
  986. X"cm", e.g., 1.5 or 3cm, giving a measurement in inches or centimeters.
  987. XBy decree
  988. Xof the Stanford TeX Project, the default TeX page origin is always 1 inch
  989. Xover and down from the top-left page corner, even when non-American paper
  990. Xsizes are used.  Therefore, the default offsets are 1.0 inch.
  991. X.TP
  992. X.BI \-xoffset " dimen"
  993. X(%%dot%%xOffset)
  994. XSpecifies the size of the horizontal offset of the output on the page
  995. X(see above).
  996. X.TP
  997. X.BI \-yoffset " dimen"
  998. X(%%dot%%yOffset)
  999. XSpecifies the size of the vertical offset of the output on the page
  1000. X(see above).
  1001. X.TP
  1002. X.BI \-paper " papertype"
  1003. X(%%dot%%paper)
  1004. XSpecifies the size of the printed page.  This may be of the form
  1005. X\fIw\fRx\fIh\fR (or \fIw\fRx\fIh\fRcm), where \fIw\fR is the width in
  1006. Xinches (or cm) and \fIh\fR is the height in inches (or cm), respectively.
  1007. XThere are also synonyms which may be used:  us (8.5x11), usr (11x8.5),
  1008. Xlegal (8.5x14), foolscap (13.5x17), as well as the ISO sizes a1-a7,
  1009. Xb1-b7, c1-c7, a1r-a7r (a1-a7 rotated), etc.  The default size is
  1010. X%%defaultpagesize%%.
  1011. X.TP
  1012. X#ifx11
  1013. X.BI "\-mgs[n]" " size"
  1014. X(.magnifierSize[n])
  1015. XSpecifies the size of the window to be used for the ``magnifying glass''
  1016. Xfor Button \fIn\fR.  See the MOUSE ACTIONS section.  Defaults are 200,
  1017. X350, 600, 900, and 1200.
  1018. X.TP
  1019. X.BI \-mgs " size"
  1020. XSame as \fB-mgs1\fR.
  1021. X#ifx10
  1022. X.BI \-mgs " size"
  1023. X(magnifierSize1)
  1024. XSpecifies the size of the window to be used for the ``magnifying glass''
  1025. Xfor the left button.  See the MOUSE ACTIONS section.  Default is 200.
  1026. X.TP
  1027. X.BI \-mgs1 " size"
  1028. XSame as \fB-mgs\fR.
  1029. X.TP
  1030. X.BI \-mgs2 " size"
  1031. X(magnifierSize2)
  1032. XSpecifies the ``magnifying glass'' size for the middle
  1033. Xbutton.  Default is 350.
  1034. X.TP
  1035. X.BI \-mgs3 " size"
  1036. X(magnifierSize3)
  1037. XSpecifies the ``magnifying glass'' size for the right
  1038. Xbutton.  Default is 600.
  1039. X#endif
  1040. X.TP
  1041. X#ifx11
  1042. X.BI \-geometry " geometry"
  1043. X(*geometry)
  1044. XSpecifies the initial geometry of the window.
  1045. X.TP
  1046. X.BI \-icongeometry " geometry
  1047. X(%%dot%%iconGeometry)
  1048. XSpecifies the initial position for the icon.
  1049. X.TP
  1050. X.B \-iconic
  1051. X(%%dot%%iconic)
  1052. XCauses the XDVI window to start in the iconic state.  The default is to
  1053. Xstart with the window open.
  1054. X#ifx10
  1055. X.BI = geometry
  1056. X(geometry)
  1057. XSpecifies the initial geometry of the window.
  1058. X.TP
  1059. X.BI \-geometry " geometry"
  1060. XSame as above.
  1061. X#endif
  1062. X.TP
  1063. X.BI \-display " host:display"
  1064. XSpecifies the host and screen to be used for displaying the dvi file.
  1065. XThis is normally obtained from the environment variable ``DISPLAY.''
  1066. X.SH KEYSTROKES
  1067. X\fBXdvi\fR recognizes the following keystrokes when typed in its window.
  1068. XEach may optionally be preceded by a (positive or negative) number, whose
  1069. Xinterpretation will depend on the particular keystroke.
  1070. X#ifx11
  1071. XAlso, the "Home", "Prior", "Next", and arrow cursor keys are synonyms for
  1072. X`^', `b', `f', `l', `r', `u', and `d' keys, respectively.
  1073. X#endif
  1074. X.TP
  1075. X.B q
  1076. XQuits the program.  Control-C and control-D will do this, too.
  1077. X.TP
  1078. X.B n
  1079. XMoves to the next page (or to the \fBn\fRth next page if a number is given).
  1080. XSynonyms are `\fBf\fR', Space, Return, and Line Feed.
  1081. X.TP
  1082. X.B p
  1083. XMoves to the previous page (or back \fBn\fR pages).  Synonyms are
  1084. X`\fBb\fR', control-H, and Delete.
  1085. X.TP
  1086. X.B g
  1087. XMoves to the page with the given number.  Initially, the first page is assumed
  1088. Xto be page number 1, but this can be changed with the `\fBP\fR' keystroke,
  1089. Xbelow.  If no page number is given, then it goes to the last page.
  1090. X.TP
  1091. X.B P
  1092. X``This is page number \fBn\fR.''  This can be used to make the `\fBg\fR'
  1093. Xkeystroke refer to actual page numbers instead of absolute page numbers.
  1094. X.TP
  1095. X.B Control-L
  1096. XRedisplays the current page.
  1097. X.TP
  1098. X.B ^
  1099. XMove to the ``home'' position of the page.  This is normally the upper
  1100. Xleft-hand corner of the page, depending on the margins as described in
  1101. Xthe \-\fBmargins\fR option, above.
  1102. X.TP
  1103. X.B u
  1104. XMoves up two thirds of a window-full.
  1105. X.TP
  1106. X.B d
  1107. XMoves down two thirds of a window-full.
  1108. X.TP
  1109. X.B l
  1110. XMoves left two thirds of a window-full.
  1111. X.TP
  1112. X.B r
  1113. XMoves right two thirds of a window-full.
  1114. X.TP
  1115. X.B c
  1116. XMoves the page so that the point currently beneath the cursor is moved to
  1117. Xthe middle of the window.  It also (gasp!) warps the cursor to the same place.
  1118. X.TP
  1119. X.B M
  1120. XSets the margins so that the point currently under the cursor is the upper
  1121. Xleft-hand corner of the text in the page.  Note that this command itself does
  1122. Xnot move the image at all.  For details on how the margins are used, see
  1123. Xthe \-\fBmargins\fR option.
  1124. X.TP
  1125. X.B s
  1126. XChanges the shrink factor to the given number.  If no number is given, the
  1127. Xsmallest factor that makes the entire page fit in the window will be used.
  1128. X(Margins are ignored in this computation.)
  1129. X.TP
  1130. X.B S
  1131. XSets the density factor to be used when shrinking bitmaps.  This should
  1132. Xbe a number between 0 and 100; higher numbers produce lighter characters.
  1133. X.TP
  1134. X.B R
  1135. XForces the dvi file to be reread.  This allows you to preview many versions
  1136. Xof the same file while running \fIxdvi\fR only once.
  1137. X.TP
  1138. X.B k
  1139. XNormally when \fIxdvi\fR switches pages, it moves to the home position as well.
  1140. XThe `k' keystroke toggles a `keep-position' flag which, when set, will keep
  1141. Xthe same position when moving between pages.  Also `0k' and `1k' clear and
  1142. Xset this flag, respectively.  See also the \fB\-keep\fR option.
  1143. X#ifbuttons
  1144. X.TP
  1145. X.B x
  1146. XToggles expert mode (in which the buttons do not appear).  Also `0x' and `1x'
  1147. Xclear and reset this mode, respectively.  See also the \fB\-expert\fR option.
  1148. X#endif
  1149. X.SH MOUSE ACTIONS
  1150. XIf the shrink factor is set to any number other than one, then clicking
  1151. Xany mouse button will pop up a ``magnifying glass'' which shows the unshrunk
  1152. Ximage in the vicinity of the mouse click.  This subwindow disappears when
  1153. Xthe mouse button is released.  Different mouse buttons produce different sized
  1154. Xwindows, as indicated by the \fB\-mgs\fR option.  Moving the cursor
  1155. Xwhile holding the button down will move the magnifying glass.
  1156. X.PP
  1157. XAlso, the scrollbars (if present) behave in the standard way:  pushing Button 2
  1158. Xin a scrollbar moves the top or left edge of the scrollbar to that point
  1159. Xand optionally drags it;
  1160. Xpushing Button 1 moves the image up or right by an amount equal to the distance
  1161. Xfrom the button press to the upper left-hand corner of the window; pushing
  1162. XButton 3 moves the image down or left by the same amount.
  1163. X.SH ENVIRONMENT
  1164. XUses the environment variable ``DISPLAY'' to specify which bit map display
  1165. Xterminal to use.
  1166. X.PP
  1167. XThe environment variable ``XDVIFONTS'' determines the path(s) searched for
  1168. Xfonts in the following manner.  The string consists of one or more strings
  1169. Xseparated by colons.  In each such string, the substring ``%f'' is
  1170. Xchanged to the font name; ``%d'' is changed to the magnification; and
  1171. X``%p'' is changed to the font family (``gf'', ``pk'', or ``pxl'').  If no
  1172. X``%f'' appears in the string, then the string ``/%f.%d%p'' is added on
  1173. Xthe end.  For example, if the string is ``/usr/local/tex/fonts'' and the font is
  1174. Xcmr10 at 300dpi, then it searches for /usr/local/tex/fonts/cmr10.300gf,
  1175. X/usr/local/tex/fonts/cmr10.300pk, and /usr/local/tex/fonts/cmr10.1500pxl,
  1176. Xin that order.  An extra colon anywhere in the ``XDVIFONTS'' variable
  1177. Xcauses the system default paths to be tried at that point.  If the font is not
  1178. Xfound in the desired size, then \fIxdvi\fR will try to find the nearest size.
  1179. XIf the font cannot be found at all, then \fIxdvi\fR will try to vary the point
  1180. Xsize of the font (within a certain range), and if this fails, then it will
  1181. Xuse the font specified as the alternate font (cf. \fB-altfont\fR).
  1182. X#iftexfonts
  1183. X.PP
  1184. XFor compatibility with TeX, you may also use ``TEXFONTS'' in place of
  1185. X``XDVIFONTS'', although in that case the variable should not include
  1186. Xany ``%'' specifiers.  The reason for recognizing TEXFONTS is that
  1187. Xcertain versions of TeX also support the convention regarding an extra
  1188. Xcolon in the font path; therefore, users who create their own fonts can
  1189. Xput both their .tfm and raster files in the same directory and do
  1190. X``setenv TEXFONTS :MFdir'' or ``setenv TEXFONTS MFdir:'' in order to
  1191. Xget both TeX and \fIxdvi\fR to search their directory in addition to
  1192. Xthe system standard directories.  The XDVIFONTS variable overrides the
  1193. XTEXFONTS variable, so that on those sites where TEXFONTS must be set
  1194. Xexplicitly, and therefore this feature is not useful, the XDVIFONTS may
  1195. Xbe set to an empty string (\fIi.e.,\fR ``setenv XDVIFONTS'') to cause
  1196. X\fIxdvi\fR to ignore TEXFONTS.
  1197. X#endif
  1198. X#ifsubdir
  1199. X.PP
  1200. XYou can also enable recursive searching in the font path by using the ``*''
  1201. Xand ``**'' specifiers.  At this point in the path, \fIxdvi\fR will recursively
  1202. Xsearch subdirectories of the given directory in order to find font files.
  1203. XA single asterisk limits the search to one level; a double asterisk will search
  1204. Xthrough an arbitrary number of levels.  Also, the variable TEXFONTS_SUBDIR
  1205. Xcan be used to give a colon-separated list of directories to recursively search.
  1206. XThis is equivalent to including the specifiers with a ``*'' after each; the
  1207. Xusual conventions regarding extra colons applies here, too, relative to a
  1208. Xdefault subdirectory path.  Asterisks may not be preceded by a ``%'' specifier
  1209. Xin any path component.
  1210. X#endif
  1211. X.PP
  1212. XThe ``XDVISIZES'' variable must be set to indicate which sizes of fonts are
  1213. Xavailable.  It should consist of a list of numbers separated by colons.  If
  1214. Xthe list begins with a colon, the system default sizes are used, as well.
  1215. XSizes are expressed in dots per inch; decimals may be used for ``pxl'' files:
  1216. Xfor example, a 300 dots per inch file magnified by half a step comes out to
  1217. X1643 dots per five inches, which should be encoded as 328.6.  The current
  1218. Xdefault set of sizes is %%DEFAULT_FONT_SIZES%%.  \fIxdvi\fR will also try the
  1219. Xactual size of the font before trying any of the given sizes.
  1220. X.PP
  1221. XVirtual fonts are also supported, although \fIxdvi\fR does not have any
  1222. Xbuilt-in fonts to which they can refer.  The search path for .vf files
  1223. Xcan be specified with the ``XDVIVFS'' environment variable in a similar
  1224. Xmanner to that for the ``XDVIFONTS'' variable.  Virtual fonts are searched
  1225. Xfor immediately after looking for the font as a normal font in the exact size
  1226. Xspecified.
  1227. X.SH FILES
  1228. X.br
  1229. X%%DEFAULT_FONT_PATH%%   Font pixel files.
  1230. X%%DEFAULT_VF_PATH%%   Virtual font files.
  1231. X.SH "SEE ALSO"
  1232. XX(1).
  1233. X.SH AUTHORS
  1234. XEric Cooper, CMU, did a version for direct output to a QVSS.
  1235. XModified for X by
  1236. XBob Scheifler, MIT Laboratory for Computer Science.
  1237. XModified for X11 by Mark Eichin, MIT SIPB.
  1238. XAdditional enhancements by many others.
  1239. END_OF_FILE
  1240. if test 17227 -ne `wc -c <'xdvi_man.sed'`; then
  1241.     echo shar: \"'xdvi_man.sed'\" unpacked with wrong size!
  1242. fi
  1243. # end of 'xdvi_man.sed'
  1244. fi
  1245. echo shar: End of shell archive.
  1246. exit 0
  1247. -- 
  1248. --
  1249. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1250. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1251. Sunnyvale, California 94086            at&t: 408/522-9236
  1252.