dot_static_LDADD = \
$(top_builddir)/lib/plugin/.libs/libgvplugin_dot_layout.a \
$(top_builddir)/lib/plugin/.libs/libgvplugin_neato_layout.a \
+ $(top_builddir)/lib/plugin/.libs/libgvplugin_gd.a \
+ $(top_builddir)/lib/plugin/.libs/libgvplugin_pangocairo.a \
$(top_builddir)/lib/gvc/.libs/libgvc_builtins.a \
$(top_builddir)/lib/pathplan/.libs/libpathplan.a \
$(top_builddir)/lib/pack/.libs/libpack.a \
$(top_builddir)/lib/graph/.libs/libgraph.a \
$(top_builddir)/lib/cdt/.libs/libcdt.a \
- @GD_LIBS_STATIC@ @ICONV_LIBS@ @FC_LIBS@ @FT_LIBS@ @JPEG_LIBS@ @PNG_LIBS@ @MATH_LIBS@ @EXPAT_LIBS@ @Z_LIBS@ @LIBGEN_LIBS@ @LIBLTDL@ @SOCKET_LIBS@ @IPSEPCOLA_LIBS@
+ @PANGOCAIRO_LIBS@ @GD_LIBS_STATIC@ @ICONV_LIBS@ @FC_LIBS@ @FT_LIBS@ @JPEG_LIBS@ @PNG_LIBS@ @EXPAT_LIBS@ @Z_LIBS@ @LIBGEN_LIBS@ @LIBLTDL@ @SOCKET_LIBS@ @IPSEPCOLA_LIBS@
EXTRA_DIST = Makefile.old dot.1 dot.pdf
dnl -----------------------------------
dnl old codegens
-AC_ARG_ENABLE(codegens,
- [AC_HELP_STRING([--disable-codegens], [don't build old codegens])])
-if test "x$enable_codegens" = "xno"; then
- AC_DEFINE(DISABLE_CODEGENS,1,[Define if you don't want the old codegens])
+AC_ARG_WITH(codegens,
+ [AC_HELP_STRING([--with-codegens],
+ [use old codegens])])
+
+### default is to build with codegens
+if test "x$with_codegens" != "xno"; then
+ with_codegens=yes
+fi
+
+if test "x$with_codegens" = "xyes"; then
+ AC_DEFINE(WITH_CODEGENS,1,[Define if you want the old codegens])
fi
-AM_CONDITIONAL(DISABLE_CODEGENS, [test "x$enable_codegens" = "xno"])
+AM_CONDITIONAL(WITH_CODEGENS, [test "x$with_codegens" = "xyes"])
dnl -----------------------------------
dnl ElectricFence support for debugging
dnl -----------------------------------
dnl INCLUDES and LIBS for PANGO, CAIRO et.al.
+AC_ARG_WITH(libgd,
+ [AC_HELP_STRING([--with-pangocairo],
+ [use pangocairo library])])
+
+### default is to build with pangocairo
+if test "x$with_pangocairo" != "xno"; then
+ with_pangocairo=yes
+fi
+
+if test "x$with_pangocairo" = "xyes"; then
PKG_CHECK_MODULES(PANGOCAIRO, [pangocairo >= 1.0],
[HAVE_PANGOCAIRO=1
AC_DEFINE_UNQUOTED(HAVE_PANGOCAIRO,1,
[Define if you have the pango library with cairo support])],
[AC_MSG_WARN(pangocairo library not available)])
+fi
AC_SUBST(PANGOCAIRO_CFLAGS)
AC_SUBST(PANGOCAIRO_LIBS)
AM_CONDITIONAL(WITH_PANGOCAIRO, [test "x$HAVE_PANGOCAIRO" != "x"])
dnl -----------------------------------
dnl INCLUDES and LIBS for GD
-### default is to not build with libgd
-
AC_ARG_WITH(libgd,
[AC_HELP_STRING([--with-libgd],
[use gd library])])
[AC_HELP_STRING([--with-mylibgd],
[use internal gd library in preference to any installed libgd])])
+### default is to build with libgd
if test "x$with_libgd" != "xno"; then
with_libgd=yes
fi
-I$(top_srcdir)/lib/graph \
-I$(top_srcdir)/lib/cdt @GD_INCLUDES@ @EXPAT_INCLUDES@ @Z_INCLUDES@
-pkginclude_HEADERS = logic.h arith.h geom.h color.h types.h globals.h
+pkginclude_HEADERS = logic.h arith.h geom.h color.h types.h globals.h textpara.h usershape.h
noinst_HEADERS = render.h utils.h memory.h \
geomprocs.h colorprocs.h colortbl.h entities.h \
const.h macros.h htmllex.h htmltable.h pointset.h
noinst_LTLIBRARIES = libcommon.la
-if !DISABLE_CODEGENS
if WITH_LIBGD
-CODEGENS = diagen.c figgen.c hpglgen.c gdgen.c mapgen.c mifgen.c mpgen.c \
- picgen.c psgen.c svggen.c vrmlgen.c vtxgen.c ps.txt xdgen.c color_names
-else
-CODEGENS = diagen.c figgen.c hpglgen.c mapgen.c mifgen.c mpgen.c \
- picgen.c psgen.c svggen.c vtxgen.c ps.txt xdgen.c color_names
+GD_CODEGENS = gdgen.c vrmlgen.c
endif
+
+if WITH_CODEGENS
+CODEGENS = $(GD_CODEGENS) diagen.c figgen.c hpglgen.c mapgen.c mifgen.c mpgen.c \
+ picgen.c psgen.c svggen.c vtxgen.c ps.txt xdgen.c color_names
endif
/* if (cp->style_was_set) dia_style(cp); */
}
-static void dia_textline(point p, textline_t * line)
+static void dia_textpara(point p, textpara_t * para)
{
int anchor;
char *string;
pointf mp;
context_t *cp;
- string = xml_string(line->str);
+ string = xml_string(para->str);
if (strlen(string) == 0) {
/* its zero length, don't draw */
return;
/* its invisible, don't draw */
return;
}
- switch (line->just) {
+ switch (para->just) {
case 'l':
anchor = 0;
break;
dia_fputs(" </dia:attribute>\n");
dia_fputs(" <dia:attribute name=\"obj_bb\">\n");
dia_printf(" <dia:rectangle val=\"%g,%g;%g,%g\"/>\n",
- mp.x - (Scale * (line->dimen.x) / 2.), mp.y - 0.4,
- mp.x + (Scale * (line->dimen.x) / 2.), mp.y + 0.4);
+ mp.x - (Scale * (para->width) / 2.), mp.y - 0.4,
+ mp.x + (Scale * (para->width) / 2.), mp.y + 0.4);
dia_fputs(" </dia:attribute>\n");
dia_fputs(" </dia:object>\n");
}
dia_begin_edge, dia_end_edge,
dia_begin_context, dia_end_context,
0, /* dia_begin_anchor */ 0, /* dia_end_anchor */
- dia_set_font, dia_textline,
+ dia_set_font, dia_textpara,
dia_set_pencolor, dia_set_fillcolor, dia_set_style,
dia_ellipse, dia_polygon,
dia_bezier, dia_polyline,
return;
}
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
Output_file = job->output_file;
Output_lang = job->output_lang;
#endif
return buf;
}
-static void fig_textline(point p, textline_t * line)
+static void fig_textpara(point p, textpara_t * para)
{
int object_code = 4; /* always 4 for text */
int sub_type = 0; /* text justification */
double length = 0.0;
point mp;
- switch (line->just) {
+ switch (para->just) {
case 'l':
sub_type = 0;
break;
"%d %d %d %d %d %d %.1f %.4f %d %.1f %.1f %d %d %s\\001\n",
object_code, sub_type, color, depth, pen_style, font,
font_size, angle, font_flags, height, length, mp.x, mp.y,
- fig_string(line->str));
+ fig_string(para->str));
}
static void fig_bezier(point * A, int n, int arrow_at_start,
0, /* fig_begin_edge */ 0, /* fig_end_edge */
fig_begin_context, fig_end_context,
0, /* fig_begin_anchor */ 0, /* fig_end_anchor */
- fig_set_font, fig_textline,
+ fig_set_font, fig_textpara,
fig_set_pencolor, fig_set_fillcolor, fig_set_style,
fig_ellipse, fig_polygon,
fig_bezier, fig_polyline,
/* estimate_textsize:
* Estimate width and height of text, for given face and size, in points.
- * Value is stored textline->size.
+ * Value is stored para->width.
* NOTE: Tables are based on a font of size 1. Need to multiply by
* fontsize to get appropriate value.
*/
static void
-estimate_textsize(graph_t *g, textline_t * textline, char *fontname, double fontsz, char **fontpath)
+estimate_textsize(graph_t *g, textpara_t * para, char *fontname, double fontsz, char **fontpath)
{
double *Fontwidth;
char c, *p;
- textline->dimen.x = 0.0;
- textline->dimen.y = fontsz;
- textline->xshow = NULL;
- textline->layout = NULL;
- textline->free_layout = NULL;
+ para->width = 0.0;
+ para->width = fontsz;
+ para->xshow = NULL;
+ para->layout = NULL;
+ para->free_layout = NULL;
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE) && defined(HAVE_LIBGD)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE) && defined(HAVE_LIBGD)
if (Output_codegen == &GD_CodeGen) {
- double scale = GD_drawing(g)->dpi) / POINTS_PER_INCH;
+ double scale = GD_drawing(g)->dpi / POINTS_PER_INCH;
double fsize = fontsz * scale; /* in pixels */
*fontpath = "[internal gd]";
- if ((p = textline->str))
- textline->dimen.x = strlen(p) * builtinFontWd(fsize) / scale;
- textline->dimen.y = builtinFontHt(fsize) / scale;
+ if ((p = para->str))
+ para->width = strlen(p) * builtinFontWd(fsize) / scale;
+ para->height = builtinFontHt(fsize) / scale;
return;
}
#endif
*fontpath = "[internal times]";
Fontwidth = timesFontWidth;
}
- if ((p = textline->str)) {
+ if ((p = para->str)) {
while ((c = *p++))
- textline->dimen.x += Fontwidth[(unsigned char) c];
- textline->dimen.x *= fontsz;
+ para->width += Fontwidth[(unsigned char) c];
+ para->width *= fontsz;
}
}
-pointf textsize(graph_t *g, textline_t * textline, char *fontname, double fontsize)
+pointf textsize(graph_t *g, textpara_t * para, char *fontname, double fontsize)
{
char *fontpath = NULL;
+ pointf size;
- if (! gvtextlayout(GD_gvc(g), textline, fontname, fontsize, &fontpath))
- estimate_textsize(g, textline, fontname, fontsize, &fontpath);
+ if (! gvtextlayout(GD_gvc(g), para, fontname, fontsize, &fontpath))
+ estimate_textsize(g, para, fontname, fontsize, &fontpath);
if (Verbose) {
if (emit_once(fontname)) {
fontname, fontpath);
}
}
- return textline->dimen;
+ size.x = para->width;
+ size.y = para->height;
+ return size;
}
extern gdFontPtr gdFontTiny, gdFontSmall, gdFontMediumBold, gdFontLarge,
gdFontGiant;
-#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
+#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
/* builtinFont:
* Map fontsz in pixels to builtin font.
*/
}
#endif
-static void gd_textline(point p, textline_t * line)
+static void gd_textpara(point p, textpara_t * para)
{
char *str, *fontlist, *err;
pointf mp, ep;
else
strex.flags |= gdFTEX_FONTCONFIG;
- str = line->str;
- fontlist = (char *)(line->layout); /* FIXME - kluge */
+ str = para->str;
+ fontlist = (char *)(para->layout); /* FIXME - kluge */
fontsz = cstk[SP].fontsz;
- switch (line->just) {
+ switch (para->just) {
case 'l':
mp.x = p.x;
break;
case 'r':
- mp.x = p.x - line->dimen.x;
+ mp.x = p.x - para->width;
break;
default:
case 'n':
- mp.x = p.x - line->dimen.x / 2;
+ mp.x = p.x - para->width / 2;
break;
}
ep.y = mp.y = p.y;
- ep.x = mp.x + line->dimen.x;
+ ep.x = mp.x + para->width;
mp = gdpt(mp);
if (fontsz <= FONTSIZE_MUCH_TOO_SMALL) {
#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, /* gd_begin_edge */ 0, /* gd_end_edge */
gd_begin_context, gd_end_context,
0, /* gd_begin_anchor */ 0, /* gd_end_anchor */
- gd_set_font, gd_textline,
+ gd_set_font, gd_textpara,
gd_set_pencolor, gd_set_fillcolor, gd_set_style,
gd_ellipse, gd_polygon,
gd_bezier, gd_polyline,
EXTERN char *specificItems;
external char *Gvfilepath; /* Path of files allowed in 'shapefile' attrib (also ps libs) */
-#ifndef DISABLE_CODEGENS
+#ifdef WITH_CODEGENS
EXTERN int Output_lang; /* POSTSCRIPT, DOT, etc. */
EXTERN FILE *Output_file;
EXTERN int Obj;
}
}
-static void hpgl_textline(point p, textline_t * line)
+static void hpgl_textpara(point p, textpara_t * para)
{
char buffer[128];
- char *str = line->str;
if (isInvis())
return;
- switch (line->just) {
+ switch (para->just) {
case 'l':
break;
case 'r':
- p.x -= line->dimen.x;
+ p.x -= para->width;
break;
default:
case 'n':
- p.x -= line->dimen.x / 2;
+ p.x -= para->width / 2;
break;
}
sprintf(buffer, "PA%d,%d%s", CX(p.x), CY(p.y), Sep);
output(buffer);
- output_text(str);
+ output_text(para->str);
#ifdef HPDEBUG
- fprintf(stderr, "text =%s=\n", str);
+ fprintf(stderr, "text =%s=\n", para->str);
#endif
}
0, /* hpgl_begin_edge */ 0, /* hpgl_end_edge */
hpgl_begin_context, hpgl_end_context,
0, /* hpgl_begin_anchor */ 0, /* hpgl_end_anchor */
- hpgl_set_font, hpgl_textline,
+ hpgl_set_font, hpgl_textpara,
hpgl_set_color, hpgl_set_color, hpgl_set_style,
hpgl_ellipse, hpgl_polygon,
hpgl_bezier, hpgl_polyline,
map_begin_edge, 0, /* map_end_edge */
0, /* map_begin_context */ 0, /* map_end_context */
map_begin_anchor, map_end_anchor,
- 0, /* map_set_font */ 0, /* map_textline */
+ 0, /* map_set_font */ 0, /* map_textpara */
0, /* map_set_color */ 0, /* map_set_color */ 0, /* map_set_style */
map_ellipse, map_polygon,
0, /* map_bezier */ 0, /* map_polyline */
return agxbuse(&xb);
}
-static void ps_textline(point p, textline_t * line)
+static void ps_textpara(point p, textpara_t * para)
{
double adj;
return;
if (*S[SP].pencolor == '\0')
return;
- if (line->xshow) {
- switch (line->just) {
+ if (para->xshow) {
+ switch (para->just) {
case 'l':
break;
case 'r':
- p.x -= line->dimen.x;
+ p.x -= para->width;
break;
default:
case 'n':
- p.x -= line->dimen.x / 2;
+ p.x -= para->width / 2;
break;
}
fprintf(Output_file, "%d %d moveto\n%s\n[%s]\nxshow\n",
- p.x, p.y, ps_string(line->str,isLatin1), line->xshow);
+ p.x, p.y, ps_string(para->str,isLatin1), para->xshow);
} else {
- switch (line->just) {
+ switch (para->just) {
case 'l':
adj = 0.0;
break;
break;
}
fprintf(Output_file, "%d %d moveto %.1f %.1f %s alignedtext\n",
- p.x, p.y, line->dimen.x, adj, ps_string(line->str,isLatin1));
+ p.x, p.y, para->width, adj, ps_string(para->str,isLatin1));
}
}
ps_begin_edge, 0, /* ps_end_edge */
ps_begin_context, ps_end_context,
0, /* ps_begin_anchor */ 0, /* ps_end_anchor */
- ps_set_font, ps_textline,
+ ps_set_font, ps_textpara,
ps_set_pencolor, ps_set_fillcolor, ps_set_style,
ps_ellipse, ps_polygon,
ps_bezier, ps_polyline,
/* if (cp->style_was_set) svg_style(cp); */
}
-static void svg_textline(point p, textline_t * line)
+static void svg_textpara(point p, textpara_t * para)
{
char *anchor, *string;
point mp;
context_t *cp;
- string = xml_string(line->str);
+ string = xml_string(para->str);
if (!string[0])
return;
}
#if 0
/* adobe svg doesn't like the dx propert */
- if (line->xshow) {
+ if (para->xshow) {
anchor = "start";
- switch (line->just) {
+ switch (para->just) {
case 'l':
break;
case 'r':
- p.x -= line->width;
+ p.x -= para->width;
break;
default:
case 'n':
- p.x -= line->width / 2;
+ p.x -= para->width / 2;
break;
}
} else {
#endif
- switch (line->just) {
+ switch (para->just) {
case 'l':
anchor = "start";
break;
/* adobe svg doesn't like the dx propert */
if (line->xshow) {
svg_fputs("\" dx=\"");
- svg_fputs(line->xshow);
+ svg_fputs(para->xshow);
}
#endif
svg_fputs(">");
svg_begin_edge, svg_end_edge,
svg_begin_context, svg_end_context,
svg_begin_anchor, svg_end_anchor,
- svg_set_font, svg_textline,
+ svg_set_font, svg_textpara,
svg_set_pencolor, svg_set_fillcolor, svg_set_style,
svg_ellipse, svg_polygon,
svg_bezier, svg_polyline,
}
}
-static void vrml_textline(point p, textline_t * line)
+static void vrml_textpara(point p, textpara_t * para)
{
char *fontlist, *err;
pointf mp;
if (Obj != NODE)
return;
cstk[SP].pencolor_ix = vrml_resolve_color(cstk[SP].pencolor);
- fontlist = (char*)(line->layout); /* FIXME - kluge */
+ fontlist = (char*)(para->layout); /* FIXME - kluge */
- switch (line->just) {
+ switch (para->just) {
case 'l':
break;
case 'r':
- p.x -= line->dimen.x;
+ p.x -= para->width;
break;
default:
case 'n':
- p.x -= line->dimen.x / 2;
+ p.x -= para->width / 2;
break;
}
/* p.y += cstk[SP].fontsz*2/3; */
err = gdImageStringFT(im, brect, cstk[SP].pencolor_ix, fontlist,
cstk[SP].fontsz, (Rot ? 90.0 : 0.0) * PI / 180.0,
- ROUND(mp.x), ROUND(mp.y), line->str);
+ ROUND(mp.x), ROUND(mp.y), para->str);
if (err) {
/* revert to builtin fonts */
gdImageString(im, gdFontSmall, ROUND(mp.x), ROUND(mp.y),
- (unsigned char *) line->str, cstk[SP].pencolor_ix);
+ (unsigned char *) para->str, cstk[SP].pencolor_ix);
}
}
vrml_begin_edge, vrml_end_edge,
vrml_begin_context, vrml_end_context,
0, /* vrml_begin_anchor */ 0, /* vrml_end_anchor */
- vrml_set_font, vrml_textline,
+ vrml_set_font, vrml_textpara,
vrml_set_pencolor, vrml_set_fillcolor, vrml_set_style,
vrml_ellipse, vrml_polygon,
vrml_bezier, vrml_polyline,
agxbputc(xbufs[gvc->emit_state], ' ');
}
-static void xd_textline(point p, textline_t * line)
+static void xd_textpara(point p, textpara_t * para)
{
char buf[BUFSIZ];
int j;
- switch (line->just) {
+ switch (para->just) {
case 'l':
j = -1;
break;
j = 0;
break;
}
- sprintf(buf, "T %d %d %d %d ", p.x, YDIR(p.y), j, (int) line->dimen.x);
+ sprintf(buf, "T %d %d %d %d ", p.x, YDIR(p.y), j, (int) para->width);
agxbput(xbufs[gvc->emit_state], buf);
- xd_str ("", line->str);
+ xd_str ("", para->str);
}
static void xd_ellipse(point p, int rx, int ry, int filled)
0, /* xd_begin_edge */ 0, /* xd_end_edge */
0, /* xd_begin_context */ 0, /* xd_context */
0, /* xd_begin_anchor */ 0, /* xd_anchor */
- xd_set_font, xd_textline,
+ xd_set_font, xd_textpara,
xd_set_pencolor, xd_set_fillcolor, xd_set_style,
xd_ellipse, xd_polygon,
xd_bezier, xd_polyline,