From: Emden R. Gansner Date: Fri, 4 Oct 2013 15:24:47 +0000 (-0400) Subject: Support 't' font characteristic op; X-Git-Tag: LAST_LIBGRAPH~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ebad94d317711522edaff778825fadda08f7584;p=graphviz Support 't' font characteristic op; use single xop_kind for both grad colors; finish support for grad colors (deparsing). --- diff --git a/lib/xdot/xdot.c b/lib/xdot/xdot.c index 66604dcca..14227684f 100755 --- a/lib/xdot/xdot.c +++ b/lib/xdot/xdot.c @@ -316,7 +316,7 @@ static char *parseOp(xdot_op * op, char *s, drawfunc_t ops[], int* error) op->kind = xd_grad_pen_color; op->u.grad_color = clr; if (ops) - op->drawfunc = ops[xop_grad_pen_color]; + op->drawfunc = ops[xop_grad_color]; } break; @@ -335,7 +335,7 @@ static char *parseOp(xdot_op * op, char *s, drawfunc_t ops[], int* error) op->kind = xd_grad_fill_color; op->u.grad_color = clr; if (ops) - op->drawfunc = ops[xop_grad_fill_color]; + op->drawfunc = ops[xop_grad_color]; } break; @@ -391,6 +391,14 @@ static char *parseOp(xdot_op * op, char *s, drawfunc_t ops[], int* error) op->drawfunc = ops[xop_image]; break; + case 't': + op->kind = xd_fontchar; + s = parseInt(s, &op->u.fontchar); + CHK(s); + if (ops) + op->drawfunc = ops[xop_fontchar]; + break; + case '\0': s = 0; @@ -650,7 +658,6 @@ static void printXDot_Op(xdot_op * op, pf print, void *info, int more) break; case xd_filled_bezier: print("b", info); - op->kind = xd_filled_bezier; printPolyline(&op->u.bezier, print, info); break; case xd_unfilled_bezier: @@ -689,10 +696,13 @@ static void printXDot_Op(xdot_op * op, pf print, void *info, int more) break; case xd_font: print("F", info); - op->kind = xd_font; printFloat(op->u.font.size, print, info, 1); printString(op->u.font.name, print, info); break; + case xd_fontchar: + print("t", info); + printInt(op->u.fontchar, print, info); + break; case xd_style: print("S", info); printString(op->u.style, print, info); @@ -822,6 +832,10 @@ static void jsonXDot_Op(xdot_op * op, pf print, void *info, int more) jsonString(op->u.font.name, print, info); print("]", info); break; + case xd_fontchar: + print("{t : ", info); + printInt(op->u.fontchar, print, info); + break; case xd_style: print("{S : ", info); jsonString(op->u.style, print, info); @@ -975,9 +989,16 @@ int statXDot (xdot* x, xdot_stats* sp) case xd_pen_color: sp->n_color++; break; + case xd_grad_fill_color: + case xd_grad_pen_color: + sp->n_gradcolor++; + break; case xd_font: sp->n_font++; break; + case xd_fontchar: + sp->n_fontchar++; + break; case xd_style: sp->n_style++; break; diff --git a/lib/xdot/xdot.h b/lib/xdot/xdot.h index e9e89c2b9..3323b6b41 100755 --- a/lib/xdot/xdot.h +++ b/lib/xdot/xdot.h @@ -16,6 +16,11 @@ #ifdef _WIN32 #include #endif + +#ifdef __cplusplus +extern "C" { +#endif + #define INITIAL_XDOT_CAPACITY 512 typedef enum { @@ -92,7 +97,8 @@ typedef enum { xd_filled_bezier, xd_unfilled_bezier, xd_polyline, xd_text, xd_fill_color, xd_pen_color, xd_font, xd_style, xd_image, - xd_grad_fill_color, xd_grad_pen_color + xd_grad_fill_color, xd_grad_pen_color, + xd_fontchar } xdot_kind; typedef enum { @@ -101,7 +107,8 @@ typedef enum { xop_bezier, xop_polyline, xop_text, xop_fill_color, xop_pen_color, xop_font, xop_style, xop_image, - xop_grad_fill_color, xop_grad_pen_color + xop_grad_color, + xop_fontchar } xop_kind; typedef struct _xdot_op xdot_op; @@ -121,6 +128,7 @@ struct _xdot_op { xdot_color grad_color; /* xd_grad_fill_color, xd_grad_pen_color */ xdot_font font; /* xd_font */ char* style; /* xd_style */ + int fontchar; /* xd_fontchar */ } u; drawfunc_t drawfunc; }; @@ -149,6 +157,8 @@ typedef struct { int n_style; int n_color; int n_image; + int n_gradcolor; + int n_fontchar; } xdot_stats; /* ops are indexed by xop_kind */ @@ -164,4 +174,7 @@ extern xdot_grad_type colorTypeXDot (char*); extern char* parseXDotColor (char* cp, xdot_color* clr); extern void freeXDotColor (xdot_color*); +#ifdef __cplusplus +} +#endif #endif