[Rd] problems of new cairo device on win32

From: Gong Yu <armgong_at_yahoo.com>
Date: Thu, 28 Apr 2011 11:42:11 -0700 (PDT)


yesterday i send two email about these problems, but I found the attached patch is removed, so i post again.

issue 1 :
  the new cairo device depend on gtk2, but gtk for windows is buggy, and cairo can be built without gtk2,
so I propose build cairo without gtk2 using MinGW, so we can reduce the depend.

issue 2 :
  the default font Helvetica is not an unicode font, so when plots contain  East Asia Char, there will be problem, I saw today svn commit, on win32 now use Arial font but still have CJK problem, I think the best way is using
"Arial Unicode MS" font.

below is the patch file, :

Index: src/library/grDevices/src/cairo/cairoBM.c


#ifdef Win32

-#define HAVE_PANGOCAIRO 1
+#define HAVE_PANGOCAIRO 0

#define HAVE_CAIRO_SVG 1
#define HAVE_CAIRO_PDF 1
#define HAVE_CAIRO_PS 1

Index: src/library/grDevices/src/cairo/cairoBM.h

#include <stdio.h>
-

+#ifdef Win32
+#undef HAVE_PANGOCAIRO
+#endif

#ifdef HAVE_PANGOCAIRO
# include <pango/pango.h>
# include <pango/pangocairo.h>

Index: src/library/grDevices/src/cairo/cairoX11.c

@@ -782,7 +786,11 @@

     pX11Desc xd = (pX11Desc) dd->deviceSpecific;
     int face = gc->fontface;
     double size = gc->cex * gc->ps *fs;
- char *family = "Helvetica";
+    #ifdef Win32 
+      char *family = "Arial Unicode MS";
+    #else 
+     char *family = "Helvetica";
+    #endif
     int slant = CAIRO_FONT_SLANT_NORMAL, wt  = CAIRO_FONT_WEIGHT_NORMAL;

#ifdef WIN32
char *times = "Times New Roman", *hv = "Arial";
@@ -792,8 +800,8 @@  
     char *fm = gc->fontfamily;
     if(streql(fm, "mono")) family = "courier";
-    else if(streql(fm, "serif")) family = times
-    else if(streql(fm, "sans")) family = hv
+    else if(streql(fm, "serif")) family = times;
+    else if(streql(fm, "sans")) family = hv;
     else if(fm[0]) family = fm;
     if (face < 1 || face > 5) face = 1;
     if (face == 5) family = "Symbol";

Index: src/library/grDevices/src/cairo/Makefile.win

 PKG_CPPFLAGS=-I$(R_HOME)/src/include -I. -I.. -DHAVE_CONFIG_H $(arch_DEFS)

-PKG_CPPFLAGS+= -I"$(GTK2_HOME)/include/cairo" \
-  -I"$(GTK2_HOME)/include/pango-1.0" \
-  -I"$(GTK2_HOME)/include/glib-2.0" \
-  -I"$(GTK2_HOME)/lib/glib-2.0/include" \
-  -I"$(GTK2_HOME)/include"

+PKG_CPPFLAGS+= -I"/MinGW/include/cairo" \  

-PKG_LIBS=-L"$(GTK2_HOME)/lib" -lpangocairo-1.0 -lpango-1.0 -lcairo \ - -lglib-2.0 -lgobject-2.0
+PKG_LIBS=-L"$(GTK2_HOME)/lib" -lcairo  

+
 all: winCairo.dll
 @cp winCairo.dll $(R_HOME)/library/grDevices/libs$(R_ARCH)



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 28 Apr 2011 - 18:48:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Apr 2011 - 01:10:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive