[R] [Rd] italic font on cairo devices in R 3.4

Ilia Kats ilia-kats at gmx.net
Sat Jul 8 09:05:41 CEST 2017


Cool, thanks, I didn't know about that. I'll give it a try. This still 
doesn't fix the root cause, though.

Cheers, Ilia



-------- Original Message --------
Subject: Re: [R] [Rd] italic font on cairo devices in R 3.4
Date: 2017-07-08 07:11:10 +0200
From: Yixuan Qiu
To: ilia-kats
CC: frederik, r-help
> Hi Ilia,
>
> You may want to have a try of the showtext package
> (https://github.com/yixuan/showtext). Below is a quick example:
>
> library(showtext)
> showtext.auto()
>
> pdf("test.pdf")
> ## Use the "sans" font family provided by the showtext package
> ## font == 3 means italic font face
> plot(1, xlab = "Unicode characters: \u00C0 \u00C6 \u00D8",
>      family = "sans", font.lab = 3)
> dev.off()
>
> ## Same for SVG
> svg("test.svg")
> plot(1, xlab = "Unicode characters: \u00C0 \u00C6 \u00D8",
>      family = "sans", font.lab = 3)
> dev.off()
>
>
> Best,
> Yixuan
>
>
> 2017-07-07 13:08 GMT-04:00 Ilia Kats <ilia-kats at gmx.net>:
>> Interesting. I did not have the package installed, but I did at some point
>> extract Helvetica from some MacOSX font files and R was using that just fine
>> until 3.3. This is how the plot looks in 3.4 (still using Helvetica):
>> https://ptpb.pw/HikX.pdf . After removing Helvetica, installing the
>> ttf-mscorefonts-installer package, and running fc-cache --force  the plot
>> looks like this: https://ptpb.pw/CM8A.pdf
>>
>> Also note that the standard pdf device works fine: https://ptpb.pw/3Ml1.pdf
>> , it's just the cairo devices (both pdf and svg) that have the issue.
>> Unfortunately I need to use cairo_pdf due to unicode characters in axis
>> labels.
>>
>> Cheers, Ilia
>>
>
>
>

-- 
[...] or some clown changed the chips on a board and not its name.
(Don't laugh! Look at the SMC etherpower for that.)
-- from /usr/src/linux/MAINTAINERS



More information about the R-help mailing list