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

Yixuan Qiu yixuan.qiu at cos.name
Sat Jul 8 07:11:10 CEST 2017


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
>




-- 
Yixuan Qiu <yixuan.qiu at cos.name>
Department of Statistics,
Purdue University



More information about the R-help mailing list