double fsize;
/* make sure that there is something to do */
- if (tp->nlines < 1)
+ if (tp->nparas < 1)
return;
/* set font attributes */
p.x = env->p.x + ((double)(tp->box.UR.x + tp->box.LL.x))/2.0;
p.y = env->p.y + ((double)(tp->box.UR.y + tp->box.LL.y))/2.0;
- emit_textlines(job, tp->nlines, tp->line, p,
+ emit_textparas(job, tp->nparas, tp->para, p,
halfwidth_x, fname, fsize, fcolor);
}
#endif
static void
-emit_htextlines(GVJ_t* job, int nlines, htextline_t* lines, pointf p,
+emit_htextparas(GVJ_t* job, int nparas, htextpara_t* paras, pointf p,
double halfwidth_x, char* fname, double fsize, char* fcolor, box b)
{
int i,j;
double tmp, center_x, left_x, right_x, fsize_;
double offset=0.0;
char *fname_ , *fcolor_;
- textline_t tl;
+ textpara_t tl;
pointf p_ = {0.0, 0.0};
textitem_t* ti;
right_x = center_x + halfwidth_x;
gvrender_begin_context(job);
- for(i=0; i<nlines; i++) {
- switch (lines[i].just) {
+ for(i=0; i<nparas; i++) {
+ switch (paras[i].just) {
case 'l':
p_.x = left_x;
p.x = left_x;
}
if (i == 0) {
- p_.y = p.y + (double)(b.UR.y-b.LL.y)/2 - lines[i].lfsize * 0.9 ;
+ p_.y = p.y + (double)(b.UR.y-b.LL.y)/2 - paras[i].lfsize * 0.9 ;
tmp = ROUND(p_.y); /* align with integer points */
p_.y = (double)tmp;
}
- ti = lines[i].items;
- for(j=0; j<lines[i].nitems; j++) {
+ ti = paras[i].items;
+ for(j=0; j<paras[i].nitems; j++) {
if (ti->font && (ti->font->size > 0))
fsize_ = ti->font->size;
else
tl.str = ti->str;
tl.xshow = ti->xshow;
tl.layout = ti->layout;
- tl.dimen.x = lines[i].size;
- tl.dimen.y = lines[i].lfsize;
- tl.just = lines[i].just;
+ tl.width = paras[i].size;
+ tl.height = paras[i].lfsize;
+ tl.just = paras[i].just;
- gvrender_textline(job, p_, &tl);
+ gvrender_textpara(job, p_, &tl);
offset += ti->size;
p_.x = p.x + offset;
ti++;
}
- /* position for next line */
- if(i != nlines-1)
- p_.y -= lines[i+1].lfsize * LINESPACING;
+ /* position for next para */
+ if(i != nparas-1)
+ p_.y -= paras[i+1].lfsize * LINESPACING;
offset = 0.0;
}
double fsize;
/* make sure that there is something to do */
- if (tp->nlines < 1)
+ if (tp->nparas < 1)
return;
fsize = env->finfo.size;
p.x = env->p.x + ((double) (tp->box.UR.x + tp->box.LL.x)) / 2.0;
p.y = env->p.y + ((double) (tp->box.UR.y + tp->box.LL.y)) / 2.0;
- emit_htextlines(job, tp->nlines, tp->lines, p, halfwidth_x, fname,
+ emit_htextparas(job, tp->nparas, tp->paras, p, halfwidth_x, fname,
fsize, fcolor, tp->box);
}
#ifdef OLD
void free_html_text(htmltxt_t * tp)
{
- textline_t *lp;
+ textpara_t *lp;
if (!tp)
return;
- lp = tp->line;
+ lp = tp->para;
while (lp->str) {
free(lp->str);
lp++;
}
- free(tp->line);
+ free(tp->para);
if (tp->font)
free_html_font(tp->font);
free(tp);
void free_html_text(htmltxt_t* t)
{
- htextline_t *tl;
+ htextpara_t *tl;
textitem_t *ti;
int i, j;
if (!t) return;
- tl = t->lines;
- for (i = 0; i < t->nlines; i++) {
+ tl = t->paras;
+ for (i = 0; i < t->nparas; i++) {
ti = tl->items;
for (j = 0; j < tl->nitems; j++) {
if (ti->str) free (ti->str);
tl++;
}
free(tl->items);
- free(t->lines);
+ free(t->paras);
free(t);
}
double fsize;
char *fname;
char *news = NULL;
- textline_t *lp = txt->line;
+ textpara_t *lp = txt->para;
pointf size;
if (txt->font) {
lp++;
}
txt->box.UR.x = xsize;
- if (txt->nlines == 1)
+ if (txt->nparas == 1)
txt->box.UR.y = (int) (size.y);
else
- txt->box.UR.y = txt->nlines * (int) (size.y * LINESPACING);
+ txt->box.UR.y = txt->nparas * (int) (size.y * LINESPACING);
return 0;
}
#endif
pointf sz;
int i, j, w = 0, width = 0;
char *fname;
- textline_t lp;
+ textpara_t lp;
char* (*substrFn) (char*, htmlenv_t* env);
switch (agobjkind(env->obj)) {
substrFn = NULL;
}
- for (i = 0; i < ftxt->nlines; i++) {
- for (j = 0; j < ftxt->lines[i].nitems; j++) {
- lp.str = substrFn (ftxt->lines[i].items[j].str, env);
- if (ftxt->lines[i].items[j].font) {
- if (ftxt->lines[i].items[j].font->size > 0)
- fsize = ftxt->lines[i].items[j].font->size;
+ for (i = 0; i < ftxt->nparas; i++) {
+ for (j = 0; j < ftxt->paras[i].nitems; j++) {
+ lp.str = substrFn (ftxt->paras[i].items[j].str, env);
+ if (ftxt->paras[i].items[j].font) {
+ if (ftxt->paras[i].items[j].font->size > 0)
+ fsize = ftxt->paras[i].items[j].font->size;
else
fsize = env->finfo.size;
- if (ftxt->lines[i].items[j].font->name)
- fname = ftxt->lines[i].items[j].font->name;
+ if (ftxt->paras[i].items[j].font->name)
+ fname = ftxt->paras[i].items[j].font->name;
else
fname = env->finfo.name;
} else {
}
sz = textsize(g, &lp, fname, fsize);
w = sz.x;
- free (ftxt->lines[i].items[j].str);
- ftxt->lines[i].items[j].str = lp.str;
- ftxt->lines[i].items[j].size = sz.x;
- ftxt->lines[i].items[j].xshow = lp.xshow;
- ftxt->lines[i].items[j].layout = lp.layout;
- ftxt->lines[i].items[j].free_layout = lp.free_layout;
+ free (ftxt->paras[i].items[j].str);
+ ftxt->paras[i].items[j].str = lp.str;
+ ftxt->paras[i].items[j].size = sz.x;
+ ftxt->paras[i].items[j].xshow = lp.xshow;
+ ftxt->paras[i].items[j].layout = lp.layout;
+ ftxt->paras[i].items[j].free_layout = lp.free_layout;
width += w;
- ftxt->lines[i].size = (double) width;
+ ftxt->paras[i].size = (double) width;
if (fsize > lsize)
lsize = fsize;
}
- ftxt->lines[i].lfsize = lsize;
+ ftxt->paras[i].lfsize = lsize;
if (width > xsize)
xsize = width;
ysize += lsize * LINESPACING;
{
int i;
- for (i = 0; i < ftxt->nlines; i++) {
- if (ftxt->lines[i].just == UNSET_ALIGN) /* unset */
- ftxt->lines[i].just = c;
+ for (i = 0; i < ftxt->nparas; i++) {
+ if (ftxt->paras[i].just == UNSET_ALIGN) /* unset */
+ ftxt->paras[i].just = c;
}
}
fprintf(stderr, "txt ");
printBox(tp->box);
fputs("\n", stderr);
- for (i = 0; i < tp->nlines; i++) {
+ for (i = 0; i < tp->nparas; i++) {
indent(ind + 1);
- fprintf(stderr, "(%c) \"%s\"\n", tp->line[i].just,
- tp->line[i].str);
+ fprintf(stderr, "(%c) \"%s\"\n", tp->para[i].just,
+ tp->para[i].str);
}
}
#endif
int i, j;
indent(ind);
- fprintf (stderr, "txt lines = %d \n", txt->nlines);
- for (i = 0; i < txt->nlines; i++) {
+ fprintf (stderr, "txt paras = %d \n", txt->nparas);
+ for (i = 0; i < txt->nparas; i++) {
indent(ind+1);
- fprintf (stderr, "[%d] %d items\n", i, txt->lines[i].nitems);
- for (j = 0; j < txt->lines[i].nitems; j++) {
+ fprintf (stderr, "[%d] %d items\n", i, txt->paras[i].nitems);
+ for (j = 0; j < txt->paras[i].nitems; j++) {
indent(ind+2);
fprintf (stderr, "[%d] (%f) \"%s\" ",
- j, txt->lines[i].items[j].size,
- txt->lines[i].items[j].str);
- if (txt->lines[i].items[j].font)
+ j, txt->paras[i].items[j].size,
+ txt->paras[i].items[j].str);
+ if (txt->paras[i].items[j].font)
fprintf (stderr, "font %s color %s size %f\n",
- txt->lines[i].items[j].font->name,
- txt->lines[i].items[j].font->color,
- txt->lines[i].items[j].font->size);
+ txt->paras[i].items[j].font->name,
+ txt->paras[i].items[j].font->color,
+ txt->paras[i].items[j].font->size);
else fprintf (stderr, "\n");
}
}
int cnt; /* reference count */
} htmlfont_t;
- /* lines of text within a cell
- * NOTE: As required, the str field in line is utf-8.
+ /* paras of text within a cell
+ * NOTE: As required, the str field in para is utf-8.
* This translation is done when libexpat scans the input.
*/
#ifdef OLD
typedef struct {
- textline_t *line;
- short nlines;
+ textpara_t *para;
+ short nparas;
box box;
htmlfont_t *font; /* font info */
} htmltxt_t;
textitem_t *items;
short nitems;
char just;
- double size; /* size of line */
- double lfsize; /* size of largest font in line */
- } htextline_t;
+ double size; /* size of para */
+ double lfsize; /* size of largest font in para */
+ } htextpara_t;
typedef struct {
- htextline_t *lines;
- short nlines;
+ htextpara_t *paras;
+ short nparas;
box box;
} htmltxt_t;
char *Gvfilepath;
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
codegen_t *Output_codegen;
#endif
assert(v); /* "dot" should always be available as an output format */
}
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
Output_codegen = gvc->jobs->codegen;
#endif
{
pointf size;
- lp->u.txt.line =
- ALLOC(lp->u.txt.nlines + 2, lp->u.txt.line, textline_t);
- lp->u.txt.line[lp->u.txt.nlines].str = line;
- size = textsize(g, &(lp->u.txt.line[lp->u.txt.nlines]),
+ lp->u.txt.para =
+ ALLOC(lp->u.txt.nparas + 2, lp->u.txt.para, textpara_t);
+ lp->u.txt.para[lp->u.txt.nparas].str = line;
+ size = textsize(g, &(lp->u.txt.para[lp->u.txt.nparas]),
lp->fontname, lp->fontsize);
- lp->u.txt.line[lp->u.txt.nlines].just = terminator;
- lp->u.txt.nlines++;
+ lp->u.txt.para[lp->u.txt.nparas].just = terminator;
+ lp->u.txt.nparas++;
/* total width = max line width */
if (lp->dimen.x < size.x)
lp->dimen.x = size.x;
/* recalculate total height */
- lp->dimen.y = lp->u.txt.nlines * (int) (size.y * LINESPACING);
+ lp->dimen.y = lp->u.txt.nparas * (int) (size.y * LINESPACING);
}
/* compiles <str> into a label <lp> and returns its bounding box size. */
return rv;
}
-static void free_textline(textline_t * tl)
+static void free_textpara(textpara_t * tl)
{
if (tl) {
if (tl->str)
if (p->html) {
free_html_label(p->u.html, 1);
} else {
- free_textline(p->u.txt.line);
+ free_textpara(p->u.txt.para);
}
free(p);
}
}
void
-emit_textlines(GVJ_t* job, int nlines, textline_t lines[], pointf p,
+emit_textparas(GVJ_t* job, int nparas, textpara_t paras[], pointf p,
double halfwidth_x, char* fname, double fsize, char* fcolor)
{
- int i, linespacing;
+ int i, paraspacing;
double tmp, center_x, left_x, right_x;
center_x = p.x;
left_x = center_x - halfwidth_x;
right_x = center_x + halfwidth_x;
- /* set linespacing to an exact no. of pixelrows */
- linespacing = (int) (fsize * LINESPACING);
+ /* set paraspacing to an exact no. of pixelrows */
+ paraspacing = (int) (fsize * LINESPACING);
- /* position for first line */
- p.y += linespacing * (nlines - 1) / 2 /* cl of topline */
+ /* position for first para */
+ p.y += paraspacing * (nparas - 1) / 2 /* cl of toppara */
- fsize * 0.30; /* Empirically determined fudge factor */
tmp = ROUND(p.y); /* align with integer points */
gvrender_set_pencolor(job, fcolor);
gvrender_set_font(job, fname, fsize);
- for (i = 0; i < nlines; i++) {
- switch (lines[i].just) {
+ for (i = 0; i < nparas; i++) {
+ switch (paras[i].just) {
case 'l':
p.x = left_x;
break;
p.x = center_x;
break;
}
- gvrender_textline(job, p, &(lines[i]));
+ gvrender_textpara(job, p, &(paras[i]));
- /* position for next line */
- p.y -= linespacing;
+ /* position for next para */
+ p.y -= paraspacing;
}
gvrender_end_context(job);
}
/* make sure that there is something to do */
- if (lp->u.txt.nlines < 1)
+ if (lp->u.txt.nparas < 1)
return;
p.x = lp->p.x;
/* dimensions of box for label, no padding, adjusted for resizing */
halfwidth_x = (lp->dimen.x + lp->d.x) / 2.0;
- emit_textlines(job, lp->u.txt.nlines, lp->u.txt.line, p,
+ emit_textparas(job, lp->u.txt.nparas, lp->u.txt.para, p,
halfwidth_x, lp->fontname, lp->fontsize, lp->fontcolor);
job->gvc->emit_state = oldstate;
}
return buf;
}
-static void mif_textline(point p, textline_t * line)
+static void mif_textpara(point p, textpara_t * para)
{
pointf mp;
- char *str = line->str;
char *anchor;
mp.x = p.x;
mp.y = p.y - cstk[SP].fontsz / 2 + 2;
- switch (line->just) {
+ switch (para->just) {
case 'l':
anchor = "Left";
break;
fprintf(Output_file,
"<TextLine <Angle %d> <TLOrigin %.2f %.2f> <TLAlignment %s>",
Rot, mp.x, mp.y, anchor);
- fprintf(Output_file, " <String `%s'>>\n", mif_string(str));
+ fprintf(Output_file, " <String `%s'>>\n", mif_string(para->str));
}
static void mif_bezier(point * A, int n, int arrow_at_start,
0, /* mif_begin_edge */ 0, /* mif_end_edge */
mif_begin_context, mif_end_context,
0, /* mif_begin_anchor */ 0, /* mif_end_anchor */
- mif_set_font, mif_textline,
+ mif_set_font, mif_textpara,
mif_set_color, mif_set_color, mif_set_style,
mif_ellipse, mif_polygon,
mif_bezier, mif_polyline,
return buf;
}
-static void mp_textline(point p, textline_t * line)
+static void mp_textpara(point p, textpara_t * para)
{
fprintf(Output_file, "label(btex %s etex,(%dbp,%dbp)) withcolor %s;\n",
- mp_string(line->str), p.x, p.y, S[SP].color);
+ mp_string(para->str), p.x, p.y, S[SP].color);
}
static void
0, /* mp_begin_edge */ 0, /* mp_end_edge */
mp_begin_context, mp_end_context,
0, /* mp_begin_anchor */ 0, /* mp_end_anchor */
- mp_set_font, mp_textline,
+ mp_set_font, mp_textpara,
mp_set_color, mp_set_color, mp_set_style,
mp_ellipse, mp_polygon,
mp_bezier, mp_polyline,
void write_extended_dot(GVJ_t *job, graph_t *g, FILE *f)
{
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
attach_attrs(g);
extend_attrs(job, g, s_arrows, e_arrows);
agwrite(g, f);
return buf;
}
-static void pic_textline(point p, textline_t * line)
+static void pic_textpara(point p, textpara_t * para)
{
pointf pf;
short flag = 0;
double fontsz = S[SP].size;
- switch (line->just) {
+ switch (para->just) {
case 'l':
p.x = p.x;
break;
case 'r':
- p.x = p.x - line->dimen.x;
+ p.x = p.x - para->width;
break;
default:
case 'n':
- p.x = p.x - line->dimen.x / 2;
+ p.x = p.x - para->width / 2;
break;
}
pf = cvt2ptf(p);
#endif
/* Why on earth would we do this either. But it works. SCN 2/26/2002 */
pf.y += fontsz / (3.0 * POINTS_PER_INCH);
- pf.x += line->dimen.x / (2.0 * POINTS_PER_INCH);
+ pf.x += para->width / (2.0 * POINTS_PER_INCH);
if (!(S[SP].size)) { /* size was never set in this or hierarchically higher context */
pic_set_font(S[SP].font, fontsz); /* primarily to output font and/or size directives */
for (flag = SP; ((S[flag].size = fontsz), flag); flag--) /* set size in contexts */
pic_set_font(S[SP - 1].font, fontsz);
}
fprintf(Output_file, "\"%s\" at (%.5f,%.5f);\n",
- pic_string(line->str), Scale * pf.x, Scale * pf.y);
+ pic_string(para->str), Scale * pf.x, Scale * pf.y);
if (flag)
pic_end_context();
}
pic_begin_edge, 0, /* pic_end_edge */
pic_begin_context, pic_end_context,
0, /* pic_begin_anchor */ 0, /* pic_end_anchor */
- pic_set_font, pic_textline,
+ pic_set_font, pic_textpara,
pic_set_color, pic_set_color, pic_set_style,
pic_ellipse, pic_polygon,
pic_bezier, pic_polyline,
extern void emit_label(GVJ_t * job, int state, textlabel_t *, void *obj);
extern int emit_once(char *message);
extern void emit_jobs_eof(GVC_t * gvc);
- extern void emit_textlines(GVJ_t*, int, textline_t*, pointf,
+ extern void emit_textparas(GVJ_t*, int, textpara_t*, pointf,
double, char*, double, char*);
extern void enqueue_neighbors(nodequeue *, Agnode_t *, int);
extern void endpath(path *, Agedge_t *, int, pathend_t *, bool);
extern void epsf_free(node_t * n);
extern void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows);
extern shape_desc *find_user_shape(char *);
- extern void free_line(textline_t *);
+ extern void free_line(textpara_t *);
extern void free_label(textlabel_t *);
extern char *gd_alternate_fontlist(char *font);
- extern char *gd_textsize(textline_t * textline, char *fontname,
+ extern char *gd_textsize(textpara_t * textpara, char *fontname,
double fontsz, char **fontpath);
extern void getdouble(graph_t * g, char *name, double *result);
extern splines *getsplinepoints(edge_t * e);
extern void shape_clip(node_t * n, point curve[4]);
extern void size_label (graph_t* g, textlabel_t* rv);
extern void start_timer(void);
- extern pointf textsize(graph_t *g, textline_t * textline,
+ extern pointf textsize(graph_t *g, textpara_t * para,
char *fontname, double fontsz);
extern void translate_bb(Agraph_t *, int);
extern void use_library(char *);
# define extern __EXPORT__
#endif
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
#ifndef HAVE_GD_FREETYPE
extern void initDPI(graph_t *);
extern double textheight(int nlines, double fontsz);
#include "htmltable.h"
#include <limits.h>
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
extern codegen_t VRML_CodeGen;
#endif
if (ND_shape(n) == point_desc) {
color = "black";
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
color = (Output_lang == MIF ? "black" : DEFAULT_FILL);
}
xsize = (16.0 * (ND_lw_i(n) + ND_rw_i(n)) / POINTS(ND_width(n)));
ysize = (16.0 * ND_ht_i(n) / POINTS(ND_height(n)));
-#if !defined(DISABLE_CODEGENS) && defined(HAVE_GD_PNG)
+#if defined(WITH_CODEGENS) && defined(HAVE_GD_PNG)
/* this is bad, but it's because of how the VRML driver works */
if ((job->codegen == &VRML_CodeGen) && (peripheries == 0)) {
peripheries = 1;
* AT&T Research, Florham Park NJ *
**********************************************************/
-#include "gvplugin.h"
+#ifndef TEXTPARA_H
+#define TEXTPARA_H
-struct lt_symlist
-{
- const char *name;
- void* address;
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
-#if 1
-extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
-extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
+#include "geom.h"
-const struct lt_symlist lt_preloaded_symbols[] = {
- { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
- { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
- { 0, 0 }
-};
-#else
-const struct lt_symlist lt_preloaded_symbols[] = {{0,0,},};
-#endif
+ typedef struct textpara_t {
+ char *str; /* stored in utf-8 */
+ char *xshow;
+ void *layout;
+ void (*free_layout) (void *layout); /* FIXME - this is ugly */
+ double width, height;
+ char just;
+ } textpara_t;
+#ifdef __cplusplus
+}
+#endif
+#endif
#include "pathplan.h"
#include "color.h"
#include "gvcext.h"
+#include "textpara.h"
+#include "usershape.h"
#ifdef __cplusplus
extern "C" {
int size;
} splinesf;
- typedef enum { FT_BMP, FT_GIF, FT_PNG, FT_JPEG, FT_PDF, FT_PS, FT_EPS } imagetype_t;
-
- typedef struct usershape_s {
- char *name;
- FILE *f;
- imagetype_t type;
- unsigned int w, h, dpi;
- void *data; /* data loaded by a renderer */
- void (*datafree)(void *data); /* renderer's function for freeing data */
- } usershape_t;
-
- typedef struct textline_t {
- char *str; /* stored in utf-8 */
- char *xshow;
- void *layout;
- void (*free_layout) (void *layout); /* FIXME - this is ugly */
- pointf dimen;
- char just;
- } textline_t;
-
typedef struct textlabel_t {
char *text, *fontname, *fontcolor;
double fontsize;
pointf d; /* delta from resizing */
union {
struct {
- textline_t *line;
- short nlines;
+ textpara_t *para;
+ short nparas;
} txt;
htmllabel_t *html;
} u;
bool usershape;
} shape_desc;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
struct codegen_s {
void (*reset) (void);
void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
void (*begin_anchor) (char *href, char *tooltip, char *target);
void (*end_anchor) (void);
void (*set_font) (char *fontname, double fontsize);
- void (*textline) (point p, textline_t * str);
+ void (*textpara) (point p, textpara_t * str);
void (*set_pencolor) (char *name);
void (*set_fillcolor) (char *name);
void (*set_style) (char **s);
* AT&T Research, Florham Park NJ *
**********************************************************/
-#include "gvplugin.h"
+#ifndef USERSHAPE_H
+#define USERSHAPE_H
-struct lt_symlist
-{
- const char *name;
- void* address;
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
-#if 1
-extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
-extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
+ typedef enum { FT_BMP, FT_GIF, FT_PNG, FT_JPEG, FT_PDF, FT_PS, FT_EPS } imagetype_t;
-const struct lt_symlist lt_preloaded_symbols[] = {
- { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
- { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
- { 0, 0 }
-};
-#else
-const struct lt_symlist lt_preloaded_symbols[] = {{0,0,},};
-#endif
+ typedef struct usershape_s {
+ char *name;
+ FILE *f;
+ imagetype_t type;
+ unsigned int w, h, dpi;
+ void *data; /* data loaded by a renderer */
+ void (*datafree)(void *data); /* renderer's function for freeing data */
+ } usershape_t;
+#ifdef __cplusplus
+}
+#endif
+#endif
return buf;
}
-static void vtx_textline(point p, textline_t * line)
+static void vtx_textpara(point p, textpara_t * para)
{
pointf mp;
double fontsz = Scale * cstk[SP].fontsz;
"{\\fonttbl{\\f0\\fnil helvetica medium;}}\n"
"{\\colortbl\\red0\\green0\\blue0;}\n"
"\\cf0\\plain\\pard {\\fs%d %s}})\n",
- (int) ((fontsz * 2) - 8), vtx_string(line->str));
+ (int) ((fontsz * 2) - 8), vtx_string(para->str));
} else {
fprintf(Output_file, " (showText T)\n"
" (textVerticalAlignment \"left\")\n"
"{\\fonttbl{\\f0\\fnil helvetica medium;}}\n"
"{\\colortbl\\red0\\green0\\blue0;}\n"
"\\cf0\\plain\\pard {\\fs%d %s}})\n",
- (int) ((fontsz * 2) - 8), vtx_string(line->str));
+ (int) ((fontsz * 2) - 8), vtx_string(para->str));
}
}
vtx_begin_edge, vtx_end_edge,
vtx_begin_context, vtx_end_context,
0, /* vtx_begin_anchor */ 0, /* vtx_end_anchor */
- vtx_set_font, vtx_textline,
+ vtx_set_font, vtx_textpara,
vtx_set_color, vtx_set_color, vtx_set_style,
vtx_ellipse, vtx_polygon,
vtx_bezier, vtx_polyline,
* AT&T Research, Florham Park NJ *
**********************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "gvplugin.h"
extern gvplugin_library_t *gvplugin_dot_layout_LTX_library;
extern gvplugin_library_t *gvplugin_neato_layout_LTX_library;
extern gvplugin_library_t *gvplugin_gd_LTX_library;
+extern gvplugin_library_t *gvplugin_pango_LTX_library;
const lt_symlist_t lt_preloaded_symbols[] = {
{ "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
{ "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
+ { "gvplugin_pango_LTX_library", (void*)(&gvplugin_gd_LTX_library) },
{ "gvplugin_gd_LTX_library", (void*)(&gvplugin_gd_LTX_library) },
{ 0, 0 }
};
extern "C" {
#endif
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
typedef struct codegen_s codegen_t;
typedef struct codegen_info_s codegen_info_t;
#endif
gvplugin_active_device_t device;
gvdevice_callbacks_t *callbacks;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
codegen_t *codegen; /* current codegen */
#endif
#include "gvcint.h"
#include "gvcproc.h"
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
#ifdef QUARTZ_RENDER
#include <QuickTime/QuickTime.h>
}
#endif
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
#define MAX_CODEGENS 100
#define MAX_SZ_CONFIG 100000
#endif
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
codegen_info_t *p;
for (p = cg; p->name; ++p)
/* textlayout */
extern int gvtextlayout_select(GVC_t * gvc);
- extern bool gvtextlayout(GVC_t *gvc, textline_t *textline,
+ extern bool gvtextlayout(GVC_t *gvc, textpara_t *para,
char *fontname, double fontsize, char **fontpath);
/* usershapes */
extern void gvrender_end_anchor(GVJ_t * job);
extern void gvrender_set_font(GVJ_t * job, char *fontname,
double fontsize);
- extern void gvrender_textline(GVJ_t * job, pointf p, textline_t * str);
+ extern void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para);
extern void gvrender_set_pencolor(GVJ_t * job, char *name);
extern void gvrender_set_fillcolor(GVJ_t * job, char *name);
extern void gvrender_set_style(GVJ_t * job, char **s);
GVC_t *gvc = job->gvc;
gvplugin_available_t *plugin;
gvplugin_installed_t *typeptr;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
codegen_info_t *cg_info;
#endif
plugin = gvplugin_load(gvc, API_device, str);
if (plugin) {
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
if (strcmp(plugin->packagename, "cg") == 0) {
cg_info = (codegen_info_t *) (plugin->typeptr);
job->codegen = cg_info->cg;
(gvdevice_features_t *) (typeptr->features);
job->device.id = typeptr->id;
return GVRENDER_PLUGIN;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
}
#endif
}
gvde->finalize(firstjob);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = firstjob->codegen;
#include "gvplugin.h"
#include "gvcjob.h"
+#include "color.h"
+#include "textpara.h"
+#include "usershape.h"
#ifdef __cplusplus
extern "C" {
void (*begin_anchor) (GVJ_t * job, char *href, char *tooltip,
char *target);
void (*end_anchor) (GVJ_t * job);
- void (*textline) (GVJ_t * job, pointf p, textline_t * str);
+ void (*textpara) (GVJ_t * job, pointf p, textpara_t * str);
void (*resolve_color) (GVJ_t * job, gvcolor_t * color);
void (*ellipse) (GVJ_t * job, pointf * A, int filled);
void (*polygon) (GVJ_t * job, pointf * A, int n, int filled);
#define GVTEXTLAYOUT_PLUGIN_H
#include "gvplugin.h"
-#include "gvcint.h"
+#include "gvcjob.h"
+#include "textpara.h"
#ifdef __cplusplus
extern "C" {
#endif
struct gvtextlayout_engine_s {
- void (*textlayout) (textline_t *textline, char *fontname, double fontsize, char** fontpath);
+ void (*textlayout) (textpara_t *para, char *fontname, double fontsize, char** fontpath);
};
#ifdef __cplusplus
extern int emit_once(char *str);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
extern codegen_t PS_CodeGen;
#endif
/* storage for temporary hacks until client API is FP */
static pointf *AF;
static int sizeAF;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
static point *A;
static int sizeA;
#endif
gvplugin_available_t *plugin;
gvplugin_installed_t *typeptr;
char *device;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
codegen_info_t *cg_info;
#endif
plugin = gvplugin_load(gvc, API_render, str);
if (plugin) {
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
if (strcmp(plugin->packagename, "cg") == 0) {
cg_info = (codegen_info_t *) (plugin->typeptr);
job->codegen = cg_info->cg;
job->device.id = typeptr->id;
}
return GVRENDER_PLUGIN;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
}
#endif
}
if (gvre) {
features = job->render.features->flags;
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
GVC_t *gvc = job->gvc;
gvrender_engine_t *gvre = job->render.engine;
if (gvc->gvg) {
- job->input_filename = gvc->gvg->input_filename;
- job->graph_index = gvc->gvg->graph_index;
+ job->input_filename = gvc->gvg->input_filename;
+ job->graph_index = gvc->gvg->graph_index;
}
else {
job->input_filename = NULL;
if (gvre->begin_job)
gvre->begin_job(job);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_job)
gvre->end_job(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
job->style->fill = FILL_NONE;
job->style->penwidth = PENWIDTH_NORMAL;
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_graph)
gvre->end_graph(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->begin_page)
gvre->begin_page(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
point offset;
if (gvre && gvre->end_page)
gvre->end_page(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->begin_layer)
gvre->begin_layer(job, job->gvc->layerIDs[job->layerNum], job->layerNum, job->numLayers);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_layer)
gvre->end_layer(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvrender_engine_t *gvre = job->render.engine;
job->gvc->sg = sg; /* set current cluster graph object */
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
Obj = CLST;
#endif
if (gvre && gvre->begin_cluster)
gvre->begin_cluster(job, sg->name, sg->meta_node->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_cluster)
gvre->end_cluster(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->begin_nodes)
gvre->begin_nodes(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_nodes)
gvre->end_nodes(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->begin_edges)
gvre->begin_edges(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_edges)
gvre->end_edges(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
{
gvrender_engine_t *gvre = job->render.engine;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
Obj = NODE;
#endif
job->gvc->n = n; /* set current node */
if (gvre && gvre->begin_node)
gvre->begin_node(job, n->name, n->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_node)
gvre->end_node(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
{
gvrender_engine_t *gvre = job->render.engine;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
Obj = EDGE;
#endif
job->gvc->e = e; /* set current edge */
gvre->begin_edge(job, e->tail->name,
e->tail->graph->root->kind & AGFLAG_DIRECTED,
e->head->name, e->id);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_edge)
gvre->end_edge(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvc->styles[gvc->SP] = gvc->styles[(gvc->SP) - 1];
job->style = &(gvc->styles[gvc->SP]);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
assert(gvc->SP >= 0);
job->style = &(gvc->styles[gvc->SP]);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->begin_anchor)
gvre->begin_anchor(job, href, tooltip, target);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->end_anchor)
gvre->end_anchor(job);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
job->style->fontfam = fontname;
job->style->fontsz = fontsize;
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
#endif
}
-void gvrender_textline(GVJ_t * job, pointf p, textline_t * line)
+void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para)
{
gvrender_engine_t *gvre = job->render.engine;
- if (line->str && line->str[0]) {
- if (gvre && gvre->textline) {
+ if (para->str && para->str[0]) {
+ if (gvre && gvre->textpara) {
if (job->style->pen != PEN_NONE) {
- gvre->textline(job, gvrender_ptf(job, p), line);
+ gvre->textpara(job, gvrender_ptf(job, p), para);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
point P;
PF2P(p, P);
- if (cg && cg->textline)
- cg->textline(P, line);
+ if (cg && cg->textpara)
+ cg->textpara(P, para);
}
#endif
}
if (gvre->resolve_color)
gvre->resolve_color(job, color);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre->resolve_color)
gvre->resolve_color(job, color);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
}
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->ellipse(job, af, filled);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->ellipse(job, AF, filled);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->polygon(job, AF, n, filled);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->polygon(job, AF, n, filled);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->beziercurve(job, AF, n, arrow_at_start, arrow_at_end,filled);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
int i;
gvre->polyline(job, AF, n);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
gvre->polyline(job, AF, n);
}
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->comment) {
gvre->comment(job, str);
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
if (gvre && gvre->usershape)
gvre->usershape(job, us, b, filled);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
else {
codegen_t *cg = job->codegen;
#include "const.h"
#include "types.h"
#include "gvplugin_textlayout.h"
+#include "gvcint.h"
#include "gvcproc.h"
int gvtextlayout_select(GVC_t * gvc)
return NO_SUPPORT;
}
-bool gvtextlayout(GVC_t *gvc, textline_t *textline, char *fontname, double fontsize, char **fontpath)
+bool gvtextlayout(GVC_t *gvc, textpara_t *para, char *fontname, double fontsize, char **fontpath)
{
gvtextlayout_engine_t *gvte = gvc->textlayout.engine;
if (gvte && gvte->textlayout) {
- gvte->textlayout(textline, fontname, fontsize, fontpath);
+ gvte->textlayout(para, fontname, fontsize, fontpath);
return TRUE;
}
return FALSE;
* AT&T Research, Florham Park NJ *
**********************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "gvplugin.h"
const lt_symlist_t lt_preloaded_symbols[] = { { 0, 0 } };
#include <string.h>
#include <fcntl.h>
#include <math.h>
-#include <gd.h>
-
-#include "color.h"
-#include "types.h"
#include "gvplugin_render.h"
+#ifdef HAVE_LIBGD
+#include "gd.h"
+
typedef enum { FORMAT_GD, FORMAT_GD2, FORMAT_GIF, FORMAT_JPEG, FORMAT_PNG,
FORMAT_WBMP, FORMAT_XBM, } format_type;
}
#endif
-static void gdgen_textline(GVJ_t * job, pointf p, textline_t * line)
+static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
{
gvstyle_t *style = job->style;
gdImagePtr im = (gdImagePtr) job->surface;
char *fontlist, *err;
pointf mp, ep;
int brect[8];
- char *str = line->str;
- double linewidth = line->dimen.x * job->compscale.x;
+ char *str = para->str;
+ double parawidth = para->width * job->compscale.x;
double fontsz = style->fontsz;
gdFTStringExtra strex;
fontlist = gdgen_alternate_fontlist(style->fontfam);
- switch (line->just) {
+ switch (para->just) {
case 'l':
mp.x = 0.0;
break;
case 'r':
- mp.x = -linewidth;
+ mp.x = -parawidth;
break;
default:
case 'n':
- mp.x = -linewidth / 2;
+ mp.x = -parawidth / 2;
break;
}
- ep.x = mp.x + linewidth;
+ ep.x = mp.x + parawidth;
if (job->rotation) {
mp.y = -mp.x + p.y;
if (fontsz * job->compscale.x <= FONTSIZE_MUCH_TOO_SMALL) {
/* ignore entirely */
} else if (fontsz * job->compscale.x <= FONTSIZE_TOO_SMALL) {
- /* draw line in place of text */
+ /* draw para in place of text */
gdImageLine(im, ROUND(mp.x), ROUND(mp.y),
ROUND(ep.x), ROUND(ep.y),
style->pencolor.u.index);
#endif
#if 0
fprintf(stderr,
- "textline: font=%s size=%g pos=%g,%g width=%g dpi=%d width/dpi=%g\n",
+ "textpara: font=%s size=%g pos=%g,%g width=%g dpi=%d width/dpi=%g\n",
fontlist, fontsz, mp.x, mp.y, (double) (brect[4] - brect[0]),
strex.hdpi,
(((double) (brect[4] - brect[0])) / strex.hdpi));
0, /* gdgen_end_edge */
0, /* gdgen_begin_anchor */
0, /* gdgen_end_anchor */
- gdgen_textline,
+ gdgen_textpara,
gdgen_resolve_color,
gdgen_ellipse,
gdgen_polygon,
NULL, /* device */
};
+#endif
+
gvplugin_installed_t gvrender_gd_types[] = {
+#ifdef HAVE_LIBGD
#if 0
{FORMAT_GD, "gd", 1, &gdgen_engine, &gdgen_features_tc},
{FORMAT_GD2, "gd2", 1, &gdgen_engine, &gdgen_features_tc},
{FORMAT_WBMP, "wbmp", 1, &gdgen_engine, &gdgen_features},
#ifdef HAVE_GD_XPM
{FORMAT_XBM, "xbm", 1, &gdgen_engine, &gdgen_features},
+#endif
#endif
{0, NULL, 0, NULL, NULL}
};
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "gvplugin_textlayout.h"
+#ifdef HAVE_LIBGD
#include "gd.h"
-/* FIXME - shouldn't need this */
-#include "types.h"
-
-#include "gvplugin_textlayout.h"
-
/* fontsize at which text is omitted entirely */
#define FONTSIZE_MUCH_TOO_SMALL 0.15
/* fontsize at which text is rendered by a simple line */
#endif /* HAVE_GD_FONTCONFIG */
}
-void textlayout(textline_t * textline, char *fontname, double fontsize, char **fontpath)
+void textlayout(textpara_t * para, char *fontname, double fontsize, char **fontpath)
{
static char *fntpath;
char *fontlist, *err;
else
strex.flags |= gdFTEX_FONTCONFIG;
- textline->dimen.x = 0.0;
- textline->dimen.y = 0.0;
- textline->xshow = NULL;
+ para->width = 0.0;
+ para->width = 0.0;
+ para->xshow = NULL;
fontlist = gd_alternate_fontlist(fontname);
- textline->layout = (void*)fontlist;
- textline->free_layout = NULL; /* no need to free fontlist (??) */
+ para->layout = (void*)fontlist;
+ para->free_layout = NULL; /* no need to free fontlist (??) */
if (fontlist) {
}
/* call gdImageStringFT with null *im to get brect and to set font cache */
err = gdImageStringFTEx(NULL, brect, -1, fontlist,
- fontsize, 0, 0, 0, textline->str, &strex);
+ fontsize, 0, 0, 0, para->str, &strex);
if (err)
return;
if (strex.xshow) {
- /* transfer malloc'ed xshow string to textline */
- textline->xshow = strex.xshow;
+ /* transfer malloc'ed xshow string to para */
+ para->xshow = strex.xshow;
strex.xshow = NULL;
}
free(fntpath);
*fontpath = fntpath = strex.fontpath;
- if (textline->str && textline->str[0]) {
+ if (para->str && para->str[0]) {
/* can't use brect on some archtectures if strlen 0 */
- textline->dimen.x = (double) (brect[4] - brect[0]);
- textline->dimen.y = (double) (brect[5] - brect[1]);
+ para->width = (double) (brect[4] - brect[0]);
+ para->height = (double) (brect[5] - brect[1]);
}
}
}
gvtextlayout_engine_t textlayout_engine = {
textlayout,
};
+#endif
gvplugin_installed_t gvtextlayout_gd_types[] = {
+#ifdef HAVE_LIBGD
{0, "textlayout", 2, &textlayout_engine, NULL},
+#endif
{0, NULL, 0, NULL, NULL}
};
html_DATA = $(html)
endif
-if !DISABLE_CODEGENS
+if WITH_CODEGENS
CODEGENS = tkgen.c
endif
extern int Gdtclft_Init(Tcl_Interp *);
#endif
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
extern codegen_t TK_CodeGen;
static codegen_info_t cg[] = { {&TK_CodeGen, "tk", TK},
{NULL, NULL, 0}, };
int Tcldot_Init(Tcl_Interp * interp)
{
GVC_t *gvc;
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
codegen_info_t *p;
#endif
/* configure for available plugins and codegens */
gvconfig(gvc, FALSE);
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
/* additional codegens */
for (p = cg; p->name; ++p)
gvplugin_install(gvc, API_render, p->name, 0, "cg", NULL,
}
}
-static void tk_textline(point p, textline_t * line)
+static void tk_textpara(point p, textpara_t * para)
{
- char *str = line->str;
+ char *str = para->str;
double fontsz = cstk[SP].fontsz;
tkgen_start_item("text");
if (cstk[SP].pencolor[0])
tkgen_append_attribute("-fill", cstk[SP].pencolor);
tkgen_append_attribute("-font", fontname);
- switch (line->just) {
+ switch (para->just) {
case 'l':
tkgen_append_attribute("-anchor", "w");
break;
tk_begin_edge, 0, /* tk_end_edge */
tk_begin_context, tk_end_context,
0, /* tk_begin_anchor */ 0, /* tk_end_anchor */
- tk_set_font, tk_textline,
+ tk_set_font, tk_textpara,
tk_set_pencolor, tk_set_fillcolor, tk_set_style,
tk_ellipse, tk_polygon,
tk_bezier, tk_polyline,
/* <stdlib.h> <stdarg.h> <string.h> <float.h> */
#define STDC_HEADERS 1
-/* Set to 0 if you don't want the old codegens */
-#define ENABLE_CODEGENS 1
+/* Define to 1 if you the old codegens */
+#define WITH_CODEGENS 1
/* Define if you don't want on-demand plugin loading */
#define DISABLE_LTDL 1