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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Yixuan Qiu
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 <[hidden email]>:

> 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 <[hidden email]>
Department of Statistics,
Purdue University

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Ilia Kats
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 <[hidden email]>:
>> 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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.