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

Paul Murrell p.murrell at auckland.ac.nz
Sun Jul 4 02:17:14 CEST 2010


Hi

Thanks very much for the report, diagnosis, and patch!

I have implemented your fix in the development version of R.

Paul

Jinsong Zhao wrote:
> On 2010-7-1 15:24, Jinsong Zhao wrote:
>> Read the source again more carefully. I think I get the solution:
>>
>> Change the following line in PDFfontNumber function in devPS.c:
>>
>> num = 1000 + (cidfontIndex - 1)*5 + 1 + face;
>> to
>> num = 1000 + (cidfontIndex - 1)*5 + face;
>>
>> It appears two times in the function.
>>
>> However, I don't know how to compile the whole R distribution on Windows
>> platform. Would anyone here like to give a test? Thanks in advance!
>>
>> Regards,
>> Jinsong
> 
> 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

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list