Annotation of OpenXM_contrib/gnuplot/term/metafont.trm, Revision 1.1
1.1 ! maekawa 1: /*
! 2: * $Id: metafont.trm,v 1.14 1998/04/14 00:17:54 drd Exp $
! 3: */
! 4:
! 5: /* GNUPLOT - metafont.trm */
! 6:
! 7: /*[
! 8: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
! 9: *
! 10: * Permission to use, copy, and distribute this software and its
! 11: * documentation for any purpose with or without fee is hereby granted,
! 12: * provided that the above copyright notice appear in all copies and
! 13: * that both that copyright notice and this permission notice appear
! 14: * in supporting documentation.
! 15: *
! 16: * Permission to modify the software is granted, but not the right to
! 17: * distribute the complete modified source code. Modifications are to
! 18: * be distributed as patches to the released version. Permission to
! 19: * distribute binaries produced by compiling modified sources is granted,
! 20: * provided you
! 21: * 1. distribute the corresponding source modifications from the
! 22: * released version in the form of a patch file along with the binaries,
! 23: * 2. add special version identification to distinguish your version
! 24: * in addition to the base release version number,
! 25: * 3. provide your name and address as the primary contact for the
! 26: * support of your modified version, and
! 27: * 4. retain our contact information in regard to use of the base
! 28: * software.
! 29: * Permission to distribute the released version of the source code along
! 30: * with corresponding source modifications in the form of a patch file is
! 31: * granted with same provisions 2 through 4 for binary distributions.
! 32: *
! 33: * This software is provided "as is" without express or implied warranty
! 34: * to the extent permitted by applicable law.
! 35: ]*/
! 36:
! 37: /*
! 38: * GNUPLOT -- mf.trm
! 39: *
! 40: * This terminal driver supports:
! 41: * Metafont Plot Commands
! 42: *
! 43: * Written by : Pl Hedne
! 44: * Trondheim, Norway
! 45: * Pal.Hedne@termo.unit.no
! 46: */
! 47:
! 48: /*
! 49: * Improvements and bug fixes by Carsten Steger:
! 50: * - Set default plot size to 5 by 3 inches as in the latex- and eepic-
! 51: * drivers
! 52: * - Fixed some bugs concerning resolution dependent output
! 53: * - Added MF_scale function
! 54: * - Added MF_justify_text function and modified MF_put_text function and
! 55: * put_text macro accordingly
! 56: * - Modified MF_move and MF_vector to make output shorter and modified
! 57: * MF_text accordingly
! 58: * - Added various linetypes by plotting dashed lines; had to modify
! 59: * MF_linetype and MF_vector for this
! 60: * - Added MF_arrow function
! 61: * - All global variables and #define'd names begin with MF_ now
! 62: * As a consequence almost nothing of the original code by Pl Hedne remains
! 63: * but credit goes to him for the ingenious trick of storing the character
! 64: * images into picture variables, without which this driver would have been
! 65: * impossible for me to write.
! 66: *
! 67: * 10/03/95: Converted to new terminal layout by Carsten Steger.
! 68: */
! 69:
! 70: #include "driver.h"
! 71:
! 72: #ifdef TERM_REGISTER
! 73: register_term(mf)
! 74: #endif
! 75:
! 76: #ifdef TERM_PROTO
! 77:
! 78: #define MF_DPI (300)
! 79: /* resolution of printer we expect to use; the value itself is not
! 80: * particularly important... it is here only for compatibility to the
! 81: * LaTeX-driver and to get the spacing right. */
! 82:
! 83: /* 5 inches wide by 3 inches high (default) */
! 84: #define MF_XSIZE 5.0
! 85: #define MF_YSIZE 3.0
! 86: #define MF_XMAX (MF_XSIZE*MF_DPI)
! 87: #define MF_YMAX (MF_YSIZE*MF_DPI)
! 88:
! 89: #define MF_HTIC (5*MF_DPI/72)
! 90: #define MF_VTIC (5*MF_DPI/72)
! 91: #define MF_HCHAR (MF_DPI*53/10/72)
! 92: #define MF_VCHAR (MF_DPI*11/72)
! 93:
! 94: TERM_PUBLIC void MF_init __PROTO((void));
! 95: TERM_PUBLIC void MF_graphics __PROTO((void));
! 96: TERM_PUBLIC void MF_text __PROTO((void));
! 97: TERM_PUBLIC int MF_justify_text __PROTO((enum JUSTIFY mode));
! 98: TERM_PUBLIC int MF_text_angle __PROTO((int ang));
! 99: TERM_PUBLIC void MF_linetype __PROTO((int linetype));
! 100: TERM_PUBLIC void MF_move __PROTO((unsigned int x, unsigned int y));
! 101: TERM_PUBLIC void MF_vector __PROTO((unsigned int x, unsigned int y));
! 102: TERM_PUBLIC void MF_arrow __PROTO((unsigned int sx, unsigned int sy,
! 103: unsigned int ex, unsigned int ey,
! 104: TBOOLEAN head));
! 105: TERM_PUBLIC void MF_put_text __PROTO((unsigned int x, unsigned int y, char *str));
! 106: TERM_PUBLIC void MF_reset __PROTO((void));
! 107:
! 108: #define GOT_MF_PROTO
! 109:
! 110: #endif /* TERM_PROTO */
! 111:
! 112:
! 113: #ifndef TERM_PROTO_ONLY
! 114:
! 115: #ifdef TERM_BODY
! 116:
! 117:
! 118: /* Plot size in inches */
! 119: static double MF_xsize = MF_XSIZE;
! 120: static double MF_ysize = MF_YSIZE;
! 121: static int MF_char_code;
! 122: static int MF_ang;
! 123: static int MF_line_type;
! 124: static enum JUSTIFY MF_justify;
! 125: static double MF_dist_left;
! 126: static int MF_is_solid;
! 127: static int MF_picked_up_pen;
! 128: /*
! 129: * We keep track of where we are with respect to dashed lines by using
! 130: * the next five variables. MF_dash_index indicates which element of
! 131: * MF_lines[..].dashlen should be used. The MF_last.. variables keep
! 132: * track of the position of the pen.
! 133: */
! 134: static int MF_dash_index;
! 135: static unsigned int MF_last_x, MF_last_y;
! 136:
! 137: static struct {
! 138: int solid; /* Is the line solid? */
! 139: float thickness; /* Thickness of pen we are going to use */
! 140: int dashlen[4]; /* Length of individual segments; even: line; odd: gap */
! 141: } MF_lines[10] =
! 142: {
! 143: {
! 144: 1, 1.5, { 0, 0, 0, 0 }
! 145: },
! 146: {
! 147: 0, 1.0, { MF_DPI / 60, MF_DPI / 50, MF_DPI / 60, MF_DPI / 50 }
! 148: },
! 149: {
! 150: 1, 1.5, { 0, 0, 0, 0 }
! 151: },
! 152: {
! 153: 0, 1.5, { MF_DPI / 20, MF_DPI / 30, MF_DPI / 20, MF_DPI / 30 }
! 154: },
! 155: {
! 156: 0, 1.5, { MF_DPI / 30, MF_DPI / 20, MF_DPI / 30, MF_DPI / 20 }
! 157: },
! 158: {
! 159: 0, 1.5, { MF_DPI / 15, MF_DPI / 30, MF_DPI / 60, MF_DPI / 30 }
! 160: },
! 161: {
! 162: 0, 1.5, { MF_DPI / 30, MF_DPI / 50, MF_DPI / 30, MF_DPI / 50 }
! 163: },
! 164: {
! 165: 0, 1.5, { MF_DPI / 20, MF_DPI / 50, MF_DPI / 60, MF_DPI / 30 }
! 166: },
! 167: {
! 168: 0, 1.5, { MF_DPI / 30, MF_DPI / 50, MF_DPI / 30, MF_DPI / 30 }
! 169: },
! 170: {
! 171: 0, 1.5, { MF_DPI / 60, MF_DPI / 50, MF_DPI / 60, MF_DPI / 30 }
! 172: }
! 173: /* dash: line, gap, line, gap */
! 174: };
! 175:
! 176:
! 177:
! 178: TERM_PUBLIC void MF_init()
! 179: {
! 180: MF_char_code = 0;
! 181: MF_ang = 0;
! 182:
! 183: fputs("\
! 184: if unknown cmbase: input cmbase fi\n\n\
! 185: tracingstats:=1;\n\
! 186: picture r[];\n\
! 187: \ndef openit = openwindow currentwindow\n\
! 188: from (0,0) to (400,800) at (-50,500) enddef;\n\
! 189: \nmode_setup;\n", gpoutfile);
! 190:
! 191: fputs("\
! 192: \n%Include next eight lines if you have problems with the mode on your system..\n\
! 193: %proofing:=0;\n\
! 194: %fontmaking:=1;\n\
! 195: %tracingtitles:=0;\n\
! 196: %pixels_per_inch:=300;\n\
! 197: %blacker:=0;\n\
! 198: %fillin:=.2;\n\
! 199: %o_correction:=.6;\n\
! 200: %fix_units;\n", gpoutfile);
! 201:
! 202: /* Next lines must be included if text support is needed (CM base used) */
! 203: fputs("\
! 204: \ndef put_text(expr ts,xstart,ystart,rot,justification) =\n\
! 205: begingroup\n\
! 206: text_width:=0;text_height:=0;\n\
! 207: for ind:=0 step 1 until length(ts)-1:\n\
! 208: dec_num:=ASCII substring (ind,ind+1) of ts;\n\
! 209: if unknown r[dec_num]: dec_num:=32; fi\n\
! 210: if dec_num=32: \n\
! 211: text_width:=text_width+wd[65];\n\
! 212: text_height:=GPMAX(text_height,ht[65]+dp[65]);\n\
! 213: elseif dec_num>=0: \n\
! 214: text_width:=text_width+wd[dec_num];\n\
! 215: text_height:=GPMAX(text_height,ht[dec_num]+dp[dec_num]);\n\
! 216: fi\n\
! 217: endfor\n\
! 218: if rot=90:\n\
! 219: if justification=1: ynext:=ystart;\n\
! 220: elseif justification=2: ynext:=round(ystart-text_width/2);\n\
! 221: else: ynext:=round(ystart-text_width);\n\
! 222: fi\n\
! 223: xnext:=xstart+text_height/2;\n\
! 224: else:\n\
! 225: if justification=1: xnext:=xstart;\n\
! 226: elseif justification=2: xnext:=round(xstart-text_width/2);\n\
! 227: else: xnext:=round(xstart-text_width);\n\
! 228: fi\n\
! 229: ynext:=ystart-text_height/2;\n\
! 230: fi\n\
! 231: for ind:=0 step 1 until length(ts)-1:\n\
! 232: dec_num:=ASCII substring (ind,ind+1) of ts;\n\
! 233: if unknown r[dec_num]: dec_num:=32; fi\n\
! 234: if dec_num=32: \n\
! 235: xnext:=xnext+wd[65]*cosd rot;\n\
! 236: ynext:=ynext+wd[65]*sind rot;\n\
! 237: elseif dec_num>=0: \n\
! 238: currentpicture:=currentpicture+r[dec_num] shifted(xnext,ynext)\n\
! 239: rotatedaround ((xnext,ynext),rot); \n\
! 240: xnext:=xnext+wd[dec_num]*cosd rot;\n\
! 241: ynext:=ynext+wd[dec_num]*sind rot;\n\
! 242: fi\n\
! 243: endfor\n\
! 244: endgroup \n\
! 245: enddef;\n", gpoutfile);
! 246:
! 247: fputs("\
! 248: \ndef endchar =\n\
! 249: r[charcode]:=currentpicture;\n\
! 250: wd[charcode]:=w;ht[charcode]:=h;dp[charcode]:=d;\n\
! 251: message \"Picture of charcode no.\" & decimal charcode;\n\
! 252: endgroup;\n\
! 253: enddef;\n\
! 254: let endchar_ = endchar;\n\
! 255: let generate = relax;\n\
! 256: let roman = relax;\n", gpoutfile);
! 257:
! 258: fputs("\
! 259: input cmr10.mf\n\
! 260: if ligs>1: font_coding_scheme:=\"TeX text\";\n\
! 261: spanish_shriek=oct\"074\"; spanish_query=oct\"076\";\n\
! 262: else: font_coding_scheme:=\n\
! 263: if ligs=0: \"TeX typewriter text\"\n\
! 264: else: \"TeX text without f-ligatures\" fi;\n\
! 265: spanish_shriek=oct\"016\"; spanish_query=oct\"017\"; fi\n\
! 266: font_setup;\n\
! 267: input romanu.mf %Roman uppercase.\n\
! 268: input romanl.mf %Roman lowerrcase.\n\
! 269: input greeku.mf %Greek uppercase.\n\
! 270: input romand.mf %Numerals.\n\
! 271: input romanp.mf %Ampersand, question marks, currency sign.\n\
! 272: input romspl.mf %Lowercase specials (dotless \\i, ligature \\ae, etc.)\n\
! 273: input romspu.mf %Uppercase specials (\\AE, \\OE, \\O)\n\
! 274: input punct.mf %Punctuation symbols.\n\
! 275: \nminus=ASCII\"-\"; cmchar \"Minus sign\";\n\
! 276: beginarithchar(minus); \n\
! 277: pickup rule.nib;\n\
! 278: lft x1=hround 1.5u-eps;\n\
! 279: x2=w-x1; y1=y2=math_axis;\n\
! 280: draw z1--z2; % bar\n\
! 281: labels(1,2); \n\
! 282: endchar;\n", gpoutfile);
! 283:
! 284: fputs("\
! 285: \ncmchar \"Period\";\n\
! 286: numeric dot_diam#; dot_diam#:=if monospace: 5/4 fi\\ dot_size#;\n\
! 287: define_whole_blacker_pixels(dot_diam);\n\
! 288: beginchar(\".\",5u#,dot_diam#,0);\n\
! 289: adjust_fit(0,0); pickup fine.nib;\n\
! 290: pos1(dot_diam,0); pos2(dot_diam,90);\n\
! 291: lft x1l=hround(.5w-.5dot_diam); bot y2l=0; z1=z2; dot(1,2); % dot\n\
! 292: penlabels(1,2);\n\
! 293: endchar;\n", gpoutfile);
! 294:
! 295: fputs("\
! 296: \ndef endchar =\n\
! 297: % Next line should probably be removed if CM base is used\n\
! 298: l:=0; r:=w;\n\
! 299: %Include the next two lines if you want to\n\
! 300: %rotate the picture 90 deg.(Portrait to Landscape)\n\
! 301: %currentpicture:=currentpicture rotated 90 shifted (h,0);\n\
! 302: %tmp:=charht; charht:=charwd; charwd:=tmp;\n\
! 303: scantokens extra_endchar;\n\
! 304: if proofing>0: makebox(proofrule); fi\n\
! 305: chardx:=w;\n\
! 306: shipit;\n\
! 307: if displaying>0: makebox(screenrule); showit; fi\n\
! 308: endgroup \n\
! 309: enddef;\n\
! 310: let endchar_ = endchar;\n\
! 311: let generate = input;\n\
! 312: let roman = roman;\n", gpoutfile);
! 313:
! 314: /* font_size must be bigger than em#/16 by METAFONT rules.
! 315: * Therefore make it pretty big so big figures will be
! 316: * handled correctly. Setting font_size to 72pt# lets us
! 317: * handle characters up to 15.94 by 15.94 inches. */
! 318: fputs("\
! 319: \n\nfont_identifier:=\"GNUPLOT\";\n\
! 320: font_size 72pt#;\n\
! 321: th#=0.4pt#; define_whole_pixels(th);\n\
! 322: \npath arrowhead;\n\
! 323: arrowhead = (-7pt,-2pt){dir30}..(-6pt,0pt)..\
! 324: {dir150}(-7pt,2pt) &\n\
! 325: (-7pt,2pt)--(0pt,0pt)--(-7pt,-2pt) & cycle;\n", gpoutfile);
! 326: }
! 327:
! 328:
! 329: TERM_PUBLIC void MF_graphics()
! 330: {
! 331: register struct termentry *t = term;
! 332:
! 333: fprintf(gpoutfile, "\n\nbeginchar(%d,%gin#,%gin#,0);\n",
! 334: MF_char_code, MF_xsize, MF_ysize);
! 335: MF_char_code++;
! 336: fprintf(gpoutfile, "a:=w/%d;b:=h/%d;\n", t->xmax, t->ymax);
! 337: MF_picked_up_pen = 0;
! 338: }
! 339:
! 340:
! 341: TERM_PUBLIC void MF_text()
! 342: {
! 343: fputs("endchar;\n", gpoutfile);
! 344: }
! 345:
! 346:
! 347: TERM_PUBLIC int MF_justify_text(mode)
! 348: enum JUSTIFY mode;
! 349: {
! 350: MF_justify = mode;
! 351: return TRUE;
! 352: }
! 353:
! 354:
! 355: TERM_PUBLIC int MF_text_angle(ang)
! 356: int ang;
! 357: {
! 358: if (ang > 0)
! 359: MF_ang = 90;
! 360: else
! 361: MF_ang = 0;
! 362: return TRUE;
! 363: }
! 364:
! 365:
! 366: TERM_PUBLIC void MF_linetype(linetype)
! 367: int linetype;
! 368: {
! 369: if (linetype >= 8)
! 370: linetype %= 8;
! 371: linetype += 2;
! 372: /* Only output change in pens if it actually affects the pen used */
! 373: if ((MF_lines[linetype].thickness != MF_lines[MF_line_type].thickness) ||
! 374: (!MF_picked_up_pen)) {
! 375: fprintf(gpoutfile, "pickup pencircle scaled %gth;\n",
! 376: MF_lines[linetype].thickness);
! 377: MF_picked_up_pen = 1;
! 378: }
! 379: MF_line_type = linetype;
! 380: MF_dash_index = 0;
! 381: MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
! 382: MF_is_solid = MF_lines[MF_line_type].solid;
! 383: }
! 384:
! 385:
! 386: TERM_PUBLIC void MF_move(x, y)
! 387: unsigned int x, y;
! 388: {
! 389: MF_last_x = x;
! 390: MF_last_y = y;
! 391: MF_dash_index = 0;
! 392: MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
! 393: }
! 394:
! 395:
! 396: TERM_PUBLIC void MF_vector(x, y)
! 397: unsigned int x, y;
! 398: {
! 399: if (MF_is_solid) {
! 400: if (x == MF_last_x && y == MF_last_y)
! 401: fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
! 402: else
! 403: fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
! 404: MF_last_x, MF_last_y, x, y);
! 405: } else {
! 406: double dist_to_go, delta_x, delta_y, inc_x, inc_y;
! 407: double last_x_d, last_y_d, next_x_d, next_y_d;
! 408: unsigned int next_x, next_y;
! 409:
! 410: if (x == MF_last_x && y == MF_last_y) {
! 411: if (!(MF_dash_index & 1))
! 412: fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
! 413: } else {
! 414: last_x_d = MF_last_x;
! 415: last_y_d = MF_last_y;
! 416: delta_x = x - last_x_d;
! 417: delta_y = y - last_y_d;
! 418: dist_to_go = sqrt(delta_x * delta_x + delta_y * delta_y);
! 419: inc_x = delta_x / dist_to_go;
! 420: inc_y = delta_y / dist_to_go;
! 421: while (MF_dist_left < dist_to_go) {
! 422: next_x_d = last_x_d + inc_x * MF_dist_left;
! 423: next_y_d = last_y_d + inc_y * MF_dist_left;
! 424: next_x = floor(next_x_d + 0.5);
! 425: next_y = floor(next_y_d + 0.5);
! 426: /* MF_dash_index & 1 == 0 means: draw a line; otherwise just move */
! 427: if (!(MF_dash_index & 1))
! 428: fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
! 429: MF_last_x, MF_last_y, next_x, next_y);
! 430: MF_last_x = next_x;
! 431: MF_last_y = next_y;
! 432: last_x_d = next_x_d;
! 433: last_y_d = next_y_d;
! 434: dist_to_go -= MF_dist_left;
! 435: MF_dash_index = (MF_dash_index + 1) & 3;
! 436: MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
! 437: }
! 438: delta_x = x - last_x_d;
! 439: delta_y = y - last_y_d;
! 440: MF_dist_left -= sqrt(delta_x * delta_x + delta_y * delta_y);
! 441: if (!(MF_dash_index & 1)) {
! 442: if (x == MF_last_x && y == MF_last_y)
! 443: fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
! 444: else
! 445: fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
! 446: MF_last_x, MF_last_y, x, y);
! 447: }
! 448: }
! 449: }
! 450: MF_last_x = x;
! 451: MF_last_y = y;
! 452: }
! 453:
! 454:
! 455: TERM_PUBLIC void MF_arrow(sx, sy, ex, ey, head)
! 456: unsigned int sx, sy, ex, ey;
! 457: TBOOLEAN head;
! 458: {
! 459: int delta_x, delta_y;
! 460:
! 461: MF_move(sx, sy);
! 462: MF_vector(ex, ey);
! 463: if (head) {
! 464: delta_x = ex - sx;
! 465: delta_y = ey - sy;
! 466: fprintf(gpoutfile, "fill arrowhead rotated angle(%d,%d) shifted (%da,%db);\n",
! 467: delta_x, delta_y, ex, ey);
! 468: }
! 469: }
! 470:
! 471:
! 472: TERM_PUBLIC void MF_put_text(x, y, str)
! 473: unsigned int x, y;
! 474: char *str;
! 475: {
! 476: int i, j = 0;
! 477:
! 478: for (i = 0; i < strlen(str); i++)
! 479: if (str[i] == '"')
! 480: str[i] = '\''; /* Replace " with ' */
! 481: switch (MF_justify) {
! 482: case LEFT:
! 483: j = 1;
! 484: break;
! 485: case CENTRE:
! 486: j = 2;
! 487: break;
! 488: case RIGHT:
! 489: j = 3;
! 490: break;
! 491: }
! 492: fprintf(gpoutfile, "put_text(\"%s\",%da,%db,%d,%d);\n",
! 493: str, x, y, MF_ang, j);
! 494: }
! 495:
! 496:
! 497: TERM_PUBLIC void MF_reset()
! 498: {
! 499: fputs("end.\n", gpoutfile);
! 500: }
! 501:
! 502:
! 503: #endif /* TERM_BODY */
! 504:
! 505: #ifdef TERM_TABLE
! 506:
! 507: TERM_TABLE_START(mf_driver)
! 508: "mf", "Metafont plotting standard",
! 509: MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR,
! 510: MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset,
! 511: MF_text, null_scale, MF_graphics, MF_move, MF_vector,
! 512: MF_linetype, MF_put_text, MF_text_angle,
! 513: MF_justify_text, line_and_point, MF_arrow, set_font_null
! 514: TERM_TABLE_END(mf_driver)
! 515:
! 516: #undef LAST_TERM
! 517: #define LAST_TERM mf_driver
! 518:
! 519: #endif /* TERM_TABLE */
! 520: #endif /* TERM_PROTO_ONLY */
! 521:
! 522:
! 523: #ifdef TERM_HELP
! 524: START_HELP(mf)
! 525: "1 mf",
! 526: "?commands set terminal mf",
! 527: "?set terminal mf",
! 528: "?set term mf",
! 529: "?terminal mf",
! 530: "?term mf",
! 531: "?mf",
! 532: "?metafont",
! 533: " The `mf` terminal driver creates a input file to the METAFONT program. Thus a",
! 534: " figure may be used in the TeX document in the same way as is a character.",
! 535: "",
! 536: " To use a picture in a document, the METAFONT program must be run with the",
! 537: " output file from `gnuplot` as input. Thus, the user needs a basic knowledge",
! 538: " of the font creating process and the procedure for including a new font in a",
! 539: " document. However, if the METAFONT program is set up properly at the local",
! 540: " site, an unexperienced user could perform the operation without much trouble.",
! 541: "",
! 542: " The text support is based on a METAFONT character set. Currently the",
! 543: " Computer Modern Roman font set is input, but the user is in principal free to",
! 544: " chose whatever fonts he or she needs. The METAFONT source files for the",
! 545: " chosen font must be available. Each character is stored in a separate",
! 546: " picture variable in METAFONT. These variables may be manipulated (rotated,",
! 547: " scaled etc.) when characters are needed. The drawback is the interpretation",
! 548: " time in the METAFONT program. On some machines (i.e. PC) the limited amount",
! 549: " of memory available may also cause problems if too many pictures are stored.",
! 550: "",
! 551: " The `mf` terminal has no options.",
! 552: "2 METAFONT Instructions",
! 553: "?commands set terminal mf detailed",
! 554: "?set terminal mf detailed",
! 555: "?set term mf detailed",
! 556: "?mf detailed",
! 557: "?metafont detailed",
! 558: "",
! 559: " - Set your terminal to METAFONT:",
! 560: " set terminal mf",
! 561: " - Select an output-file, e.g.:",
! 562: " set output \"myfigures.mf\"",
! 563: " - Create your pictures. Each picture will generate a separate character. Its",
! 564: " default size will be 5*3 inches. You can change the size by saying `set size",
! 565: " 0.5,0.5` or whatever fraction of the default size you want to have.",
! 566: "",
! 567: " - Quit `gnuplot`.",
! 568: "",
! 569: " - Generate a TFM and GF file by running METAFONT on the output of `gnuplot`.",
! 570: " Since the picture is quite large (5*3 in), you will have to use a version of",
! 571: " METAFONT that has a value of at least 150000 for memmax. On Unix systems",
! 572: " these are conventionally installed under the name bigmf. For the following",
! 573: " assume that the command virmf stands for a big version of METAFONT. For",
! 574: " example:",
! 575: "",
! 576: " - Invoke METAFONT:",
! 577: " virmf '&plain'",
! 578: " - Select the output device: At the METAFONT prompt ('*') type:",
! 579: " \\mode:=CanonCX; % or whatever printer you use",
! 580: " - Optionally select a magnification:",
! 581: " mag:=1; % or whatever you wish",
! 582: " - Input the `gnuplot`-file:",
! 583: " input myfigures.mf",
! 584: " On a typical Unix machine there will usually be a script called \"mf\" that",
! 585: " executes virmf '&plain', so you probably can substitute mf for virmf &plain.",
! 586: " This will generate two files: mfput.tfm and mfput.$$$gf (where $$$ indicates",
! 587: " the resolution of your device). The above can be conveniently achieved by",
! 588: " typing everything on the command line, e.g.:",
! 589: " virmf '&plain' '\\mode:=CanonCX; mag:=1; input myfigures.mf'",
! 590: " In this case the output files will be named myfigures.tfm and",
! 591: " myfigures.300gf.",
! 592: "",
! 593: " - Generate a PK file from the GF file using gftopk:",
! 594: " gftopk myfigures.300gf myfigures.300pk",
! 595: " The name of the output file for gftopk depends on the DVI driver you use.",
! 596: " Ask your local TeX administrator about the naming conventions. Next, either",
! 597: " install the TFM and PK files in the appropriate directories, or set your",
! 598: " environment variables properly. Usually this involves setting TEXFONTS to",
! 599: " include the current directory and doing the same thing for the environment",
! 600: " variable that your DVI driver uses (no standard name here...). This step is",
! 601: " necessary so that TeX will find the font metric file and your DVI driver will",
! 602: " find the PK file.",
! 603: "",
! 604: " - To include your pictures in your document you have to tell TeX the font:",
! 605: " \\font\\gnufigs=myfigures",
! 606: " Each picture you made is stored in a single character. The first picture is",
! 607: " character 0, the second is character 1, and so on... After doing the above",
! 608: " step, you can use the pictures just like any other characters. Therefore, to",
! 609: " place pictures 1 and 2 centered in your document, all you have to do is:",
! 610: " \\centerline{\\gnufigs\\char0}",
! 611: " \\centerline{\\gnufigs\\char1}",
! 612: " in plain TeX. For LaTeX you can, of course, use the picture environment and",
! 613: " place the picture wherever you wish by using the \\makebox and \\put macros.",
! 614: "",
! 615: " This conversion saves you a lot of time once you have generated the font;",
! 616: " TeX handles the pictures as characters and uses minimal time to place them,",
! 617: " and the documents you make change more often than the pictures do. It also",
! 618: " saves a lot of TeX memory. One last advantage of using the METAFONT driver",
! 619: " is that the DVI file really remains device independent, because no \\special",
! 620: " commands are used as in the eepic and tpic drivers."
! 621: END_HELP(mf)
! 622: #endif /* TERM_HELP */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>