]> granicus.if.org Git - graphviz/commitdiff
Remove HAVE_PANGOCAIRO check from plugin/pango
authorErwin Janssen <erwinjanssen@outlook.com>
Sun, 14 May 2017 20:43:48 +0000 (22:43 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Sun, 14 May 2017 20:46:03 +0000 (22:46 +0200)
The check to see if pangocairo is present should be done before including
this project in the build. Now, when pangocairo is not found, this tries
to compile when it shouldn't, resulting in strange errors.

plugin/pango/gvgetfontlist.h
plugin/pango/gvgetfontlist_pango.c
plugin/pango/gvloadimage_pango.c
plugin/pango/gvrender_pango.c
plugin/pango/gvtextlayout_pango.c

index d22bd81e2342d1e17644f788cb58f1bf1800f0cd..59ed97d769c1c93621a43ec44d081c2f6f6f9313 100644 (file)
@@ -2,7 +2,7 @@
 /* vim:set shiftwidth=4 ts=8: */
 
 /*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
+ * Copyright (c) 2011 AT&T Intellectual Property
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,7 +14,6 @@
 #ifndef _GVGETFONTLIST_H
 #define _GVGETFONTLIST_H
 
-#ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 
 #ifdef __cplusplus
@@ -32,6 +31,4 @@ extern gv_font_map* get_font_mapping(PangoFontMap * pfm);
 }
 #endif
 
-#endif  /* HAVE_PANGOCAIRO */
-
 #endif  /* _GVGETFONTLIST_H */
index d03bc738cc5d729825e24e3e01dc2b7e8d6d95b0..3ce61364835b624c305e78fbfeba9e919ce6bfc0 100644 (file)
@@ -2,7 +2,7 @@
 /* vim:set shiftwidth=4 ts=8: */
 
 /*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
+ * Copyright (c) 2011 AT&T Intellectual Property
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -52,10 +52,8 @@ char* strcasestr (const char *str, const char *pat)
 
 #include "agxbuf.h"
 #include "gvplugin_textlayout.h"
-#ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 #include "gvgetfontlist.h"
-#endif
 
 extern unsigned char Verbose;
 
@@ -154,16 +152,16 @@ typedef struct {
     char* name;
 } face_t;
 static face_t facelist[] = {
-    { FNT_BOLD, FNT_BOLD_ST}, 
-    { FNT_BOOK, FNT_BOOK_ST}, 
-    { FNT_CONDENSED, FNT_CONDENSED_ST}, 
+    { FNT_BOLD, FNT_BOLD_ST},
+    { FNT_BOOK, FNT_BOOK_ST},
+    { FNT_CONDENSED, FNT_CONDENSED_ST},
     { FNT_DEMI, FNT_DEMI_ST},
-    { FNT_EXTRALIGHT, FNT_EXTRALIGHT_ST}, 
-    { FNT_ITALIC, FNT_ITALIC_ST}, 
-    { FNT_LIGHT, FNT_LIGHT_ST}, 
-    { FNT_MEDIUM, FNT_MEDIUM_ST}, 
-    { FNT_OBLIQUE, FNT_OBLIQUE_ST}, 
-    { FNT_REGULAR, FNT_REGULAR_ST}, 
+    { FNT_EXTRALIGHT, FNT_EXTRALIGHT_ST},
+    { FNT_ITALIC, FNT_ITALIC_ST},
+    { FNT_LIGHT, FNT_LIGHT_ST},
+    { FNT_MEDIUM, FNT_MEDIUM_ST},
+    { FNT_OBLIQUE, FNT_OBLIQUE_ST},
+    { FNT_REGULAR, FNT_REGULAR_ST},
     { FNT_ROMAN, FNT_ROMAN_ST},
 };
 #define FACELIST_SZ (sizeof(facelist)/sizeof(face_t))
@@ -172,45 +170,45 @@ static face_t facelist[] = {
    here or new equivalent fonts can be added here. Each font family used by the Graphviz
    PS fonts is set up.
 */
-static const char *PS_AVANT_E[] = { 
+static const char *PS_AVANT_E[] = {
     SAN_1, SAN_2, SAN_3, SAN_4, SAN_5, SAN_6, SAN_7, SAN_8, SAN_9, SAN_10
 };
 #define PS_AVANT_E_SZ  (sizeof(PS_AVANT_E) / sizeof(char *))
 
-static const char *PS_BOOKMAN_E[] = { 
-    SER_1, SER_2, SER_3, SER_4, SER_5, SER_6, SER_7, SER_8, SER_9 
+static const char *PS_BOOKMAN_E[] = {
+    SER_1, SER_2, SER_3, SER_4, SER_5, SER_6, SER_7, SER_8, SER_9
 };
 #define PS_BOOKMAN_E_SZ (sizeof(PS_BOOKMAN_E) / sizeof(char *))
 
-static const char *PS_COURIER_E[] = { 
-    MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, MON_8 
+static const char *PS_COURIER_E[] = {
+    MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, MON_8
 };
 #define PS_COURIER_E_SZ (sizeof(PS_COURIER_E) / sizeof(char *))
 
-static const char *PS_HELVETICA_E[] = { 
-    SAN_3, SAN_11, SAN_4, SAN_6, SAN_7, SAN_8, SAN_9, SAN_10 
+static const char *PS_HELVETICA_E[] = {
+    SAN_3, SAN_11, SAN_4, SAN_6, SAN_7, SAN_8, SAN_9, SAN_10
 };
 #define PS_HELVETICA_E_SZ (sizeof(PS_HELVETICA_E) / sizeof(char *))
 
-static const char *PS_NEWCENT_E[] = { 
+static const char *PS_NEWCENT_E[] = {
     SER_10, SER_2, SER_3, SER_4, SER_12, SER_5, SER_6, SER_7, SER_8, SER_9
 };
 #define PS_NEWCENT_E_SZ (sizeof(PS_NEWCENT_E) / sizeof(char *))
 
-static const char *PS_PALATINO_E[] = { 
+static const char *PS_PALATINO_E[] = {
     SER_13, SER_2, SER_3, SER_4, SER_14, SER_15, SER_5, SER_6, SER_7, SER_8, SER_9
 };
 #define PS_PALATINO_E_SZ (sizeof(PS_PALATINO_E) / sizeof(char *))
 
-static const char *PS_TIMES_E[] = { 
-    SER_4, SER_2, SER_11, SER_5, SER_6, SER_7, SER_8, SER_9 
+static const char *PS_TIMES_E[] = {
+    SER_4, SER_2, SER_11, SER_5, SER_6, SER_7, SER_8, SER_9
 };
 #define PS_TIMES_E_SZ (sizeof(PS_TIMES_E) / sizeof(char *))
 
 static const char *PS_SYMBOL_E[] = { SYM_1, SYM_2, SYM_3, SYM_4 };
 #define PS_SYMBOL_E_SZ (sizeof(PS_SYMBOL_E) / sizeof(char *))
 
-static const char *PS_CHANCERY_E[] = { 
+static const char *PS_CHANCERY_E[] = {
     SER_16, SER_11, SER_2, SER_3, SER_4, SER_5, SER_6, SER_7, SER_8, SER_9
 };
 #define PS_CHANCERY_E_SZ (sizeof(PS_CHANCERY_E) / sizeof(char *))
@@ -292,7 +290,7 @@ static int get_faces(PangoFontFamily * family)
 }
 
 #ifdef DEBUG
-static void 
+static void
 display_available_fonts(availfont_t* gv_af_p)
 {
     int i, j, faces;
@@ -320,7 +318,7 @@ static char *get_avail_faces(int faces, agxbuf* xb)
     int i;
     for (i = 0; i < FACELIST_SZ; i++) {
        if (faces & facelist[i].flag) {
-           agxbput (xb, facelist[i].name); 
+           agxbput (xb, facelist[i].name);
            agxbputc(xb, ' ');
        }
     }
@@ -328,9 +326,9 @@ static char *get_avail_faces(int faces, agxbuf* xb)
 }
 
 
-/* This function creates an array of font definitions. Each entry corresponds to one of 
-   the Graphviz PS fonts.  The font definitions contain the generic font name and a list 
-   of equivalent fonts that can be used in place of the PS font if the PS font is not 
+/* This function creates an array of font definitions. Each entry corresponds to one of
+   the Graphviz PS fonts.  The font definitions contain the generic font name and a list
+   of equivalent fonts that can be used in place of the PS font if the PS font is not
    available on the system
 */
 static availfont_t *gv_get_ps_fontlist(PangoFontMap * fontmap)
@@ -357,7 +355,7 @@ static availfont_t *gv_get_ps_fontlist(PangoFontMap * fontmap)
        gv_ps_fontdef = gv_ps_fontdefs+j;
        gv_afs->gv_ps_fontname = gv_ps_fontdef->fontname;
        family_name = NULL;
-       /* Search the installed system font families for the current 
+       /* Search the installed system font families for the current
           Graphvis PS font family name, i.e. AvantGarde */
        for (i = 0; i < n_families; i++) {
            family = families[i];
@@ -427,7 +425,7 @@ static void copyUpper (agxbuf* xb, char* s)
        (void)agxbputc (xb, toupper(c));
 }
 
-/* Returns the font corresponding to a Graphviz PS font. 
+/* Returns the font corresponding to a Graphviz PS font.
    AvantGarde-Book may return URW Gothic L, book
    Returns NULL if no appropriate font found.
 */
@@ -440,7 +438,7 @@ static char *gv_get_font(availfont_t* gv_af_p,
     for (i = 0; i < GV_FONT_LIST_SIZE; i++) {
        /* Searches the array of available system fonts for the one that
           corresponds to the current Graphviz PS font name. Sets up the
-          font string with the available font name and the installed font 
+          font string with the available font name and the installed font
           faces that match what are required by the Graphviz PS font.
         */
        if (gv_af_p[i].faces && strstr(ps_alias->name, gv_af_p[i].gv_ps_fontname)) {
@@ -504,7 +502,7 @@ printFontMap (gv_font_map*gv_fmap, int sz)
 }
 
 /* Sets up a structure array that contains the Graphviz PS font name
-   and the corresponding installed font string.  
+   and the corresponding installed font string.
 */
 gv_font_map* get_font_mapping(PangoFontMap * fontmap)
 {
index 7cb2f29d046ccfacbdd17b25cdb3ecbea3eeec8c..4aa942078e94bb2c313459bee8c962a007c79899 100644 (file)
@@ -2,7 +2,7 @@
 /* vim:set shiftwidth=4 ts=8: */
 
 /*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
+ * Copyright (c) 2011 AT&T Intellectual Property
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@
 #include "gvplugin_loadimage.h"
 #include "gvio.h"
 
-#ifdef HAVE_PANGOCAIRO
 #include <cairo.h>
 
 typedef enum {
@@ -95,7 +94,7 @@ static void pango_loadimage_cairo(GVJ_t * job, usershape_t *us, boxf b, boolean
     if (surface) {
         cairo_save(cr);
        cairo_translate(cr, b.LL.x, -b.UR.y);
-       cairo_scale(cr, (b.UR.x - b.LL.x)/(us->w), (b.UR.y - b.LL.y)/(us->h)); 
+       cairo_scale(cr, (b.UR.x - b.LL.x)/(us->w), (b.UR.y - b.LL.y)/(us->h));
         cairo_set_source_surface (cr, surface, 0, 0);
         cairo_paint (cr);
         cairo_restore(cr);
@@ -171,13 +170,10 @@ static gvloadimage_engine_t engine_cairo = {
 static gvloadimage_engine_t engine_ps = {
     pango_loadimage_ps
 };
-#endif
 
 gvplugin_installed_t gvloadimage_pango_types[] = {
-#ifdef HAVE_PANGOCAIRO
     {FORMAT_PNG_CAIRO, "png:cairo", 1, &engine_cairo, NULL},
     {FORMAT_PNG_PS, "png:lasi", 2, &engine_ps, NULL},
     {FORMAT_PNG_PS, "png:ps", 2, &engine_ps, NULL},
-#endif
     {0, NULL, 0, NULL, NULL}
 };
index 8f1ec9eb96fe4ed49d39d0d2e6c5ae2df2f7cbf4..9ac460302cf68662cb819deaaf33e02b413dcf96 100644 (file)
@@ -2,7 +2,7 @@
 /* vim:set shiftwidth=4 ts=8: */
 
 /*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
+ * Copyright (c) 2011 AT&T Intellectual Property
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -25,7 +25,6 @@
 
 #include "gvplugin_pango.h"
 
-#ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 
 typedef enum {
@@ -64,7 +63,7 @@ static void cairogen_set_color(cairo_t * cr, gvcolor_t * color)
                         color->u.RGBA[2], color->u.RGBA[3]);
 }
 
-static void cairogen_add_color_stop_rgba(cairo_pattern_t *pat, double stop , gvcolor_t * color) 
+static void cairogen_add_color_stop_rgba(cairo_pattern_t *pat, double stop , gvcolor_t * color)
 {
   cairo_pattern_add_color_stop_rgba (pat, stop,color->u.RGBA[0], color->u.RGBA[1],
                         color->u.RGBA[2], color->u.RGBA[3]);
@@ -88,7 +87,7 @@ static void cairogen_begin_job(GVJ_t * job)
 static void cairogen_end_job(GVJ_t * job)
 {
     cairo_t *cr = (cairo_t *) job->context;
-    
+
     if (job->external_context)
         cairo_restore(cr);
     else {
@@ -137,7 +136,7 @@ static void cairogen_begin_page(GVJ_t * job)
                job->scale.x *= scale;
                job->scale.y *= scale;
                 fprintf(stderr,
-                        "%s: graph is too large for cairo-renderer bitmaps. Scaling by %g to fit\n", 
+                        "%s: graph is too large for cairo-renderer bitmaps. Scaling by %g to fit\n",
                         job->common->cmdname, scale);
            }
            surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
@@ -209,7 +208,7 @@ static void cairogen_end_page(GVJ_t * job)
            fprintf(stderr, "ERROR: cairo surface has zero area, this may indicate some problem during rendering shapes.\n");
  - jce */
        }
-       job->imagedata = (char *)(cairo_image_surface_get_data(surface));       
+       job->imagedata = (char *)(cairo_image_surface_get_data(surface));
        break;
                /* formatting will be done by gvdevice_format() */
     }
@@ -291,7 +290,7 @@ static void cairo_gradient_fill (cairo_t* cr, obj_state_t* obj, int filled, poin
            c1.x = G[0].x +  r1 * cos(angle);
            c1.y = G[0].y -  r1 * sin(angle);
        }
-       pat = cairo_pattern_create_radial(c1.x,c1.y,r1,G[0].x,G[0].y,r2); 
+       pat = cairo_pattern_create_radial(c1.x,c1.y,r1,G[0].x,G[0].y,r2);
     }
     if (obj->gradient_frac > 0) {
        cairogen_add_color_stop_rgba(pat,obj->gradient_frac - 0.001,&(obj->fillcolor));
@@ -478,17 +477,13 @@ static gvdevice_features_t device_features_svg = {
     {0.,0.},                    /* default page width, height - points */
     {72.,72.},                 /* svg 72 dpi */
 };
-#endif
 
 gvplugin_installed_t gvrender_pango_types[] = {
-#ifdef HAVE_PANGOCAIRO
     {FORMAT_CAIRO, "cairo", 10, &cairogen_engine, &render_features_cairo},
-#endif
     {0, NULL, 0, NULL, NULL}
 };
 
 gvplugin_installed_t gvdevice_pango_types[] = {
-#ifdef HAVE_PANGOCAIRO
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
     {FORMAT_PNG, "png:cairo", 10, NULL, &device_features_png},
 #endif
@@ -500,7 +495,6 @@ gvplugin_installed_t gvdevice_pango_types[] = {
 #endif
 #ifdef CAIRO_HAS_SVG_SURFACE
     {FORMAT_SVG, "svg:cairo", -10, NULL, &device_features_svg},
-#endif
 #endif
     {0, NULL, 0, NULL, NULL}
 };
index ff25a6a89007fcb3e60896c1660e6d549ab4f64e..9b102d97f6791e73141f2c2522db1ed49a5113fa 100644 (file)
@@ -2,7 +2,7 @@
 /* vim:set shiftwidth=4 ts=8: */
 
 /*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
+ * Copyright (c) 2011 AT&T Intellectual Property
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -20,7 +20,6 @@
 #include "utils.h"
 #include "gvplugin_textlayout.h"
 
-#ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 #include "gvgetfontlist.h"
 #ifdef HAVE_PANGO_FC_FONT_LOCK_FACE
@@ -149,7 +148,7 @@ static boolean pango_textlayout(textspan_t * span, char **fontpath)
                    strcat(buf, ", ");
                    strcat(buf, face->style_name);
                    strcat(buf, "\" ");
-    
+
                    stream = face->stream;
                    if (stream) {
                        streamdesc = stream->pathname;
@@ -168,7 +167,7 @@ static boolean pango_textlayout(textspan_t * span, char **fontpath)
            {
                PangoFontDescription *tdesc;
                char *tfont;
-               
+
                tdesc = pango_font_describe(font);
                tfont = pango_font_description_to_string(tdesc);
                strcat(buf, "\"");
@@ -278,11 +277,8 @@ static boolean pango_textlayout(textspan_t * span, char **fontpath)
 static gvtextlayout_engine_t pango_textlayout_engine = {
     pango_textlayout,
 };
-#endif
 
 gvplugin_installed_t gvtextlayout_pango_types[] = {
-#ifdef HAVE_PANGOCAIRO
     {0, "textlayout", 10, &pango_textlayout_engine, NULL},
-#endif
     {0, NULL, 0, NULL, NULL}
 };