*** src/cairoDevice.c	2006-09-20 23:06:50.000000000 +0400
--- /usr/local/src/CRAN/cairoDevice/src/cairoDevice.c	2006-10-25 23:45:12.000000000 +0400
***************
*** 311,324 ****
  	return(fontdesc);
  }
  
! static PangoLayout *layoutText(PangoFontDescription *desc, const char *str, CairoDesc *cd)
  {
  	gsize bytes_written;
      gchar *utf8;
  	PangoLayout *layout;
  	
! 	//pango_cairo_update_context(cd->cr, cd->pango);
! 	//layout = pango_layout_new(cd->pango);
    if (cd->drawing)
      layout = gtk_widget_create_pango_layout(cd->drawing, NULL);
    else layout = pango_layout_new(gdk_pango_context_get());
--- 311,546 ----
  	return(fontdesc);
  }
  
! 
! static PangoLayout *layoutMath(PangoFontDescription *desc, const char *str, CairoDesc *cd)
  {
  	gsize bytes_written;
      gchar *utf8;
  	PangoLayout *layout;
+ 	GString * z = g_string_new(NULL);
+ 	gunichar unisym[190]={
+ 0x0020,	
+ 0x0021,	
+ 0x2200,	
+ 0x0023,	
+ 0x2203,	
+ 0x0025,	
+ 0x0026,	
+ 0x220B,	
+ 0x0028,	
+ 0x0029,	
+ 0x2217,	
+ 0x002B,	
+ 0x002C,	
+ 0x2212,	
+ 0x002E,	
+ 0x002F,	
+ 0x0030,	
+ 0x0031,	
+ 0x0032,	
+ 0x0033,	
+ 0x0034,	
+ 0x0035,	
+ 0x0036,	
+ 0x0037,	
+ 0x0038,	
+ 0x0039,	
+ 0x003A,	
+ 0x003B,	
+ 0x003C,	
+ 0x003D,	
+ 0x003E,	
+ 0x003F,	
+ 0x2245,	
+ 0x0391,	
+ 0x0392,	
+ 0x03A7,	
+ 0x0394,	
+ 0x0395,	
+ 0x03A6,	
+ 0x0393,	
+ 0x0397,	
+ 0x0399,	
+ 0x03D1,	
+ 0x039A,	
+ 0x039B,	
+ 0x039C,	
+ 0x039D,	
+ 0x039F,	
+ 0x03A0,	
+ 0x0398,	
+ 0x03A1,	
+ 0x03A3,	
+ 0x03A4,	
+ 0x03A5,	
+ 0x03C2,	
+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,	
+ 0x2228,	
+ 0x21D4,	
+ 0x21D0,	
+ 0x21D1,	
+ 0x21D2,	
+ 0x21D3,	
+ 0x25CA,	
+ 0x2329,	
+ 0xF8E8,	
+ 0xF8E9,	
+ 0xF8EA,	
+ 0x2211,	
+ 0xF8EB,	
+ 0xF8EC,	
+ 0xF8ED,	
+ 0xF8EE,	
+ 0xF8EF,	
+ 0xF8F0,	
+ 0xF8F1,	
+ 0xF8F2,	
+ 0xF8F3,	
+ 0xF8F4,
+ 0x0020,	
+ 0x232A,	
+ 0x222B,	
+ 0x2320,	
+ 0xF8F5,	
+ 0x2321,	
+ 0xF8F6,	
+ 0xF8F7,	
+ 0xF8F8,	
+ 0xF8F9,
+ 0xF8FA,
+ 0xF8FB,
+ 0xF8FC,	
+ 0xF8FD,	
+ 0xF8FE};	
+       
+      	int i;
+         unsigned char j;
+ 	gunichar z0;
+   if (cd->drawing)
+     layout = gtk_widget_create_pango_layout(cd->drawing, NULL);
+   else layout = pango_layout_new(gdk_pango_context_get());
+ 	pango_layout_set_font_description(layout, desc);
+ 	z0=0x20;
+ 	for (i=0;i<strlen(str);i++){
+ 	  j=*(str+i);
+ 	  if ((j>=0x20) & (j<=0x7F)){
+ 	    z0=unisym[j-32];
+ 	  };
+ 	  if ((j>=0xA0) & (j<=0xFE)){
+ 	    z0=unisym[j-65];
+ 	  };
+ 	    g_string_append_unichar(z,z0);
+ 	}
+ 	
+     pango_layout_set_text(layout, z->str, -1);
  	
! 	g_string_free(z,1);
! 	
! 	return(layout);
! }
! 
! static PangoLayout *layoutText(PangoFontDescription *desc, const char *str, CairoDesc *cd)
! {
! 	gsize bytes_written;
!     gchar *utf8;
! 	PangoLayout *layout;
    if (cd->drawing)
      layout = gtk_widget_create_pango_layout(cd->drawing, NULL);
    else layout = pango_layout_new(gdk_pango_context_get());
***************
*** 709,716 ****
  	cairo_rotate(cr, -1*rot);
  	cairo_rel_move_to(cr, -lbearing, -ascent);
  	setColor(cr, gc->col);
! 	
! 	layout = layoutText(desc, str, cd);
  	pango_cairo_show_layout(cr, layout);
  	
  	g_object_unref(layout);
--- 931,941 ----
  	cairo_rotate(cr, -1*rot);
  	cairo_rel_move_to(cr, -lbearing, -ascent);
  	setColor(cr, gc->col);
! 	if (gc->fontface!=SYMBOL_FONTFACE){
! 	  layout = layoutText(desc, str, cd);
! 	} else {
! 	  layout = layoutMath(desc, str, cd);
! 	}
  	pango_cairo_show_layout(cr, layout);
  	
  	g_object_unref(layout);
