[Rd] problems of new cairo device on win32
Gong Yu
armgong at yahoo.com
Thu Apr 28 20:42:11 CEST 2011
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
===================================================================
--- src/library/grDevices/src/cairo/cairoBM.c(版本 55681)
+++ src/library/grDevices/src/cairo/cairoBM.c(工作副本)
@@ -25,7 +25,7 @@
/* This module is only compiled if HAVE_WORKING_CAIRO is true */
#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
===================================================================
--- src/library/grDevices/src/cairo/cairoBM.h(版本 55681)
+++ src/library/grDevices/src/cairo/cairoBM.h(工作副本)
@@ -39,7 +39,9 @@
#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
===================================================================
--- src/library/grDevices/src/cairo/cairoX11.c(版本 55681)
+++ src/library/grDevices/src/cairo/cairoX11.c(工作副本)
@@ -465,7 +465,11 @@
return raster;
}
#endif
-
+
+#ifdef Win32
+ #undef HAVE_PANGOCAIRO
+#endif
+
#ifdef HAVE_PANGOCAIRO
/* ------------- pangocairo section --------------- */
@@ -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
===================================================================
--- src/library/grDevices/src/cairo/Makefile.win(版本 55681)
+++ src/library/grDevices/src/cairo/Makefile.win(工作副本)
@@ -18,15 +18,11 @@
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)
More information about the R-devel
mailing list