31#define BEZIERSUBDIVISION 6
74 {
"AB",
"AvantGarde-Demi"},
75 {
"AI",
"AvantGarde-BookOblique"},
76 {
"AR",
"AvantGarde-Book"},
77 {
"AX",
"AvantGarde-DemiOblique"},
79 {
"BI",
"Times-BoldItalic"},
80 {
"CB",
"Courier-Bold"},
82 {
"CX",
"Courier-BoldOblique"},
84 {
"HB",
"Helvetica-Bold"},
85 {
"HI",
"Helvetica-Oblique"},
86 {
"HX",
"Helvetica-BoldOblique"},
87 {
"Hb",
"Helvetica-Narrow-Bold"},
88 {
"Hi",
"Helvetica-Narrow-Oblique"},
89 {
"Hr",
"Helvetica-Narrow"},
90 {
"Hx",
"Helvetica-Narrow-BoldOblique"},
91 {
"I ",
"Times-Italic"},
92 {
"KB",
"Bookman-Demi"},
93 {
"KI",
"Bookman-LightItalic"},
94 {
"KR",
"Bookman-Light"},
95 {
"KX",
"Bookman-DemiItalic"},
96 {
"NB",
"NewCenturySchlbk-Bold"},
97 {
"NI",
"NewCenturySchlbk-Italic"},
98 {
"NR",
"NewCenturySchlbk-Roman"},
99 {
"NX",
"NewCenturySchlbk-BoldItalic"},
100 {
"PA",
"Palatino-Roman"},
101 {
"PB",
"Palatino-Bold"},
102 {
"PI",
"Palatino-Italic"},
103 {
"PX",
"Palatino-BoldItalic"},
104 {
"R ",
"Times-Roman"},
106 {
"ZD",
"ZapfDingbats"},
111void *
memrchr(
const void *
s,
int c,
size_t n);
113static const void *
memrchr(
const void *
s,
int c,
size_t n) {
115 for (
size_t i = n - 1; i !=
SIZE_MAX; --i) {
134 .size = (size_t)(dash - psname.
data)};
141 for (
size_t i = 0; i < n; i++) {
143 gvprintf(job,
"move to (%.0f, %.0f)",
A[i].x,
A[i].y);
145 gvprintf(job,
"; line to (%.0f, %.0f)",
A[i].x,
A[i].y);
149 gvprintf(job,
"; line to (%.0f, %.0f)",
A[0].x,
A[0].y);
163 gvprintf(job,
"%s Creator: %s version %s (%s)\n",
167 "%s save point size and font\n.nr .S \\n(.s\n.nr DF \\n(.f\n",
174 "%s restore point size and font\n.ps \\n(.S\n.ft \\n(DF\n",
186 double height =
PS2INCH((
double)pbr.
UR.
y - (
double)pbr.
LL.
y);
193 gvprintf(job,
".PS %.5f %.5f\n", width, height);
195 "%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",
206 "%s don't change anything below this line in this drawing\n",
209 "%s non-fatal run-time pic version determination, version 2\n",
212 "boxrad=2.0 %s will be reset to 0.0 by gpic only\n",
214 gvprintf(job,
"scale=1.0 %s required for comparisons\n",
217 "%s boxrad is now 0.0 in gpic, else it remains 2.0\n",
220 "%s dashwid is 0.1 in 10th Edition, 0.05 in DWB 2 and in gpic\n",
223 "%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",
226 "%s fill has no meaning in DWB 2, gpic can use fill or filled, 10th Edition uses fill only\n",
229 "%s DWB 2 doesn't use fill and doesn't define fillval\n",
232 "%s reset works in gpic and 10th edition, but isn't defined in DWB 2\n",
234 gvprintf(job,
"%s DWB 2 compatibility definitions\n",
237 "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");
239 gvprintf(job,
"%s GNU pic vs. 10th Edition d\\(e'tente\n",
242 "if fillval > 0.4 then X\n\tdefine setfillval Y fillval = 1 - Y;\n\tdefine bold Y thickness 2 Y;\n");
244 "\t%s if you use gpic and it barfs on encountering \"solid\",\n",
247 "\t%s\tinstall a more recent version of gpic or switch to DWB or 10th Edition pic;\n",
250 "\t%s\tsorry, the groff folks changed gpic; send any complaint to them;\n",
253 "X else Z\n\tdefine setfillval Y fillval = Y;\n\tdefine bold Y Y;\n\tdefine filled Y fill Y;\nZ\n");
255 "%s arrowhead has no meaning in DWB 2, arrowhead = 7 makes filled arrowheads in gpic and in 10th Edition\n",
258 "%s arrowhead is undefined in DWB 2, initially 1 in gpic, 2 in 10th Edition\n",
260 gvprintf(job,
"arrowhead = 7 %s not used by graphviz\n",
263 "%s GNU pic supports a boxrad variable to draw boxes with rounded corners; DWB and 10th Ed. do not\n",
265 gvprintf(job,
"boxrad = 0 %s no rounded corners in graphviz\n",
268 "%s GNU pic supports a linethick variable to set line thickness; DWB and 10th Ed. do not\n",
270 gvprintf(job,
"linethick = 0; oldlinethick = linethick\n");
272 "%s .PS w/o args causes GNU pic to scale drawing to fit 8.5x11 paper; DWB does not\n",
275 "%s maxpsht and maxpswid have no meaning in DWB 2.0, set page boundaries in gpic and in 10th Edition\n",
278 "%s maxpsht and maxpswid are predefined to 11.0 and 8.5 in gpic\n",
280 gvprintf(job,
"maxpsht = %f\nmaxpswid = %f\n", height, width);
283 "define attrs0 %% %%; define unfilled %% %%; define rounded %% %%; define diagonals %% %%\n");
294 static char *lastname;
295 static double lastsize;
297 switch (span->
just) {
312 if (span->
font->
name && (!lastname || strcmp(lastname, span->
font->
name))) {
316 double sz = fmax(span->
font->
size, 1);
317 if (fabs(sz - lastsize) > 0.5) {
323 gvprintf(job,
"\" at (%.5f,%.5f);\n", p.
x, p.
y);
331 "ellipse attrs0 %swid %.5f ht %.5f at (%.5f,%.5f);\n",
332 filled ?
"fill " :
"",
347 gvprintf(job,
"move to (%.0f, %.0f)",
A[0].x,
A[0].y);
349 for (
size_t i = 0; i + 3 < n; i += 3) {
351 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.
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 *,...)