Skip to content
Prev 226168 / 398500 Next

PDFfontNumber bugs in devPS.c (Re: plain text in Chinese can not be set)

On 2010-7-1 15:24, Jinsong Zhao wrote:
I have compiled R 2.11.1 on a Linux machine, and confirmed that 
PDFfontNumber function in devPS.c (grDevices library) has a bug, which 
causes the plain face of CID fonts cannot be accessed when CID fonts 
were used together with default font family in pdf().

the following is the patch.

--- devPS_orig.c	Sun Apr 25 06:10:04 2010
+++ devPS.c	Fri Jul 02 09:46:55 2010
@@ -7267,7 +7267,7 @@
  	     * Use very high font number for CID fonts to avoid
  	     * Type 1 fonts
  	     */
-	    num = 1000 + (cidfontIndex - 1)*5 + 1 + face;
+	    num = 1000 + (cidfontIndex - 1)*5 + face;
  	else {
  	    /*
  	     * Check whether the font is loaded and, if not,
@@ -7303,7 +7303,7 @@
  		} else /* (isCIDFont(family, PDFFonts)) */ {
  		    if (addPDFDeviceCIDfont(cidfontfamily, pd,
  					    &cidfontIndex)) {
-			num = 1000 + (cidfontIndex - 1)*5 + 1 + face;
+			num = 1000 + (cidfontIndex - 1)*5 + face;
  		    } else {
  			cidfontfamily = NULL;

Regards,
Jinsong