From owner-freebsd-ports Mon Mar 11 8:12:33 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A09A437B41A for ; Mon, 11 Mar 2002 08:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2BGA1e36499; Mon, 11 Mar 2002 08:10:01 -0800 (PST) (envelope-from gnats) Received: from astart2.astart.com (tcubed-gw.customer.nethere.net [216.188.53.211]) by hub.freebsd.org (Postfix) with ESMTP id AB2E537B419 for ; Mon, 11 Mar 2002 08:02:44 -0800 (PST) Received: from h111.private (h111.private [10.0.0.111]) by astart2.astart.com (8.11.6/8.11.6) with ESMTP id g2BG2gs06560 for ; Mon, 11 Mar 2002 08:02:43 -0800 (PST) (envelope-from papowell@astart.com) Received: (from papowell@localhost) by h111.private (8.11.6/8.11.6) id g2BG2gX06894; Mon, 11 Mar 2002 08:02:42 -0800 (PST) (envelope-from papowell) Message-Id: <200203111602.g2BG2gX06894@h111.private> Date: Mon, 11 Mar 2002 08:02:42 -0800 (PST) From: Patrick Powell Reply-To: Patrick Powell To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/35784: reposting pic2fig port as a diff against port Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 35784 >Category: ports >Synopsis: reposting pic2fig port as a diff against port >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Mar 11 08:10:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Patrick Powell >Release: FreeBSD 4.5-RELEASE i386 >Organization: LPRng.com >Environment: System: FreeBSD h111.private 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386 >Description: respost of the pic2fig port, as a diff against the port as of March 11, 2002 >How-To-Repeat: >Fix: diff -uNr /usr/ports/print/pic2fig/files/patch-aa pic2fig/files/patch-aa --- /usr/ports/print/pic2fig/files/patch-aa Tue Jan 16 15:01:57 2001 +++ pic2fig/files/patch-aa Mon Mar 11 07:58:39 2002 @@ -1,21 +1,568 @@ ---- Makefile.orig Mon Apr 29 10:11:02 1991 -+++ Makefile Tue Jan 16 08:26:36 2001 -@@ -1,7 +1,7 @@ - BINDIR = /usr/local/bin --CFLAGS = -O4 -s $(CROSS) -+#CFLAGS = -O4 -s $(CROSS) - #LDFLAGS= -zs --LDFLAGS= -z $(CROSS) -+#LDFLAGS= -z $(CROSS) - YFLAGS = -d - - MOFILES = main.o boxgen.o print.o misc.o symtab.o blockgen.o circgen.o \ -@@ -29,7 +29,7 @@ - -@echo "" - - pic2fig: picy.o picl.o $(OFILES) -- cc $(LDFLAGS) -o $@ picy.o picl.o $(OFILES) -lm -+ $(CC) $(LDFLAGS) -o $@ picy.o picl.o $(OFILES) -lm - - # The following .o files depend of picy.c, since they really need picy.h - picl.o: picl.c pic.h picy.c +*** FORMAT3.2.orig Thu Feb 7 11:05:12 2002 +--- FORMAT3.2 Thu Feb 7 11:08:04 2002 +*************** +*** 0 **** +--- 1,563 ---- ++ /* ++ * FIG : Facility for Interactive Generation of figures ++ * Copyright (c) 1985 by Supoj Sutanthavibul ++ * Parts Copyright (c) 1989-1999 by Brian V. Smith ++ * Parts Copyright (c) 1991 by Paul King ++ * Parts Copyright (c) 1995 by C. Blanc and C. Schlick ++ * ++ * The X Consortium, and any party obtaining a copy of these files from ++ * the X Consortium, directly or indirectly, 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, distribute, sublicense, ++ * and/or sell 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. This license includes without ++ * limitation a license to do the foregoing actions under any patents of ++ * the party supplying this software to the X Consortium. ++ */ ++ ++ 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=Default, ++ 0-31 for standard colors or 32- for user colors) ++ # optional comment (An optional set of comments may be here, ++ which are associated with the whole figure) ++ 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) Arc. ++ 2) Ellipse which is a generalization of circle. ++ 3) Polyline which includes polygon and box. ++ 4) Spline which includes ++ closed/open approximated/interpolated/x-spline spline. ++ 5) Text. ++ 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 lighter. ++ 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 white. ++ 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 follows: ++ ++ 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 DEFINITION: ++ ++ (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 forward arrow, 1: on) ++ float center_x, center_y (center of the arc) ++ int x1, y1 (Fig units, the 1st point the user entered) ++ 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 POLYLINE) ++ 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 ++ ++ Points line: ++ 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) ++ ++ PIC line: ++ type name (brief description) ++ ---- ---- ------------------- ++ boolean flipped orientation = normal (0) or flipped (1) ++ char file[] name of picture file to import ++ ++ (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 splines) ++ 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 and ++ 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 to ++ 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): ++ ++ (.ft value) ++ -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 diff -uNr /usr/ports/print/pic2fig/files/patch-ab pic2fig/files/patch-ab --- /usr/ports/print/pic2fig/files/patch-ab Tue Jan 16 15:01:57 2001 +++ pic2fig/files/patch-ab Mon Mar 11 07:58:39 2002 @@ -1,490 +1,36 @@ ---- figd.c.orig Sat Aug 6 19:52:43 1988 -+++ figd.c Tue Jan 16 08:26:38 2001 -@@ -6,13 +6,16 @@ - * - * Modified by Micah Beck to produce Fig code - * Modified by Micah Beck again to produce Fig 1.4 code -+ * Modified by Patrick Powell to produce Fig 3.2 code - */ - - #include - #include - #include "object.h" - --#define DEF_PEN_SIZE 8 /* Default pen diameter */ -+/* #define DEF_PEN_SIZE 8 / * Default pen diameter */ -+#define DEF_PEN_SIZE 1 /* Default pen diameter */ -+#define DEF_FONT_SIZE 12 /* Default pen diameter */ - #define MAXPOINTS 300 /* Max number of points in a path */ - - #define bool int -@@ -23,6 +26,8 @@ - #define P_BLACK 15 - #define TEXTURE 3 - #define ORTEXTURE 7 -+#define FONT_HT 12 -+#define FONT_WIDTH 8 - - extern double sqrt(), cos(), sin(); - -@@ -31,11 +36,15 @@ - #define RES 1000.0 - #define Pix_To_In(x) (((float) x) / RES) - --#define FIGRES 80 -+/* #define FIGRES 80 */ -+#define FIGRES 1200 - #define FIGCANV_W (8*FIGRES) - #define FIGCANV_H (10*FIGRES) -+#define Points_To_Figpix(x) ((int)(FIGRES * (x)/72.0)) - #define Pix_To_Figpix(x) ((int)(FIGRES * Pix_To_In(x))) --#define Pen_to_Figpix(x) ((x*FIGRES + 500) / 1000) -+/* #define Pen_to_Figpix(x) ((x*FIGRES + 500) / 1000) */ -+/* pen thickness in 1/80 of inch */ -+#define Pen_to_Figpix(x) ((Pix_To_In(x) + 79) / 80) - - - extern int dbg; /* Non-zero when debugging info wanted */ -@@ -44,7 +53,8 @@ - static float xslope,yslope,xbase,ybase;/* Convert Window to Viewport */ - static int arraylen; /* Number of points in current path */ - static bool pathsent; /* True if path has been defined */ --static int ipensize; /* Desired current pen size */ -+static int ipensize = DEF_PEN_SIZE; /* Desired current pen size */ -+static int ifontsize = DEF_FONT_SIZE; /* Desired current font size */ - extern FILE *TEXFILE; /* Output file */ - - -@@ -62,7 +72,7 @@ - yslope = RES * (hiypage-loypage) / (hiy-loy); - ybase = RES * loypage - loy*yslope; - if (dbg) -- printf("Coefficients: %10.5f%10.5f%10.5f%10.5f\n", -+ printf("Coefficients: %10.5f %10.5f %10.5f %10.5f\n", - xslope,xbase,yslope,ybase); - } - -@@ -70,14 +80,18 @@ - /* - * Set the size of the virtual pen used in drawing - */ -+static sendpath(); - pensize(x) - int x; - { - if (x != ipensize) { - ipensize = Pen_to_Figpix(x); -+ ifontsize = x; -+ if( ipensize == 0 ) ipensize = 1; - if (!pathsent) sendpath(); - clearpath(); - } -+ if( dbg) printf("pensize %d -> %d\n", x, ipensize ); - } - - -@@ -149,24 +163,84 @@ - float x, y; - int position; /* Indicates what part of text is at (x,y) */ - { -- int ix, iy, offset; -- char *cp; -+ int ix, iy, offset, c; -+ unsigned char *cp; - map(x, y, &ix, &iy, 1); - -- for (cp = text; *cp && isspace(*text); cp++); -+ for (cp = (unsigned char *)text; isspace(*cp); cp++); - if (!*cp) return; - - #ifdef TEXT_LEFT_ONLY -- if (position != T_LEFT_JUSTIFIED) offset = strlen(cp)*8; -+ if (position != T_LEFT_JUSTIFIED) offset = strlen(cp)*Points_To_Figpix(ifontsize); - if (position == T_CENTER_JUSTIFIED) offset = offset/2; - position = T_LEFT_JUSTIFIED; - #else - offset = 0; - #endif TEXT_LEFT_ONLY - -+/* FORMAT 1.4 CODE - fprintf(TEXFILE, "%d %d %d %d %d %d %6.3f %d %d %d %d %d %s%c\n", -- O_TEXT, position, -1, -1, -1, -1, 0.0, -1, 16, strlen(cp)*8, -+ 4 justification (0,1,2) -+ font (unused) -+ fontsize (unused) -+ pen (unused) -+ color -+ depth -+ angle (not used) -+ height (pixels) -+ length (pixels) -+ -+ 4, position, -1, -1, -1, -1, 0.0, -1, 16, strlen(cp)*Points_To_Figpix(ifontsize), - Pix_To_Figpix(ix) - offset, Pix_To_Figpix(iy), cp, '\01'); -+Example: -+4 1 -1 -1 -1 -1 0.000 -1 16 24 229 603 FEP^A -+ -+FORMAT 3.2 CODE -+ (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 and -+ ends before the sequence '\001'. This -+ sequence is not part of the string. -+ -+ -+Example: -+4 1 -1 0 -1 -1 12 0.0000 4 135 330 3450 9060 FEP\001 -+*/ -+ if(dbg) printf("string (%d,%d) '%s'\n", Pix_To_Figpix(ix-offset), Pix_To_Figpix(iy), cp ); -+ -+ fprintf(TEXFILE, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d ", -+ O_TEXT, position, -1, 0,-1,-1,ifontsize,0.0, 4,Pix_To_Figpix(FONT_HT),Pix_To_Figpix(strlen(cp)*FONT_WIDTH), -+ Pix_To_Figpix(ix-offset), Pix_To_Figpix(iy)); -+ while( (c = ((unsigned char *)(cp))[0]) ){ -+ if( c == '\\' ){ -+ fprintf(TEXFILE, "\\\\"); -+ } else if( isprint(c) || isspace(c) ){ -+ fprintf(TEXFILE, "%c", c); -+ } -+ ++cp; -+ } -+ fprintf(TEXFILE, "\\001\n"); - } - - -@@ -208,16 +282,54 @@ - { - register int i; - -- if (dbg) printf("Sending path ...%d\n", arraylen); -+ if (dbg) printf("Sendpath [%d], ipensize %d\n", arraylen, ipensize); - if (arraylen > 1) { - -+ /* - fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", - O_POLYLINE, T_POLYLINE, SOLID_LINE, - ipensize, -1, -1, -1, -1, -1, 0, 0); -- for (i=1; i<=arraylen; i++) -- fprintf(TEXFILE, "%d %d ", -+ -+Example: -+ 2 1 0 1 -1 -1 -1 -1 -1 0 0 -+ 19 149 19 9 179 9 179 149 19 149 9999 9999 -+ -+New format: -+ 2 1 0 1 -1 -1 0 -1 -1 -1.000 0 0 -1 0 0 5 -+ code pen_color -+ type fill_color -+ line style -+ depth -+ pen_style -+ style_value -+ join_style -+ cap_style -+ radius -+ forward_arrow -+ count -+ thickness (1/80 inch) -+ -1 = Default -+ 0 = Solid -+ 1 = Dashed -+ 2 = Dotted -+ 3 = Dash-dotted -+ 4 = Dash-double-dotted -+ 5 = Dash-triple-dotted -+ -+ 300 2250 300 150 2700 150 2700 2250 300 2250 -+ -+ -+ */ -+ fprintf(TEXFILE, "%d %d %d %d -1 -1 0 -1 -1 -1.000 0 0 -1 0 0 %d\n ", -+ 2, T_POLYLINE, SOLID_LINE, ipensize, arraylen ); -+ for (i=1; i<=arraylen; i++){ -+ if (dbg) printf(" (%d,%d)", Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); -+ fprintf(TEXFILE, "%d %d ", - Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); -- fprintf(TEXFILE, "9999 9999\n"); -+ } -+ if (dbg) printf("\n", Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); -+ /* fprintf(TEXFILE, "9999 9999\n"); */ -+ fprintf(TEXFILE, "\n"); - } - - pathsent = TRUE; -@@ -234,17 +346,22 @@ - { - register int i; - -- if (dbg) printf("Sending path ...%d\n", arraylen); -+ if (dbg) printf("Send_dashed_path ...%d\n", arraylen); - if (arraylen < 2) return; - else { -+/* - fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", - O_POLYLINE, T_POLYLINE, - (dotted ? DOTTED_LINE : DASH_LINE), ipensize, - -1, -1, -1, -1, -1, 0, 0); -- for (i=1; i<=arraylen; i++) -+ */ -+ fprintf(TEXFILE, "%d %d %d %d -1 -1 0 -1 -1 -1.000 0 0 -1 0 0 %d\n ", -+ 2, T_POLYLINE, (dotted? DOTTED_LINE: DASH_LINE), ipensize, arraylen ); -+ for (i=1; i<=arraylen; i++){ - fprintf(TEXFILE, "%d %d ", - Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); -- fprintf(TEXFILE, "9999 9999\n"); -+ } -+ /* fprintf(TEXFILE, "9999 9999\n"); */ - } - - pathsent = TRUE; -@@ -294,7 +411,7 @@ - fig_arc(xcenter, ycenter, xradius, yradius, start, stop) - float xcenter, ycenter, xradius, yradius, start, stop; - { -- int X0, Y0, xrad, yrad, xend, yend; -+ int X0, Y0, xrad, yrad, xend, yend, xstart, ystart; - extern double cos(), sin(); - - map(xcenter, ycenter, &X0, &Y0, FALSE); -@@ -304,18 +421,85 @@ - if (is_onarc(PI/2, start, stop)) ckbounds(X0, Y0+yrad); - if (is_onarc(PI, start, stop)) ckbounds(X0-xrad, Y0); - if (is_onarc(1.5*PI, start, stop)) ckbounds(X0, Y0-yrad); -- xend = X0 + xrad * cos(start) + 0.5; -- yend = Y0 + yrad * sin(start) + 0.5; -- ckbounds(xend, yend); -+ xstart = X0 + xrad * cos(start) + 0.5; -+ ystart = Y0 + yrad * sin(start) + 0.5; -+ ckbounds(xstart, ystart); - xend = X0 + xrad * cos(stop); - yend = Y0 + yrad * sin(stop); - ckbounds(xend, yend); -+ if(dbg) printf("Ellipse: X0 %d, Y0 %d, xrad %d, yrad %d, xstart %d, ystart %d, xend %d, yend %d\n", -+ Pix_To_Figpix(X0), Pix_To_Figpix(Y0), -+ Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), -+ Pix_To_Figpix(xstart), Pix_To_Figpix(ystart), -+ Pix_To_Figpix(xend), Pix_To_Figpix(yend)); -+ -+/* -+ int object_code (always 1) -+ int sub_type (1 : ellipse defined by radiuses -+ 2 : ellipse defined by diameters -+ 3 : circle defined by radius -+ 4 : circle defined by diameter) -+ int line_style (See the end of this section) -+ int thickness (pixels, not used) -+ int color (not used) -+ int depth (not used) -+ int pen (not used) -+ int area_fill (not used) -+ float style_val (pixels, not used) -+ int direction (always 1) -+ float angle (radian, the angle of the x-axis) -+ int center_x, center_y (pixels) -+ int radius_x, radius_y (pixels) -+ int start_x, start_y (pixels; the 1st point entered) -+ int end_x, end_y (pixels; the last point entered) -+ -+Example: -+ 1 1 0 1 -1, -1 -1 -1 -1 1 0 0.000 0.000 0.000 0.000 0.000 0.000 - - fprintf(TEXFILE, "%d %d %d %d %d, %d %d %d %d %d %d %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f\n", - O_ELLIPSE, T_ELLIPSE_BY_RAD, - SOLID_LINE, ipensize, -1, -1, -1, -1, -1, 1, 0.0, - Pix_To_Figpix(X0), Pix_To_Figpix(Y0), - Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), 0.0, 0.0, 0.0, 0.0); -+ -+ -+ 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) -+ -+Example: -+ 1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 1125 975 675 375 1125 975 1800 1350 -+ pen areafill -+ fill styleval -+ depth -+ pen_style -+*/ -+ -+ -+ fprintf(TEXFILE, "%d %d %d %d", O_ELLIPSE, T_ELLIPSE_BY_RAD, SOLID_LINE, ipensize ); -+ fprintf(TEXFILE, " 0 7 50 0 -1 0.0 1 0.0" ); -+ fprintf(TEXFILE, " %d %d %d %d %d %d %d %d\n", -+ Pix_To_Figpix(X0), Pix_To_Figpix(Y0), -+ Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), -+ Pix_To_Figpix(xstart), Pix_To_Figpix(ystart), -+ Pix_To_Figpix(xend), Pix_To_Figpix(yend)); - } - - -@@ -347,14 +531,56 @@ - */ - fig_begin_drawing() - { -- fprintf(TEXFILE, "#FIG 1.4\n%d %d\n", FIGRES, 2); -+ -+/* -+(1) The very first line is a comment line containing the name and version: -+ #FIG 3.2 -+(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=Default, -+ 0-31 for standard colors or 32- for user colors) -+ # optional comment (An optional set of comments may be here, -+ which are associated with the whole figure) -+ int resolution coord_system (Fig units/inch and coordinate system: -+ 1: origin at lower left corner (NOT USED) -+ 2: upper left) -+Example: -+ #FIG 3.2 -+ Landscape -+ Center -+ Inches -+ Letter -+ 100.00 -+ Single -+ -2 -+ 1200 2 -+ -+*/ -+ fprintf(TEXFILE, "#FIG 3.2\n"); -+ fprintf(TEXFILE, "Landscape\n"); -+ fprintf(TEXFILE, "Center\n"); -+ fprintf(TEXFILE, "Inches\n"); -+ fprintf(TEXFILE, "Letter\n"); -+ fprintf(TEXFILE, "100.00\n"); -+ fprintf(TEXFILE, "Single\n"); -+ fprintf(TEXFILE, "-2\n"); -+ fprintf(TEXFILE, "%d %d\n", FIGRES, 2 ); - - fig_window(0.0, 0.0, 10.0, 10.0, 0.0, 0.0, 3.0, 3.0); - xmin = 30000; xmax = -30000; - ymin = 30000; ymax = -30000; - arraylen = 0; - pathsent = FALSE; -- ipensize = Pen_to_Figpix(DEF_PEN_SIZE); -+ pensize(DEF_PEN_SIZE); - } - - -@@ -392,15 +618,67 @@ - clearpath(); - } - -+/* - fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", - O_SPLINE, T_OPEN_NORMAL, - SOLID_LINE, ipensize, -1, -1, -1, -1, -1, 0, 0); -+ fprintf(TEXFILE, "9999 9999\n"); -+ -+New format: -+ 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 splines) -+ 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). -+ -+Example: -+ 3 2 0 1 0 7 50 0 -1 0.000 0 0 0 3 -+ 975 1950 1875 1500 2550 1950 -+ 0.000 -1.000 0.000 -+ -+*/ -+ fprintf(TEXFILE, "%d %d %d %d", 3, 2, SOLID_LINE, ipensize ); -+ fprintf(TEXFILE, " 0 7 50 0 -1 0.000 0 0 0 %d\n ", N-1 ); - for (i=1; i - #include -+#include - #include "pic.h" - #include "picy.h" - - static reset(); --extern char *sprintf(), *strcpy(); - - struct obj *objlist[MAXOBJ]; /* store the elements here */ - int nobj = 0; +*** figd.c.orig Sat Aug 6 19:52:43 1988 +--- figd.c Thu Feb 7 11:19:49 2002 +*************** +*** 6,18 **** + * + * Modified by Micah Beck to produce Fig code + * Modified by Micah Beck again to produce Fig 1.4 code + */ + + #include + #include + #include "object.h" + +! #define DEF_PEN_SIZE 8 /* Default pen diameter */ + #define MAXPOINTS 300 /* Max number of points in a path */ + + #define bool int +--- 6,21 ---- + * + * Modified by Micah Beck to produce Fig code + * Modified by Micah Beck again to produce Fig 1.4 code ++ * Modified by Patrick Powell to produce Fig 3.2 code + */ + + #include + #include + #include "object.h" + +! /* #define DEF_PEN_SIZE 8 / * Default pen diameter */ +! #define DEF_PEN_SIZE 1 /* Default pen diameter */ +! #define DEF_FONT_SIZE 12 /* Default pen diameter */ + #define MAXPOINTS 300 /* Max number of points in a path */ + + #define bool int +*************** +*** 23,28 **** +--- 26,33 ---- + #define P_BLACK 15 + #define TEXTURE 3 + #define ORTEXTURE 7 ++ #define FONT_HT 12 ++ #define FONT_WIDTH 8 + + extern double sqrt(), cos(), sin(); + +*************** +*** 31,41 **** + #define RES 1000.0 + #define Pix_To_In(x) (((float) x) / RES) + +! #define FIGRES 80 + #define FIGCANV_W (8*FIGRES) + #define FIGCANV_H (10*FIGRES) + #define Pix_To_Figpix(x) ((int)(FIGRES * Pix_To_In(x))) +! #define Pen_to_Figpix(x) ((x*FIGRES + 500) / 1000) + + + extern int dbg; /* Non-zero when debugging info wanted */ +--- 36,50 ---- + #define RES 1000.0 + #define Pix_To_In(x) (((float) x) / RES) + +! /* #define FIGRES 80 */ +! #define FIGRES 1200 + #define FIGCANV_W (8*FIGRES) + #define FIGCANV_H (10*FIGRES) ++ #define Points_To_Figpix(x) ((int)(FIGRES * (x)/72.0)) + #define Pix_To_Figpix(x) ((int)(FIGRES * Pix_To_In(x))) +! /* #define Pen_to_Figpix(x) ((x*FIGRES + 500) / 1000) */ +! /* pen thickness in 1/80 of inch */ +! #define Pen_to_Figpix(x) ((Pix_To_In(x) + 79) / 80) + + + extern int dbg; /* Non-zero when debugging info wanted */ +*************** +*** 44,51 **** + static float xslope,yslope,xbase,ybase;/* Convert Window to Viewport */ + static int arraylen; /* Number of points in current path */ + static bool pathsent; /* True if path has been defined */ +! static int ipensize; /* Desired current pen size */ + extern FILE *TEXFILE; /* Output file */ + + + /* +--- 53,62 ---- + static float xslope,yslope,xbase,ybase;/* Convert Window to Viewport */ + static int arraylen; /* Number of points in current path */ + static bool pathsent; /* True if path has been defined */ +! static int ipensize = DEF_PEN_SIZE; /* Desired current pen size */ +! static int ifontsize = DEF_FONT_SIZE; /* Desired current font size */ + extern FILE *TEXFILE; /* Output file */ ++ int font = -1; /* font number */ + + + /* +*************** +*** 62,68 **** + yslope = RES * (hiypage-loypage) / (hiy-loy); + ybase = RES * loypage - loy*yslope; + if (dbg) +! printf("Coefficients: %10.5f%10.5f%10.5f%10.5f\n", + xslope,xbase,yslope,ybase); + } + +--- 73,79 ---- + yslope = RES * (hiypage-loypage) / (hiy-loy); + ybase = RES * loypage - loy*yslope; + if (dbg) +! printf("Coefficients: %10.5f %10.5f %10.5f %10.5f\n", + xslope,xbase,yslope,ybase); + } + +*************** +*** 70,83 **** +--- 81,98 ---- + /* + * Set the size of the virtual pen used in drawing + */ ++ static sendpath(); + pensize(x) + int x; + { + if (x != ipensize) { + ipensize = Pen_to_Figpix(x); ++ ifontsize = x; ++ if( ipensize == 0 ) ipensize = 1; + if (!pathsent) sendpath(); + clearpath(); + } ++ if( dbg) printf("pensize %d -> %d\n", x, ipensize ); + } + + +*************** +*** 149,172 **** + float x, y; + int position; /* Indicates what part of text is at (x,y) */ + { +! int ix, iy, offset; +! char *cp; + map(x, y, &ix, &iy, 1); + +! for (cp = text; *cp && isspace(*text); cp++); + if (!*cp) return; + + #ifdef TEXT_LEFT_ONLY +! if (position != T_LEFT_JUSTIFIED) offset = strlen(cp)*8; + if (position == T_CENTER_JUSTIFIED) offset = offset/2; + position = T_LEFT_JUSTIFIED; + #else + offset = 0; + #endif TEXT_LEFT_ONLY + + fprintf(TEXFILE, "%d %d %d %d %d %d %6.3f %d %d %d %d %d %s%c\n", +! O_TEXT, position, -1, -1, -1, -1, 0.0, -1, 16, strlen(cp)*8, + Pix_To_Figpix(ix) - offset, Pix_To_Figpix(iy), cp, '\01'); + } + + +--- 164,248 ---- + float x, y; + int position; /* Indicates what part of text is at (x,y) */ + { +! int ix, iy, offset, c; +! unsigned char *cp; + map(x, y, &ix, &iy, 1); + +! for (cp = (unsigned char *)text; isspace(*cp); cp++); + if (!*cp) return; + + #ifdef TEXT_LEFT_ONLY +! if (position != T_LEFT_JUSTIFIED) offset = strlen(cp)*Points_To_Figpix(ifontsize); + if (position == T_CENTER_JUSTIFIED) offset = offset/2; + position = T_LEFT_JUSTIFIED; + #else + offset = 0; + #endif TEXT_LEFT_ONLY + ++ /* FORMAT 1.4 CODE + fprintf(TEXFILE, "%d %d %d %d %d %d %6.3f %d %d %d %d %d %s%c\n", +! 4 justification (0,1,2) +! font (unused) +! fontsize (unused) +! pen (unused) +! color +! depth +! angle (not used) +! height (pixels) +! length (pixels) +! +! 4, position, -1, -1, -1, -1, 0.0, -1, 16, strlen(cp)*Points_To_Figpix(ifontsize), + Pix_To_Figpix(ix) - offset, Pix_To_Figpix(iy), cp, '\01'); ++ Example: ++ 4 1 -1 -1 -1 -1 0.000 -1 16 24 229 603 FEP^A ++ ++ FORMAT 3.2 CODE ++ Example: ++ 4 1 -1 0 -1 -1 12 0.0000 4 135 330 3450 9060 FEP\001 ++ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ++ (3.7) TEXT ++ type name (brief description) ++ ---- ---- ------------------- ++ int object (always 4) 1 ++ int sub_type (0: Left justified 2 ++ 1: Center justified ++ 2: Right justified) ++ int color (enumeration type) 3 ++ int depth (enumeration type) 4 ++ int pen_style (enumeration , not used) 5 ++ int font (enumeration type) 6 ++ float font_size (font size in points) 7 ++ float angle (radians, the angle of the text) 8 ++ int font_flags (bit vector) 9 ++ float height (Fig units) 10 ++ float length (Fig units) 11 ++ int x, y (Fig units, coordinate of the origin 12,13 ++ 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 14 ++ character following the last number and ++ ends before the sequence '\001'. This ++ sequence is not part of the string. ++ ++ ++ */ ++ if(dbg) printf("string (%d,%d) '%s'\n", Pix_To_Figpix(ix-offset), Pix_To_Figpix(iy), cp ); ++ ++ fprintf(TEXFILE, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d ", ++ O_TEXT, position, -1, 0,-1,font,ifontsize,0.0, 4,Pix_To_Figpix(FONT_HT),Pix_To_Figpix(strlen(cp)*FONT_WIDTH), ++ Pix_To_Figpix(ix-offset), Pix_To_Figpix(iy)); ++ while( (c = ((unsigned char *)(cp))[0]) ){ ++ if( c == '\\' ){ ++ fprintf(TEXFILE, "\\\\"); ++ } else if( isprint(c) || isspace(c) ){ ++ fprintf(TEXFILE, "%c", c); ++ } ++ ++cp; ++ } ++ fprintf(TEXFILE, "\\001\n"); + } + + +*************** +*** 208,223 **** + { + register int i; + +! if (dbg) printf("Sending path ...%d\n", arraylen); + if (arraylen > 1) { + + fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", + O_POLYLINE, T_POLYLINE, SOLID_LINE, + ipensize, -1, -1, -1, -1, -1, 0, 0); +! for (i=1; i<=arraylen; i++) +! fprintf(TEXFILE, "%d %d ", + Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! fprintf(TEXFILE, "9999 9999\n"); + } + + pathsent = TRUE; +--- 284,337 ---- + { + register int i; + +! if (dbg) printf("Sendpath [%d], ipensize %d\n", arraylen, ipensize); + if (arraylen > 1) { + ++ /* + fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", + O_POLYLINE, T_POLYLINE, SOLID_LINE, + ipensize, -1, -1, -1, -1, -1, 0, 0); +! +! Example: +! 2 1 0 1 -1 -1 -1 -1 -1 0 0 +! 19 149 19 9 179 9 179 149 19 149 9999 9999 +! +! New format: +! 2 1 0 1 -1 -1 0 -1 -1 -1.000 0 0 -1 0 0 5 +! code pen_color +! type fill_color +! line style +! depth +! pen_style +! style_value +! join_style +! cap_style +! radius +! forward_arrow +! count +! thickness (1/80 inch) +! -1 = Default +! 0 = Solid +! 1 = Dashed +! 2 = Dotted +! 3 = Dash-dotted +! 4 = Dash-double-dotted +! 5 = Dash-triple-dotted +! +! 300 2250 300 150 2700 150 2700 2250 300 2250 +! +! +! */ +! fprintf(TEXFILE, "%d %d %d %d -1 -1 0 -1 -1 -1.000 0 0 -1 0 0 %d\n ", +! 2, T_POLYLINE, SOLID_LINE, ipensize, arraylen ); +! for (i=1; i<=arraylen; i++){ +! if (dbg) printf(" (%d,%d)", Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! fprintf(TEXFILE, "%d %d ", + Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! } +! if (dbg) printf("\n", Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! /* fprintf(TEXFILE, "9999 9999\n"); */ +! fprintf(TEXFILE, "\n"); + } + + pathsent = TRUE; +*************** +*** 234,250 **** + { + register int i; + +! if (dbg) printf("Sending path ...%d\n", arraylen); + if (arraylen < 2) return; + else { + fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", + O_POLYLINE, T_POLYLINE, + (dotted ? DOTTED_LINE : DASH_LINE), ipensize, + -1, -1, -1, -1, -1, 0, 0); +! for (i=1; i<=arraylen; i++) + fprintf(TEXFILE, "%d %d ", + Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! fprintf(TEXFILE, "9999 9999\n"); + } + + pathsent = TRUE; +--- 348,373 ---- + { + register int i; + +! if (dbg) printf("Send_dashed_path ...%d, inchesperdash %f, dotted %d\n", +! arraylen, inchesperdash, dotted ); + if (arraylen < 2) return; + else { ++ /* + fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", + O_POLYLINE, T_POLYLINE, + (dotted ? DOTTED_LINE : DASH_LINE), ipensize, + -1, -1, -1, -1, -1, 0, 0); +! */ +! fprintf(TEXFILE, "%d %d %d %d -1 -1 0 -1 -1 %f 0 0 -1 0 0 %d\n ", +! 2, T_POLYLINE, (dotted? DOTTED_LINE: DASH_LINE), ipensize, +! inchesperdash*80, +! arraylen ); +! for (i=1; i<=arraylen; i++){ + fprintf(TEXFILE, "%d %d ", + Pix_To_Figpix(xx[i]), Pix_To_Figpix(yy[i])); +! } +! /* fprintf(TEXFILE, "9999 9999\n"); */ +! fprintf(TEXFILE, "\n"); + } + + pathsent = TRUE; +*************** +*** 294,300 **** + fig_arc(xcenter, ycenter, xradius, yradius, start, stop) + float xcenter, ycenter, xradius, yradius, start, stop; + { +! int X0, Y0, xrad, yrad, xend, yend; + extern double cos(), sin(); + + map(xcenter, ycenter, &X0, &Y0, FALSE); +--- 417,423 ---- + fig_arc(xcenter, ycenter, xradius, yradius, start, stop) + float xcenter, ycenter, xradius, yradius, start, stop; + { +! int X0, Y0, xrad, yrad, xend, yend, xstart, ystart; + extern double cos(), sin(); + + map(xcenter, ycenter, &X0, &Y0, FALSE); +*************** +*** 304,321 **** + if (is_onarc(PI/2, start, stop)) ckbounds(X0, Y0+yrad); + if (is_onarc(PI, start, stop)) ckbounds(X0-xrad, Y0); + if (is_onarc(1.5*PI, start, stop)) ckbounds(X0, Y0-yrad); +! xend = X0 + xrad * cos(start) + 0.5; +! yend = Y0 + yrad * sin(start) + 0.5; +! ckbounds(xend, yend); + xend = X0 + xrad * cos(stop); + yend = Y0 + yrad * sin(stop); + ckbounds(xend, yend); + + fprintf(TEXFILE, "%d %d %d %d %d, %d %d %d %d %d %d %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f\n", + O_ELLIPSE, T_ELLIPSE_BY_RAD, + SOLID_LINE, ipensize, -1, -1, -1, -1, -1, 1, 0.0, + Pix_To_Figpix(X0), Pix_To_Figpix(Y0), + Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), 0.0, 0.0, 0.0, 0.0); + } + + +--- 427,511 ---- + if (is_onarc(PI/2, start, stop)) ckbounds(X0, Y0+yrad); + if (is_onarc(PI, start, stop)) ckbounds(X0-xrad, Y0); + if (is_onarc(1.5*PI, start, stop)) ckbounds(X0, Y0-yrad); +! xstart = X0 + xrad * cos(start) + 0.5; +! ystart = Y0 + yrad * sin(start) + 0.5; +! ckbounds(xstart, ystart); + xend = X0 + xrad * cos(stop); + yend = Y0 + yrad * sin(stop); + ckbounds(xend, yend); ++ if(dbg) printf("Ellipse: X0 %d, Y0 %d, xrad %d, yrad %d, xstart %d, ystart %d, xend %d, yend %d\n", ++ Pix_To_Figpix(X0), Pix_To_Figpix(Y0), ++ Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), ++ Pix_To_Figpix(xstart), Pix_To_Figpix(ystart), ++ Pix_To_Figpix(xend), Pix_To_Figpix(yend)); ++ ++ /* ++ int object_code (always 1) ++ int sub_type (1 : ellipse defined by radiuses ++ 2 : ellipse defined by diameters ++ 3 : circle defined by radius ++ 4 : circle defined by diameter) ++ int line_style (See the end of this section) ++ int thickness (pixels, not used) ++ int color (not used) ++ int depth (not used) ++ int pen (not used) ++ int area_fill (not used) ++ float style_val (pixels, not used) ++ int direction (always 1) ++ float angle (radian, the angle of the x-axis) ++ int center_x, center_y (pixels) ++ int radius_x, radius_y (pixels) ++ int start_x, start_y (pixels; the 1st point entered) ++ int end_x, end_y (pixels; the last point entered) ++ ++ Example: ++ 1 1 0 1 -1, -1 -1 -1 -1 1 0 0.000 0.000 0.000 0.000 0.000 0.000 + + fprintf(TEXFILE, "%d %d %d %d %d, %d %d %d %d %d %d %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f\n", + O_ELLIPSE, T_ELLIPSE_BY_RAD, + SOLID_LINE, ipensize, -1, -1, -1, -1, -1, 1, 0.0, + Pix_To_Figpix(X0), Pix_To_Figpix(Y0), + Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), 0.0, 0.0, 0.0, 0.0); ++ ++ ++ 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) ++ ++ Example: ++ 1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 1125 975 675 375 1125 975 1800 1350 ++ pen areafill ++ fill styleval ++ depth ++ pen_style ++ */ ++ ++ ++ fprintf(TEXFILE, "%d %d %d %d", O_ELLIPSE, T_ELLIPSE_BY_RAD, SOLID_LINE, ipensize ); ++ fprintf(TEXFILE, " 0 7 50 0 -1 0.0 1 0.0" ); ++ fprintf(TEXFILE, " %d %d %d %d %d %d %d %d\n", ++ Pix_To_Figpix(X0), Pix_To_Figpix(Y0), ++ Pix_To_Figpix(xrad), Pix_To_Figpix(yrad), ++ Pix_To_Figpix(xstart), Pix_To_Figpix(ystart), ++ Pix_To_Figpix(xend), Pix_To_Figpix(yend)); + } + + +*************** +*** 347,360 **** + */ + fig_begin_drawing() + { +! fprintf(TEXFILE, "#FIG 1.4\n%d %d\n", FIGRES, 2); + + fig_window(0.0, 0.0, 10.0, 10.0, 0.0, 0.0, 3.0, 3.0); + xmin = 30000; xmax = -30000; + ymin = 30000; ymax = -30000; + arraylen = 0; + pathsent = FALSE; +! ipensize = Pen_to_Figpix(DEF_PEN_SIZE); + } + + +--- 537,592 ---- + */ + fig_begin_drawing() + { +! +! /* +! (1) The very first line is a comment line containing the name and version: +! #FIG 3.2 +! (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=Default, +! 0-31 for standard colors or 32- for user colors) +! # optional comment (An optional set of comments may be here, +! which are associated with the whole figure) +! int resolution coord_system (Fig units/inch and coordinate system: +! 1: origin at lower left corner (NOT USED) +! 2: upper left) +! Example: +! #FIG 3.2 +! Landscape +! Center +! Inches +! Letter +! 100.00 +! Single +! -2 +! 1200 2 +! +! */ +! fprintf(TEXFILE, "#FIG 3.2\n"); +! fprintf(TEXFILE, "Landscape\n"); +! fprintf(TEXFILE, "Center\n"); +! fprintf(TEXFILE, "Inches\n"); +! fprintf(TEXFILE, "Letter\n"); +! fprintf(TEXFILE, "100.00\n"); +! fprintf(TEXFILE, "Single\n"); +! fprintf(TEXFILE, "-2\n"); +! fprintf(TEXFILE, "%d %d\n", FIGRES, 2 ); + + fig_window(0.0, 0.0, 10.0, 10.0, 0.0, 0.0, 3.0, 3.0); + xmin = 30000; xmax = -30000; + ymin = 30000; ymax = -30000; + arraylen = 0; + pathsent = FALSE; +! pensize(DEF_PEN_SIZE); + } + + +*************** +*** 392,406 **** + clearpath(); + } + + fprintf(TEXFILE, "%d %d %d %d %d %d %d %d %d %d %d\n", + O_SPLINE, T_OPEN_NORMAL, + SOLID_LINE, ipensize, -1, -1, -1, -1, -1, 0, 0); + for (i=1; i + #include + #include "pic.h" + #include "picy.h" + + static reset(); +- extern char *sprintf(), *strcpy(); + + struct obj *objlist[MAXOBJ]; /* store the elements here */ + int nobj = 0; +--- 1,10 ---- + #include + #include ++ #include + #include "pic.h" + #include "picy.h" + + static reset(); + + struct obj *objlist[MAXOBJ]; /* store the elements here */ + int nobj = 0; diff -uNr /usr/ports/print/pic2fig/files/patch-ae pic2fig/files/patch-ae --- /usr/ports/print/pic2fig/files/patch-ae Wed Dec 31 16:00:00 1969 +++ pic2fig/files/patch-ae Mon Mar 11 07:58:39 2002 @@ -0,0 +1,56 @@ +*** pic2fig.1.orig Thu Feb 7 11:04:33 2002 +--- pic2fig.1 Thu Feb 7 11:29:57 2002 +*************** +*** 55,60 **** +--- 55,105 ---- + must be given in the first column. Changing the drawing thickness applies + to solid, dashed, and dotted lines, as well as circles, arcs, and ellipses. + .PP ++ Setting the font for text may be done using a ++ .ti +.5i ++ \&.ft \fIn\fR ++ ++ command, where \fIn\fR corresponds to the following PostScript fonts: ++ .nf ++ -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 ++ .fi ++ ++ .PP + Normally, the distance between text is 12 points. If you're using larger + text to label objects, this should be set to an appropriate larger value. + This can be done using the diff -uNr /usr/ports/print/pic2fig/files/patch-af pic2fig/files/patch-af --- /usr/ports/print/pic2fig/files/patch-af Wed Dec 31 16:00:00 1969 +++ pic2fig/files/patch-af Mon Mar 11 07:58:39 2002 @@ -0,0 +1,79 @@ +*** plfig.c.orig Thu Feb 7 11:08:39 2002 +--- plfig.c Thu Feb 7 11:20:17 2002 +*************** +*** 121,127 **** + htrue = vtrue = 0; + } + +! troff(s) /* handle ".ps n" to set the pen size to "n" pixels */ + char *s; + { + if (strncmp (s, ".ps", 3) == 0) { +--- 121,168 ---- + htrue = vtrue = 0; + } + +! /* handle ".ps n" to set the pen size to "n" pixels */ +! /* handle ".ft n" to set the output font to number n +! (.ft value) +! -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 +! */ +! +! troff(s) + char *s; + { + if (strncmp (s, ".ps", 3) == 0) { +*************** +*** 131,136 **** +--- 172,187 ---- + pensize (size); + else + fprintf (stderr, "Malformed .ps command: %s\n", s); ++ return; ++ } ++ if (strncmp (s, ".ft", 3) == 0) { ++ int size; ++ extern int font; ++ ++ if (sscanf (s + 3, " %d ", &size) == 1) ++ font = size; ++ else ++ fprintf (stderr, "Malformed .ft command: %s\n", s); + return; + } + >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message