If you have xfig(1) installed, you will find that calling fig2dev(1) allows you to generate many output formats from a single file, including LaTex and encapsulated PostScript.

xfig(1) is an X11 Windows application that can be used to interactively edit figures. The HELP utility of xfig(1) provides a description of the xfig(1) file format (as well as a user guide and many other documents). A copy of the format is retained here for reference ( XFig Version 3_2_4 file format) ; but I would recommend having xfig installed to help resolve some of the details.

Unfortunately, the manual indicates the user defined colors must be defined before any other Fig objects. By default, 16 colors are defined; if undefined colors are used they are assigned a dash pattern or a fill pattern to help distinguish them. Use of hardware dash and VOGLE software dash could get confusing. Might turn this off. I don't use any of the predefined xfig(1) colors.

Also, all lines are drawn as a series of move-draw vectors, which can make the files relatively very large. The curves could be gathered up into a polyline in memory and then printed; or the line containing the number of points could be rewritten.

multiple pages appear to only work with the PostScript and PDF drivers of xfig(1); and even then pages must be all positive numbers from left to right and top to bottom, printing all pages in a rectangular area. So, I just print one column. Since I use integers you could potentially exceed the integer size limit, but tests show xfig can go a long ways.

Alternatively, could use depth to keep up to 999 pages seperate

Could implement background color with a rectangle

Could start a group until a pen change to make moving objects easier

Should have a landscape mode and permit other page sizes

Made a color equivalent to a depth to experiment with depth but this caused undesirable sorting of overlaid objects.

#ident "@(#)VOGLE:driver/xfig.c - VOGLE driver for xfig(1) files" #ident "@(#)VOGLE:author - John S. Urban" #ident "@(#)VOGLE:version - 1.0" #include <stdio.h> #include <string.h> #include <math.h> #include "vogle.h" #define XSPACE_SIZE 10200 #define YSPACE_SIZE 13200 #define MAXCOLOR 256 static int MAXCOLOR_used; #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define ABS(x) ((x) < 0 ? -(x) : (x)) #define FLIPY(y) ((vdevice.sizeSy*page)-(y)) extern FILE *_voutfile(); static int page = 1; static int drawn = 0; /* has this page been drawn on yet? */ static int curcol = 0; /* black */ static int xfiglstx = -1, xfiglsty = -1; /* last (x, y) drawn */ static int xfigfont=14; extern float hardwidth[128]; struct rgb_color{ unsigned short int red; unsigned short int green; unsigned short int blue; }; static struct rgb_color carray[MAXCOLOR]; extern FILE *fp; int prefx, prefy, prefxs, prefys; /* How to convert degrees to radians */ #ifndef PI #define PI 3.14159265358979323844 #endif #define d2r(x) ((x) * PI / 180.0) #define r2d(x) ((x) * 180.0 / PI) static int xfig_string(char *s); static int curwid = 1; /* Current pen width */ /******************************************************************************/ /* change index i in the color map to the appropriate rgb value */ static int xfig_mapcolor(int i, int r, int g, int b) { if(i >= MAXCOLOR ){ return(-1); } carray[i].red = (unsigned short)(r); carray[i].green = (unsigned short)(g); carray[i].blue = (unsigned short)(b); MAXCOLOR_used = MAX(MAXCOLOR_used,i+1); /* object_code=0 color_field=32 to 543 (512 total) */ if(!drawn){ fprintf(fp,"0 %d #%2.2x%2.2x%2.2x\n",i+32,r,g,b); }else{ fprintf(fp,"#0 %d #%2.2x%2.2x%2.2x\n", i+32,r,g,b); fprintf(stderr,"xfig only supports mapcolor before any drawing\n"); } return(0); } /******************************************************************************/ /* * xfig_init * * Set up the environment. Returns 1 on success. */ static int xfig_init(void) { int i; fp = _voutfile(); vogle_getprefposandsize(&prefx, &prefy, &prefxs, &prefys); if (prefxs != -1 ) { vdevice.sizeSy = prefys; vdevice.sizeSx = prefxs; vdevice.sizeX = vdevice.sizeY = MIN(prefys, prefxs ); } else{ vdevice.sizeSy = YSPACE_SIZE; /* size in resolution rasters */ vdevice.sizeSx = XSPACE_SIZE; /* size in resolution rasters */ vdevice.sizeX = vdevice.sizeY = MIN(XSPACE_SIZE,YSPACE_SIZE); /* current viewport to use */ } fprintf(fp,"#FIG 3.2\n"); fprintf(fp,"Portrait\n"); fprintf(fp,"Center\n"); fprintf(fp,"Inches\n"); fprintf(fp,"Letter\n"); fprintf(fp,"100\n"); fprintf(fp,"Multiple\n"); fprintf(fp,"-2\n"); fprintf(fp,"#xfig file from VOGLE\n"); fprintf(fp,"1200 2\n"); fprintf(fp,"# PAGESIZE 0 0 %d %d\n",vdevice.sizeX,vdevice.sizeY); vdevice.depth = 8; for (i=0; i < MAXCOLOR; i++){ carray[i].red=0; carray[i].green=0; carray[i].blue=0; } drawn = 0; /* has this page been drawn on yet? */ /* initial color table */ xfig_mapcolor(0, 255, 255, 255); xfig_mapcolor(1, 255, 0, 0); xfig_mapcolor(2, 0, 255, 0); xfig_mapcolor(3, 255, 255, 0); xfig_mapcolor(4, 0, 0, 255); xfig_mapcolor(5, 255, 0, 255); xfig_mapcolor(6, 0, 255, 255); xfig_mapcolor(7, 0, 0, 0); xfig_mapcolor(8, 155, 0, 0); xfig_mapcolor(9, 0, 155, 0); xfig_mapcolor(10, 155, 255, 255); xfig_mapcolor(11, 155, 155, 0); xfig_mapcolor(12, 0, 0, 155); xfig_mapcolor(13, 155, 0, 155); xfig_mapcolor(14, 0, 155, 155); xfig_mapcolor(15, 100, 100, 100); MAXCOLOR_used = 16; page = 1; curcol = 0; /* black */ xfiglstx = -1, xfiglsty = -1; /* last (x, y) drawn */ return(1); } /******************************************************************************/ static int xfig_exit(void) { /* Flush remaining data and close output file if necessary. */ if(drawn){ fprintf(fp,"-6\n"); /* END PAGE */ } fprintf(fp,"# EXIT\n"); /* end page */ fflush(fp); if (fp != stdout && fp != stderr ) { fflush(fp); if(vdevice.writestoprocess == 2){ pclose(fp); }else{ fclose(fp); } } return(0); } /******************************************************************************/ #define L_OBJECT_TYPE 2 #define L_SUB_TYPE 1 int L_LINE_STYLE; /* -1 default, 0 solid, 1 dashed, 2 dotted, 3 dash-dot, 4 dash dot dot, 5 dash dot dot dot */ int L_THICKNESS; int L_PEN_COLOR; int L_FILL_COLOR; #define L_DEPTH 0 #define L_PEN_STYLE -1 #define L_AREA_FILL -1 #define L_STYLE_VAL 0.000 #define L_JOIN_STYLE 1 #define L_CAP_STYLE 1 #define L_RADIUS -1 #define L_FORWARD_ARROW 0 #define L_BACKWARD_ARROW 0 #define L_NPOINTS 2 static int xfig_draw(int x, int y) { /* draw to an x, y point. */ if(!drawn){ /* START PAGE */ fprintf(fp,"6 0 %d %d %d\n",FLIPY(0),vdevice.sizeX,FLIPY(vdevice.sizeY)); drawn = 1; } /* fprintf(fp,"# VECTOR\n"); */ L_THICKNESS=curwid*vdevice.sizeX*2/1200/80/3; L_THICKNESS=MAX(1,L_THICKNESS); L_PEN_COLOR=(curcol%MAXCOLOR_used)+32; L_FILL_COLOR=(curcol%MAXCOLOR_used)+32; L_LINE_STYLE=curcol/MAXCOLOR_used; fprintf(fp,"%d %d %d %d %d %d %d %d %d %f %d %d %d %d %d %d\n", L_OBJECT_TYPE,L_SUB_TYPE, L_LINE_STYLE, L_THICKNESS, L_PEN_COLOR,L_FILL_COLOR, L_DEPTH, L_PEN_STYLE,L_AREA_FILL, L_STYLE_VAL, L_JOIN_STYLE, L_CAP_STYLE, L_RADIUS, L_FORWARD_ARROW,L_BACKWARD_ARROW, L_NPOINTS); if (xfiglstx != vdevice.cpVx || xfiglsty != vdevice.cpVy) { } fprintf(fp," %d %d", vdevice.cpVx, FLIPY(vdevice.cpVy) ); /* move */ fprintf(fp," %d %d\n", x, FLIPY(y) ); /* draw */ xfiglstx = x; xfiglsty = y; return(0); } /******************************************************************************/ /* load in small or large - could be improved. Radically KLUDGED; made SoftText extern */ static int xfig_font(char *fontname) { int i; float rat; /* assuming vdevice.hwidth is the desired width of the reference character, * this is a list of percentages of the other character widths. */ static int helvetica_w[128] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0, 27,33,43,55,55,88,72,28,33,33,39,58,27,33,28,28,55,55,55,55,55,55,55,55,55,55, 34,34,58,58,58,61,97, 73,73,73,73,66,61,78,72,28,55,73,61,83,72,78,66,78,72,67,61,72,66,94,66,66,61, 33,28,33,58,55,28, 55,61,55,61,55,33,61,61,28,28,55,28,88,61,61,61,61,39,55,33,61,55,78,55,55,50, 39,28,39,58,0 }; vdevice.attr->a.softtext = SOFTHARDWARE; /* textsize will be obeyed after the font is set * maybe should read current software size and convert virtual * to device instead of resetting each time */ if(vdevice.hwidth == 0 || vdevice.hheight == 0 ){ vdevice.hwidth=11.0*300.0/72.0; vdevice.hheight=11.0*300.0/72.0; } if (strcmp(fontname, "small") == 0) { xfigfont=14; /* font type */ rat=0.55; /* Kludge Factor */ for (i = 0; i < 128; i++){ hardwidth[i]=1.00 * rat; /* ratio of character width to vdevice.hwidth*/ /*fprintf(stderr," font table %f %c \n",hardwidth[i],i);*/ /* VERIFY FONT TABLE*/ } } else if (strcmp(fontname, "large") == 0) { xfigfont=18; /* font type */ rat=1.26; /* Kludge Factor */ rat=0.90; /* Kludge Factor */ for (i = 0; i < 128; i++){ hardwidth[i]=((float)helvetica_w[i])/100.0 * rat; /* ratio of character width to vdevice.hwidth*/ /*fprintf(stderr," font table %f %c \n",hardwidth[i],i);*/ /* VERIFY FONT TABLE*/ } } else{ return(0); } return(1); } /******************************************************************************/ static int xfig_clear(void) { /* xfig_clear - Erase the plot */ if (drawn) { fprintf(fp,"-6\n"); /* END PAGE */ fprintf(fp,"# END PAGE %d\n",page); page=page+1; fprintf(fp,"# START PAGE %d\n",page); /* BGCOLOR */ /* fprintf(fp,"~ %d %d %d\n", (carray[curcol].red+1)*256-1, (carray[curcol].green+1)*256-1, (carray[curcol].blue+1)*256-1); */ } drawn = 0; return(0); } /******************************************************************************/ static int xfig_setlw(int rasters) { /* Change the thickness of the lines */ curwid=ABS(rasters); return(0); } /******************************************************************************/ static int xfig_color(int col) { /* Change the color of the lines */ if (col > MAXCOLOR){ return(0); }else if(col < 0 ){ xfig_setlw(ABS(col)); return(0); } curcol = col%MAXCOLOR; return(0); } /******************************************************************************/ static int xfig_char(char c) { /* Output a character */ char s[2]; s[0] = c; s[1]='\0'; xfig_string(s); return(0); } /******************************************************************************/ /* output a character string using current character size and rotation angle. */ static int xfig_string(char *s) { if(!drawn){ /* START PAGE */ fprintf(fp,"6 0 %d %d %d\n",FLIPY(0),vdevice.sizeX,FLIPY(vdevice.sizeY)); drawn = 1; } if(vdevice.hwidth == 0 || vdevice.hheight == 0 ){ fprintf(stderr,"*xfig_string* ERROR: ZERO SIZE CHARACTERS\n"); vdevice.hwidth=11.0*300.0/72.0; vdevice.hheight=11.0*300.0/72.0; } fprintf(fp,"4 "); /* OBJECT text */ fprintf(fp,"0 "); /* SUB_TYPE left justified */ fprintf(fp," %d ",(curcol%MAXCOLOR_used)+32); /* COLOR */ fprintf(fp," %d ",(curcol%MAXCOLOR_used)+32); /* DEPTH */ fprintf(fp," -1 "); /* PEN_STYLE */ fprintf(fp," %d ",xfigfont ); /* FONT */ fprintf(fp," %f ",vdevice.hwidth/1200.0*72.); /* FONT SIZE IN POINTS */ fprintf(fp," %f ", /* ANGLE IN RADIANS */ atan2((double)vdevice.attr->a.textsin,(double)vdevice.attr->a.textcos)); if( xfigfont == 0){ fprintf(fp," %d ",4 ); /* FONT FLAGS */ fprintf(fp," %f ",vdevice.hheight ); /* HEIGHT */ fprintf(fp," %f ",vdevice.hwidth*strlen(s) ); /* LENGTH */ }else{ fprintf(fp," %d ",4 ); /* FONT FLAGS */ fprintf(fp," %f ",vdevice.hheight ); /* HEIGHT */ fprintf(fp," %f ",vogle_strlength(s) ); /* LENGTH */ } fprintf(fp," %d ",vdevice.cpVx ); /* X */ fprintf(fp," %d ",FLIPY(vdevice.cpVy)); /* Y */ fprintf(fp,"%s\\001\n",s); /* STRING */ xfiglstx = xfiglsty = -1; return(0); } /******************************************************************************/ #define OBJECT_TYPE 2 #define SUB_TYPE 3 #define LINE_STYLE 0 #define THICKNESS 0 #define PEN_COLOR -1 int FILL_COLOR; #define DEPTH 0 #define PEN_STYLE -1 int AREA_FILL; #define STYLE_VAL 0.000 #define JOIN_STYLE 1 #define CAP_STYLE 1 #define RADIUS 0 #define FORWARD_ARROW 0 #define BACKWARD_ARROW 0 int NPOINTS; static int xfig_fill(int n, int x[], int y[]) { /* fill and draw the polygon */ int i; if(!drawn){ /* START PAGE */ fprintf(fp,"6 0 %d %d %d\n",FLIPY(0),vdevice.sizeX,FLIPY(vdevice.sizeY)); drawn = 1; } fprintf(fp,"# POLYGON\n"); /* THICKNESS=curwid*vdevice.sizeX*2/1200/80/3; THICKNESS=MAX(1,L_THICKNESS); PEN_COLOR=(curcol%MAXCOLOR_used)+32; */ AREA_FILL=curcol/MAXCOLOR_used; if(AREA_FILL == 0){ AREA_FILL=20; }else{ AREA_FILL=40+MIN(AREA_FILL,22); } FILL_COLOR=(curcol%MAXCOLOR_used)+32; NPOINTS=n+1; fprintf(fp,"%d %d %d %d %d %d %d %d %d %f %d %d %d %d %d %d\n", OBJECT_TYPE,SUB_TYPE,LINE_STYLE, THICKNESS,PEN_COLOR,FILL_COLOR, DEPTH,PEN_STYLE,AREA_FILL,STYLE_VAL,JOIN_STYLE, CAP_STYLE,RADIUS,FORWARD_ARROW,BACKWARD_ARROW, NPOINTS); for (i = 0; i < n; i++) { fprintf(fp," %d %d\n", x[i], FLIPY(y[i])); } fprintf(fp," %d %d\n# END POLYGON\n", x[0], FLIPY(y[0])); vdevice.cpVx = x[n - 1]; vdevice.cpVy = y[n - 1]; xfiglstx = xfiglsty = -1; return(0); } /******************************************************************************/ /* no operations - do nothing but return -1 */ static int noop(void) { return(-1); } static int noop2(int *x, int *y) { return(-1); } /******************************************************************************/ static DevEntry xfigdev = { "xfig", /* name of device */ "large", /* name of large font */ "small", /* name of small font */ noop, /* set drawing into back buffer */ xfig_char, /* draw a hardware character */ noop, /* check if a key was hit */ xfig_clear, /* clear screen to current color */ xfig_color, /* set current color */ xfig_draw, /* draw a line */ xfig_exit, /* exit graphics */ xfig_fill, /* fill a polygon */ xfig_font, /* set hardware font */ noop, /* set drawing into front buffer */ noop, /* wait for and get the next key hit */ xfig_init, /* initialize the device */ noop2, /* get mouse/crosshair position */ xfig_mapcolor, /* set color indices */ xfig_setlw, /* Set line width */ xfig_string, /* draw a hardware string */ noop, /* swap front and back buffers */ noop /* syncronize the display */ }; /******************************************************************************/ int _XFIG_devcpy(void) { /* copy the xfig plot device into vdevice.dev. */ vdevice.dev = xfigdev; return(0); } /******************************************************************************/ /***********************************************************************/ [1]XFIG Users Manual _________________________________________________________________ Fig Format 3.2 This is a description of the Fig Format 3.2, which is a copy of xfig.3.2.x/Doc/FORMAT3.2 in the xfig 3.2.x source distribution. /* * FIG : Facility for Interactive Generation of figures * Copyright (c) 1985 by Supoj Sutanthavibul * Parts Copyright (c) 1989-2002 by Brian V. Smith * Parts Copyright (c) 1991 by Paul King * Parts Copyright (c) 1995 by C. Blanc and C. Schlick * * Any party obtaining a copy of these files is granted, free of charge, a * full and unrestricted irrevocable, world-wide, paid up, royalty-free, * nonexclusive right and license to deal in this software and * documentation files (the "Software"), including without limitation the * rights to use, copy, modify, merge, publish and/or distribute copies of * the Software, and to permit persons who receive copies from any such * party to do so, with the only requirement being that this copyright * notice remain intact. */ The new components in protocol 3.2 are the paper size, magnification, single/multiple page indicator and transparent color for GIF export in the header. The other modification between version 3.1 and version 3.2 of the protocol is the mathematical model used for splines. The new version uses X-splines which allows the user to mix interpolation and approximation points in a same curve. More precisely, it means that an X-spline curve is neither an interpolated spline nor an approximated one, it is BOTH (the behaviour of each point is controlled by one single parameter called "shape factor"). For additional information about X-splines, see: "X-Splines: A Spline Model Designed for the End User" by C. Blanc and C. Schlick, Proceedings of SIGGRAPH'95 Caveat: Because spline models of previous versions (quadratic B-splines and Bezier with hidden points) are no longer supported, curves that are present in version 3.1 and older files are automatically converted to X-splines. This translation is only an approximation process. It means that the converted curves are not exactly the same as the original ones. Though the translation usually provides almost identical curves, some hand-fitting may be needed in some pathological cases. _________________________________________________________________ Description of the Fig Format Follows _________________________________________________________________ (1) The very first line is a comment line containing the name and version: #FIG 3.2 The character # at the first column of a line indicates that the line is a comment line which will be preserved when the Fig file is read in. The user may edit them with the popup editor. The comment line(s) must immediately precede the object to which they are associated. In the case of the "whole figure comments" mentioned below, they immediately precede the (resolution,coord_system) line. __________________________________________________________________________ (2) The first non-comment line consists of the following: string orientation ("Landscape" or "Portrait") string justification ("Center" or "Flush Left") string units ("Metric" or "Inches") string papersize ("Letter", "Legal", "Ledger", "Tabloid" , "A", "B", "C", "D", "E", "A4", "A3", "A2", "A1", "A0" and "B5 ") float magnification (export and print magnification, %) string multiple-page ("Single" or "Multiple" pages) int transparent color (color number for transparent color for GIF export. -3=background, -2=None, -1=Def ault, 0-31 for standard colors or 32- for us er colors) # optional comment (An optional set of comments may be her e, which are associated with the whole fi gure) int resolution coord_system (Fig units/inch and coordinate system: 1: origin at lower left corner (NOT USED) 2: upper left) Fig_resolution is the resolution of the figure in the file. Xfig will always write the file with a resolution of 1200ppi so it will scale the figure upon reading it in if its resolution is different from 1200ppi. Pixels are assumed to be square. Xfig will read the orientation string and change the canvas to match either the Landscape or Portrait mode of the figure file. The units specification is self-explanatory. The coordinate_system variable is ignored - the origin is ALWAYS the upper-left corner. ** Coordinates are given in "fig_resolution" units. ** Line thicknesses are given in 1/80 inch (0.3175mm) or 1 screen pixel. When exporting to EPS, PostScript or any bitmap format (e.g. GIF), the line thickness is reduced to 1/160 inch (0.159mm) to "lighten" the look. ** dash-lengths/dot-gaps are given in 80-ths of an inch. __________________________________________________________________________ (3) The rest of the file contains various objects. An object can be one of six classes (or types). 0) Color pseudo-object. 1) Ellipse which is a generalization of circle. 2) Polyline which includes polygon and box. 3) Spline which includes closed/open approximated/interpolated/x-spline spline. 4) Text. 5) Arc. 6) Compound object which is composed of one or more objects. In the following elaboration on object formats, every value of fig output are separated by blank characters or new line ('\n'). The value of the unused parameters will be -1. Some fields are described as "enumeration type" or "bit vector"; the values which these fields can take are defined in the header file object.h. The pen_style field is unused. These values may be defined in some future version of Fig. The two color fields (pen and fill; pen only, for texts) are defined as follows: -1 = Default 0 = Black 1 = Blue 2 = Green 3 = Cyan 4 = Red 5 = Magenta 6 = Yellow 7 = White 8-11 = four shades of blue (dark to lighter) 12-14 = three shades of green (dark to lighter) 15-17 = three shades of cyan (dark to lighter) 18-20 = three shades of red (dark to lighter) 21-23 = three shades of magenta (dark to lighter) 24-26 = three shades of brown (dark to lighter) 27-30 = four shades of pink (dark to lighter) 31 = Gold values from 32 to 543 (512 total) are user colors and are defined in color pseudo-objects (type 0) Your X server may limit the number of colors to something less than this, especially on a 8-bit PseudoColor visual, where the number of usable colors will be 256 minus the number of colors xfig preallocates for itself and the 32 standard colors (about 48). For WHITE color, the area fill field is defined as follows: -1 = not filled 0 = black ... values from 1 to 19 are shades of grey, from darker to lighter 20 = white 21-40 not used 41-56 see patterns for colors, below For BLACK or DEFAULT color, the area fill field is defined as follows: -1 = not filled 0 = white ... values from 1 to 19 are shades of grey, from lighter to darker 20 = black 21-40 not used 41-56 see patterns for colors, below For all other colors, the area fill field is defined as follows: -1 = not filled 0 = black ... values from 1 to 19 are "shades" of the color, from darker to ligh ter. A shade is defined as the color mixed with black 20 = full saturation of the color ... values from 21 to 39 are "tints" of the color from the color to wh ite. A tint is defined as the color mixed with white 40 = white 41 = 30 degree left diagonal pattern 42 = 30 degree right diagonal pattern 43 = 30 degree crosshatch 44 = 45 degree left diagonal pattern 45 = 45 degree right diagonal pattern 46 = 45 degree crosshatch 47 = horizontal bricks 48 = vertical bricks 49 = horizontal lines 50 = vertical lines 51 = crosshatch 52 = horizontal "shingles" skewed to the right 53 = horizontal "shingles" skewed to the left 54 = vertical "shingles" skewed one way 55 = vertical "shingles"skewed the other way 56 = fish scales 57 = small fish scales 58 = circles 59 = hexagons 60 = octagons 61 = horizontal "tire treads" 62 = vertical "tire treads" The depth field is defined as follows: 0 ... 999 where larger value means object is deeper than (under) objects with smaller depth The line_style field is defined as follows: -1 = Default 0 = Solid 1 = Dashed 2 = Dotted 3 = Dash-dotted 4 = Dash-double-dotted 5 = Dash-triple-dotted The style_val field is defined as the length, in 1/80 inches, of the on/off dashes for dashed lines, and the distance between the dots, in 1/80 inches, for dotted lines. The join_style field is defined FOR LINES only as follows: 0 = Miter (the default in xfig 2.1 and earlier) 1 = Round 2 = Bevel The cap_style field is defined FOR LINES, OPEN SPLINES and ARCS only as fol lows: 0 = Butt (the default in xfig 2.1 and earlier) 1 = Round 2 = Projecting The arrow_type field is defined for LINES, ARCS and OPEN SPLINES only as follows: 0 = Stick-type (the default in xfig 2.1 and earlier) \ \ _______________\ / / / 1 = Closed triangle: |\ | \ ________| \ | / | / |/ 2 = Closed with "indented" butt: |\ \ \ \ \ __________\ \ / / / / / / |/ 3 = Closed with "pointed" butt: /\ / \ / \ ________/ \ \ / \ / \ / \/ The arrow_style field is defined for LINES, ARCS and OPEN SPLINES only as follows: 0 = Hollow (actually filled with white) 1 = Filled with pen_color _________________________________________________________________ (3.0) Object Definitions _________________________________________________________________ (3.1) Color Pseudo-objects (user-defined colors) This is used to define arbitrary colors beyond the 32 standard colors . The color objects must be defined before any other Fig objects. First line: type name (brief description) ---- ---- ------------------- int object_code (always 0) int color_number (color number, from 32-543 (512 total)) hex string rgb values (hexadecimal string describing red, green and blue values (e.g. #330099) ) __________________________________________________________________________ (3.2) ARC First line: type name (brief description) ---- ---- ------------------- int object_code (always 5) int sub_type (1: open ended arc 2: pie-wedge (closed) ) int line_style (enumeration type) int line_thickness (1/80 inch) int pen_color (enumeration type, pen color) int fill_color (enumeration type, fill color) int depth (enumeration type) int pen_style (pen style, not used) int area_fill (enumeration type, -1 = no fill) float style_val (1/80 inch) int cap_style (enumeration type) int direction (0: clockwise, 1: counterclockwise) int forward_arrow (0: no forward arrow, 1: on) int backward_arrow (0: no backward arrow, 1: on) float center_x, center_y (center of the arc) int x1, y1 (Fig units, the 1st point the user ente red) int x2, y2 (Fig units, the 2nd point) int x3, y3 (Fig units, the last point) Forward arrow line (Optional; absent if forward_arrow is 0): type name (brief description) ---- ---- ------------------- int arrow_type (enumeration type) int arrow_style (enumeration type) float arrow_thickness (1/80 inch) float arrow_width (Fig units) float arrow_height (Fig units) Backward arrow line (Optional; absent if backward_arrow is 0): type name (brief description) ---- ---- ------------------- int arrow_type (enumeration type) int arrow_style (enumeration type) float arrow_thickness (1/80 inch) float arrow_width (Fig units) float arrow_height (Fig units) __________________________________________________________________________ (3.3) COMPOUND A line with object code 6 signifies the start of a compound. There are four more numbers on this line which indicate the upper left corner and the lower right corner of the bounding box of this compound. A line with object code -6 signifies the end of the compound. Compound may be nested. First line: type name (brief description) ---- ---- ------------------- int object_code (always 6) int upperleft_corner_x (Fig units) int upperleft_corner_y (Fig units) int lowerright_corner_x (Fig units) int lowerright_corner_y (Fig units) Subsequent lines: objects . . Last line: -6 __________________________________________________________________________ (3.4) ELLIPSE First line: type name (brief description) ---- ---- ------------------- int object_code (always 1) int sub_type (1: ellipse defined by radii 2: ellipse defined by diameters 3: circle defined by radius 4: circle defined by diameter) int line_style (enumeration type) int thickness (1/80 inch) int pen_color (enumeration type, pen color) int fill_color (enumeration type, fill color) int depth (enumeration type) int pen_style (pen style, not used) int area_fill (enumeration type, -1 = no fill) float style_val (1/80 inch) int direction (always 1) float angle (radians, the angle of the x-axis) int center_x, center_y (Fig units) int radius_x, radius_y (Fig units) int start_x, start_y (Fig units; the 1st point entered) int end_x, end_y (Fig units; the last point entered) __________________________________________________________________________ (3.5) POLYLINE First line: type name (brief description) ---- ---- ------------------- int object_code (always 2) int sub_type (1: polyline 2: box 3: polygon 4: arc-box) 5: imported-picture bounding-box) int line_style (enumeration type) int thickness (1/80 inch) int pen_color (enumeration type, pen color) int fill_color (enumeration type, fill color) int depth (enumeration type) int pen_style (pen style, not used) int area_fill (enumeration type, -1 = no fill) float style_val (1/80 inch) int join_style (enumeration type) int cap_style (enumeration type, only used for POLYLI NE) int radius (1/80 inch, radius of arc-boxes) int forward_arrow (0: off, 1: on) int backward_arrow (0: off, 1: on) int npoints (number of points in line) Forward arrow line: same as ARC object Backward arrow line: same as ARC object For picture (type 5) the following line follows: type name (brief description) ---- ---- ------------------- boolean flipped orientation = normal (0) or flipped (1) char file[] name of picture file to import Points line(s). The x,y coordinates follow, any number to a line, with as many lines as are necessary: type name (brief description) ---- ---- ------------------- int x1, y1 (Fig units) int x2, y2 (Fig units) . . int xnpoints ynpoints (this will be the same as the 1st point for polygon and box) __________________________________________________________________________ (3.6) SPLINE First line: type name (brief description) ---- ---- ------------------- int object_code (always 3) int sub_type (0: open approximated spline 1: closed approximated spline 2: open interpolated spline 3: closed interpolated spline 4: open x-spline 5: closed x-spline) int line_style (See the end of this section) int thickness (1/80 inch) int pen_color (enumeration type, pen color) int fill_color (enumeration type, fill color) int depth (enumeration type) int pen_style (pen style, not used) int area_fill (enumeration type, -1 = no fill) float style_val (1/80 inch) int cap_style (enumeration type, only used for open s plines) int forward_arrow (0: off, 1: on) int backward_arrow (0: off, 1: on) int npoints (number of control points in spline) Forward arrow line: same as ARC object Backward arrow line: same as ARC object Points line: same as POLYLINE object Control points line : There is one shape factor for each point. The value of this factor must be between -1 (which means that the spline is interpolated at this point) and 1 (which means that the spline is approximated at this point). The spline is always smooth in the neighbourhood of a control point, except when the value of the factor is 0 for which there is a first-order discontinuity (i.e. angular point). __________________________________________________________________________ (3.7) TEXT type name (brief description) ---- ---- ------------------- int object (always 4) int sub_type (0: Left justified 1: Center justified 2: Right justified) int color (enumeration type) int depth (enumeration type) int pen_style (enumeration , not used) int font (enumeration type) float font_size (font size in points) float angle (radians, the angle of the text) int font_flags (bit vector) float height (Fig units) float length (Fig units) int x, y (Fig units, coordinate of the origin of the string. If sub_type = 0, it is the lower left corner of the string. If sub_type = 1, it is the lower center. Otherwise it is the lower right corner of the string.) char string[] (ASCII characters; starts after a blank character following the last number an d ends before the sequence '\001'. This sequence is not part of the string. Characters above octal 177 are represented by \xxx where xxx is the octal value. This permits fig files t o be edited with 7-bit editors and sent by e-mail without data loss. Note that the string may contain '\n'. ) The font_flags field is defined as follows: Bit Description 0 Rigid text (text doesn't scale when scaling compound objects) 1 Special text (for LaTeX) 2 PostScript font (otherwise LaTeX font is used) 3 Hidden text The font field is defined as follows: For font_flags bit 2 = 0 (LaTeX fonts): 0 Default font 1 Roman 2 Bold 3 Italic 4 Sans Serif 5 Typewriter For font_flags bit 2 = 1 (PostScript fonts): -1 Default font 0 Times Roman 1 Times Italic 2 Times Bold 3 Times Bold Italic 4 AvantGarde Book 5 AvantGarde Book Oblique 6 AvantGarde Demi 7 AvantGarde Demi Oblique 8 Bookman Light 9 Bookman Light Italic 10 Bookman Demi 11 Bookman Demi Italic 12 Courier 13 Courier Oblique 14 Courier Bold 15 Courier Bold Oblique 16 Helvetica 17 Helvetica Oblique 18 Helvetica Bold 19 Helvetica Bold Oblique 20 Helvetica Narrow 21 Helvetica Narrow Oblique 22 Helvetica Narrow Bold 23 Helvetica Narrow Bold Oblique 24 New Century Schoolbook Roman 25 New Century Schoolbook Italic 26 New Century Schoolbook Bold 27 New Century Schoolbook Bold Italic 28 Palatino Roman 29 Palatino Italic 30 Palatino Bold 31 Palatino Bold Italic 32 Symbol 33 Zapf Chancery Medium Italic 34 Zapf Dingbats _________________________________________________________________ [ [2]Contents | [3]Introduction | [4]Credits ] References 1. file://localhost/C:/cygwin/usr/X11R6/doc/xfig-3.2.4/html/contents.html 2. file://localhost/C:/cygwin/usr/X11R6/doc/xfig-3.2.4/html/contents.html 3. file://localhost/C:/cygwin/usr/X11R6/doc/xfig-3.2.4/html/introduction.html 4. file://localhost/C:/cygwin/usr/X11R6/doc/xfig-3.2.4/html/authors.html