Commit 8a1a153d authored by John Ellson's avatar John Ellson

Merge branch 'issue-1286' into 'master'

Issue 1286

See merge request !1295
parents 379a91d2 9252a997
Pipeline #37840942 canceled with stages
in 5 minutes and 25 seconds
...@@ -486,9 +486,6 @@ w3IncludeHTML(); ...@@ -486,9 +486,6 @@ w3IncludeHTML();
(This option assumes Graphviz includes the Cairo renderer.) (This option assumes Graphviz includes the Cairo renderer.)
Alternatively, one can use the <A HREF="#d:ps2">ps2</A> option to Alternatively, one can use the <A HREF="#d:ps2">ps2</A> option to
produce PDF-compatible PostScript, and then use a ps-to-pdf converter. produce PDF-compatible PostScript, and then use a ps-to-pdf converter.
<P>
Note: At present, this option does not support anchors, etc. To get these
included in your PDF output, use <A HREF="#d:ps2">ps2</A>.
<DT><A NAME=d:pic HREF=#a:pic><STRONG>pic</STRONG></A> <DT><A NAME=d:pic HREF=#a:pic><STRONG>pic</STRONG></A>
<DD>Output is given in the text-based PIC language developed for troff. <DD>Output is given in the text-based PIC language developed for troff.
......
...@@ -478,9 +478,6 @@ Produces <A HREF="http://www.adobe.com/devnet/pdf/">PDF</A> output. ...@@ -478,9 +478,6 @@ Produces <A HREF="http://www.adobe.com/devnet/pdf/">PDF</A> output.
(This option assumes Graphviz includes the Cairo renderer.) (This option assumes Graphviz includes the Cairo renderer.)
Alternatively, one can use the <A HREF="#d:ps2">ps2</A> option to Alternatively, one can use the <A HREF="#d:ps2">ps2</A> option to
produce PDF-compatible PostScript, and then use a ps-to-pdf converter. produce PDF-compatible PostScript, and then use a ps-to-pdf converter.
<P>
Note: At present, this option does not support anchors, etc. To get these
included in your PDF output, use <A HREF="#d:ps2">ps2</A>.
:tif/tiff: TIFF (Tag Image File Format) :tif/tiff: TIFF (Tag Image File Format)
Produces <A HREF="http://www.libtiff.org/">TIFF</A> output. Produces <A HREF="http://www.libtiff.org/">TIFF</A> output.
:vml/vmlz: Vector Markup Language (VML) :vml/vmlz: Vector Markup Language (VML)
......
...@@ -33,6 +33,7 @@ typedef enum { ...@@ -33,6 +33,7 @@ typedef enum {
FORMAT_PS, FORMAT_PS,
FORMAT_PDF, FORMAT_PDF,
FORMAT_SVG, FORMAT_SVG,
FORMAT_EPS,
} format_type; } format_type;
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0])) #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
...@@ -108,9 +109,12 @@ static void cairogen_begin_page(GVJ_t * job) ...@@ -108,9 +109,12 @@ static void cairogen_begin_page(GVJ_t * job)
if (cr == NULL) { if (cr == NULL) {
switch (job->render.id) { switch (job->render.id) {
case FORMAT_PS: case FORMAT_PS:
case FORMAT_EPS:
#ifdef CAIRO_HAS_PS_SURFACE #ifdef CAIRO_HAS_PS_SURFACE
surface = cairo_ps_surface_create_for_stream (writer, surface = cairo_ps_surface_create_for_stream (writer,
job, job->width, job->height); job, job->width, job->height);
if (job->render.id == FORMAT_EPS)
cairo_ps_surface_set_eps (surface, TRUE);
#endif #endif
break; break;
case FORMAT_PDF: case FORMAT_PDF:
...@@ -219,7 +223,8 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta ...@@ -219,7 +223,8 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta
obj_state_t *obj = job->obj; obj_state_t *obj = job->obj;
cairo_t *cr = (cairo_t *) job->context; cairo_t *cr = (cairo_t *) job->context;
double p0x, p0y, p1x, p1y; double p0x, p0y, p1x, p1y;
char buf[300]; char *buf;
size_t buf_len;
if (url && obj->url_map_p) { if (url && obj->url_map_p) {
p0x = obj->url_map_p[0].x; p0x = obj->url_map_p[0].x;
...@@ -228,7 +233,9 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta ...@@ -228,7 +233,9 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta
p1x = obj->url_map_p[1].x; p1x = obj->url_map_p[1].x;
p1y = -obj->url_map_p[1].y; p1y = -obj->url_map_p[1].y;
cairo_user_to_device (cr, &p1x, &p1y); cairo_user_to_device (cr, &p1x, &p1y);
snprintf(buf, sizeof(buf), "rect=[%f %f %f %f] uri='%s'", buf_len = strlen(url) + 200;
buf = malloc(buf_len);
snprintf(buf, buf_len, "rect=[%f %f %f %f] uri='%s'",
p0x, p0x,
p0y, p0y,
p1x - p0x, p1x - p0x,
...@@ -238,6 +245,7 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta ...@@ -238,6 +245,7 @@ static void cairogen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *ta
cairo_tag_begin (cr, CAIRO_TAG_LINK, buf); cairo_tag_begin (cr, CAIRO_TAG_LINK, buf);
cairo_tag_end (cr, CAIRO_TAG_LINK); cairo_tag_end (cr, CAIRO_TAG_LINK);
#endif #endif
free(buf);
} }
} }
...@@ -484,7 +492,16 @@ static gvdevice_features_t device_features_png = { ...@@ -484,7 +492,16 @@ static gvdevice_features_t device_features_png = {
}; };
static gvdevice_features_t device_features_ps = { static gvdevice_features_t device_features_ps = {
GVDEVICE_DOES_TRUECOLOR, /* flags */ GVRENDER_NO_WHITE_BG
| GVDEVICE_DOES_TRUECOLOR, /* flags */
{36.,36.}, /* default margin - points */
{0.,0.}, /* default page width, height - points */
{72.,72.}, /* postscript 72 dpi */
};
static gvdevice_features_t device_features_eps = {
GVRENDER_NO_WHITE_BG
| GVDEVICE_DOES_TRUECOLOR, /* flags */
{36.,36.}, /* default margin - points */ {36.,36.}, /* default margin - points */
{0.,0.}, /* default page width, height - points */ {0.,0.}, /* default page width, height - points */
{72.,72.}, /* postscript 72 dpi */ {72.,72.}, /* postscript 72 dpi */
...@@ -492,6 +509,7 @@ static gvdevice_features_t device_features_ps = { ...@@ -492,6 +509,7 @@ static gvdevice_features_t device_features_ps = {
static gvdevice_features_t device_features_pdf = { static gvdevice_features_t device_features_pdf = {
GVDEVICE_BINARY_FORMAT GVDEVICE_BINARY_FORMAT
| GVRENDER_NO_WHITE_BG
| GVRENDER_DOES_MAPS | GVRENDER_DOES_MAPS
| GVRENDER_DOES_MAP_RECTANGLE | GVRENDER_DOES_MAP_RECTANGLE
| GVDEVICE_DOES_TRUECOLOR,/* flags */ | GVDEVICE_DOES_TRUECOLOR,/* flags */
...@@ -501,7 +519,8 @@ static gvdevice_features_t device_features_pdf = { ...@@ -501,7 +519,8 @@ static gvdevice_features_t device_features_pdf = {
}; };
static gvdevice_features_t device_features_svg = { static gvdevice_features_t device_features_svg = {
GVDEVICE_DOES_TRUECOLOR, /* flags */ GVRENDER_NO_WHITE_BG
| GVDEVICE_DOES_TRUECOLOR, /* flags */
{0.,0.}, /* default margin - points */ {0.,0.}, /* default margin - points */
{0.,0.}, /* default page width, height - points */ {0.,0.}, /* default page width, height - points */
{72.,72.}, /* svg 72 dpi */ {72.,72.}, /* svg 72 dpi */
...@@ -518,6 +537,7 @@ gvplugin_installed_t gvdevice_pango_types[] = { ...@@ -518,6 +537,7 @@ gvplugin_installed_t gvdevice_pango_types[] = {
#endif #endif
#ifdef CAIRO_HAS_PS_SURFACE #ifdef CAIRO_HAS_PS_SURFACE
{FORMAT_PS, "ps:cairo", -10, NULL, &device_features_ps}, {FORMAT_PS, "ps:cairo", -10, NULL, &device_features_ps},
{FORMAT_EPS, "eps:cairo", -10, NULL, &device_features_eps},
#endif #endif
#ifdef CAIRO_HAS_PDF_SURFACE #ifdef CAIRO_HAS_PDF_SURFACE
{FORMAT_PDF, "pdf:cairo", 10, NULL, &device_features_pdf}, {FORMAT_PDF, "pdf:cairo", 10, NULL, &device_features_pdf},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment