32#define BEZIERSUBDIVISION 6
75 {
"AB",
"AvantGarde-Demi"},
76 {
"AI",
"AvantGarde-BookOblique"},
77 {
"AR",
"AvantGarde-Book"},
78 {
"AX",
"AvantGarde-DemiOblique"},
80 {
"BI",
"Times-BoldItalic"},
81 {
"CB",
"Courier-Bold"},
83 {
"CX",
"Courier-BoldOblique"},
85 {
"HB",
"Helvetica-Bold"},
86 {
"HI",
"Helvetica-Oblique"},
87 {
"HX",
"Helvetica-BoldOblique"},
88 {
"Hb",
"Helvetica-Narrow-Bold"},
89 {
"Hi",
"Helvetica-Narrow-Oblique"},
90 {
"Hr",
"Helvetica-Narrow"},
91 {
"Hx",
"Helvetica-Narrow-BoldOblique"},
92 {
"I ",
"Times-Italic"},
93 {
"KB",
"Bookman-Demi"},
94 {
"KI",
"Bookman-LightItalic"},
95 {
"KR",
"Bookman-Light"},
96 {
"KX",
"Bookman-DemiItalic"},
97 {
"NB",
"NewCenturySchlbk-Bold"},
98 {
"NI",
"NewCenturySchlbk-Italic"},
99 {
"NR",
"NewCenturySchlbk-Roman"},
100 {
"NX",
"NewCenturySchlbk-BoldItalic"},
101 {
"PA",
"Palatino-Roman"},
102 {
"PB",
"Palatino-Bold"},
103 {
"PI",
"Palatino-Italic"},
104 {
"PX",
"Palatino-BoldItalic"},
105 {
"R ",
"Times-Roman"},
107 {
"ZD",
"ZapfDingbats"},
112void *
memrchr(
const void *
s,
int c,
size_t n);
114static const void *
memrchr(
const void *
s,
int c,
size_t n) {
116 for (
size_t i = n - 1; i !=
SIZE_MAX; --i) {
135 .size = (size_t)(dash - psname.
data)};
142 for (
size_t i = 0; i < n; i++) {
144 gvprintf(job,
"move to (%.0f, %.0f)",
A[i].x,
A[i].y);
146 gvprintf(job,
"; line to (%.0f, %.0f)",
A[i].x,
A[i].y);
150 gvprintf(job,
"; line to (%.0f, %.0f)",
A[0].x,
A[0].y);
164 gvprintf(job,
"%s Creator: %s version %s (%s)\n",
168 "%s save point size and font\n.nr .S \\n(.s\n.nr DF \\n(.f\n",
175 "%s restore point size and font\n.ps \\n(.S\n.ft \\n(DF\n",
187 double height =
PS2INCH((
double)pbr.
UR.
y - (
double)pbr.
LL.
y);
190 SWAP(&width, &height);
192 gvprintf(job,
".PS %.5f %.5f\n", width, height);
194 "%s to change drawing size, multiply the width and height on the .PS line above and the number on the two lines below (rounded to the nearest integer) by a scale factor\n",
205 "%s don't change anything below this line in this drawing\n",
208 "%s non-fatal run-time pic version determination, version 2\n",
211 "boxrad=2.0 %s will be reset to 0.0 by gpic only\n",
213 gvprintf(job,
"scale=1.0 %s required for comparisons\n",
216 "%s boxrad is now 0.0 in gpic, else it remains 2.0\n",
219 "%s dashwid is 0.1 in 10th Edition, 0.05 in DWB 2 and in gpic\n",
222 "%s fillval is 0.3 in 10th Edition (fill 0 means black), 0.5 in gpic (fill 0 means white), undefined in DWB 2\n",
225 "%s fill has no meaning in DWB 2, gpic can use fill or filled, 10th Edition uses fill only\n",
228 "%s DWB 2 doesn't use fill and doesn't define fillval\n",
231 "%s reset works in gpic and 10th edition, but isn't defined in DWB 2\n",
233 gvprintf(job,
"%s DWB 2 compatibility definitions\n",
236 "if boxrad > 1.0 && dashwid < 0.075 then X\n\tfillval = 1;\n\tdefine fill Y Y;\n\tdefine solid Y Y;\n\tdefine reset Y scale=1.0 Y;\nX\n");
238 gvprintf(job,
"%s GNU pic vs. 10th Edition d\\(e'tente\n",
241 "if fillval > 0.4 then X\n\tdefine setfillval Y fillval = 1 - Y;\n\tdefine bold Y thickness 2 Y;\n");
243 "\t%s if you use gpic and it barfs on encountering \"solid\",\n",
246 "\t%s\tinstall a more recent version of gpic or switch to DWB or 10th Edition pic;\n",
249 "\t%s\tsorry, the groff folks changed gpic; send any complaint to them;\n",
252 "X else Z\n\tdefine setfillval Y fillval = Y;\n\tdefine bold Y Y;\n\tdefine filled Y fill Y;\nZ\n");
254 "%s arrowhead has no meaning in DWB 2, arrowhead = 7 makes filled arrowheads in gpic and in 10th Edition\n",
257 "%s arrowhead is undefined in DWB 2, initially 1 in gpic, 2 in 10th Edition\n",
259 gvprintf(job,
"arrowhead = 7 %s not used by graphviz\n",
262 "%s GNU pic supports a boxrad variable to draw boxes with rounded corners; DWB and 10th Ed. do not\n",
264 gvprintf(job,
"boxrad = 0 %s no rounded corners in graphviz\n",
267 "%s GNU pic supports a linethick variable to set line thickness; DWB and 10th Ed. do not\n",
269 gvprintf(job,
"linethick = 0; oldlinethick = linethick\n");
271 "%s .PS w/o args causes GNU pic to scale drawing to fit 8.5x11 paper; DWB does not\n",
274 "%s maxpsht and maxpswid have no meaning in DWB 2.0, set page boundaries in gpic and in 10th Edition\n",
277 "%s maxpsht and maxpswid are predefined to 11.0 and 8.5 in gpic\n",
279 gvprintf(job,
"maxpsht = %f\nmaxpswid = %f\n", height, width);
282 "define attrs0 %% %%; define unfilled %% %%; define rounded %% %%; define diagonals %% %%\n");
293 static char *lastname;
294 static double lastsize;
296 switch (span->
just) {
311 if (span->
font->
name && (!lastname || strcmp(lastname, span->
font->
name))) {
315 double sz = fmax(span->
font->
size, 1);
316 if (fabs(sz - lastsize) > 0.5) {
322 gvprintf(job,
"\" at (%.5f,%.5f);\n", p.
x, p.
y);
330 "ellipse attrs0 %swid %.5f ht %.5f at (%.5f,%.5f);\n",
331 filled ?
"fill " :
"",
346 gvprintf(job,
"move to (%.0f, %.0f)",
A[0].x,
A[0].y);
348 for (
size_t i = 0; i + 3 < n; i += 3) {
350 for (
size_t j = 1; j <= 3; j++) {
pointf Bezier(pointf *V, double t, pointf *Left, pointf *Right)
#define PS2INCH(a_points)
require define api prefix
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
char * agnameof(void *)
returns a string descriptor for the object.
Arithmetic helper functions.
int gvputc(GVJ_t *job, int c)
void gvputs_nonascii(GVJ_t *job, const char *s)
int gvputs(GVJ_t *job, const char *s)
void gvprintf(GVJ_t *job, const char *format,...)
static void pic_bezier(GVJ_t *job, pointf *A, size_t n, int filled)
static const char * picfontname(strview_t psname)
static void pic_end_graph(GVJ_t *job)
gvplugin_installed_t gvdevice_pic_types[]
static void picptarray(GVJ_t *job, pointf *A, size_t n, int close)
static void pic_polygon(GVJ_t *job, pointf *A, size_t n, int filled)
static void pic_begin_graph(GVJ_t *job)
gvrender_engine_t pic_engine
static const char troff_comments[]
static gvrender_features_t render_features_pic
static const char picgen_msghdr[]
static const size_t fonttab_size
static void pic_textspan(GVJ_t *job, pointf p, textspan_t *span)
static void pic_ellipse(GVJ_t *job, pointf *A, int filled)
gvplugin_installed_t gvrender_pic_types[]
static const fontinfo fonttab[]
static const void * memrchr(const void *s, int c, size_t n)
static void pic_comment(GVJ_t *job, char *str)
static void pic_end_page(GVJ_t *job)
static void pic_begin_page(GVJ_t *job)
static const char pic_comments[]
static void pic_polyline(GVJ_t *job, pointf *A, size_t n)
#define BEZIERSUBDIVISION
static gvdevice_features_t device_features_pic
static void unsupported(char *s)
textitem scanner parser str
a non-owning string reference
const char * data
start of the pointed to string
size_t size
extent of the string in bytes
Non-owning string references.
static bool strview_str_eq(strview_t a, const char *b)
compare a string reference to a string for equality
static strview_t strview(const char *referent, char terminator)
create a string reference
int(* pf)(void *, char *,...)