[R] Embed fonts in an R graph
David Winsemius
dwinsemius at comcast.net
Fri Jul 10 17:53:12 CEST 2015
On Jul 10, 2015, at 8:45 AM, David Winsemius wrote:
>
> On Jul 10, 2015, at 7:40 AM, Edwin Sun wrote:
>
>> Hello all,
>>
>> I cannot embed a common font type into an R graph. I did it successfully in
>> December 2014 with the previous R version. However, with R 3.2.1 in July
>> 2015, the following sample codes do not work anymore.
>>
>> pdf(file = "c:/testA.pdf", family = "serif")
>> plot(x = 1:10, y = rnorm(10))
>> dev.off()
>> embedFonts(file = "c:/testA.pdf", outfile = "c:/testB.pdf")
>>
>
> When you look at ?embedFonts it becomes obvious that this is a process mediated by GhostScript, an external program no under the control of the R Team, but rather a system facility that you are responsible for maintaining on your unspecified (but inferable) operating system.
>
And don't forget to read your News. In this case, there is an item in the very first entry about embedFonts:
> str(news())
Classes ‘news_db_from_Rd’, ‘news_db’ and 'data.frame': 681 obs. of 4 variables:
$ Version : chr "3.1.2" "3.1.2" "3.1.2" "3.1.2" ...
$ Date : chr NA NA NA NA ...
$ Category: chr "NEW FEATURES" "NEW FEATURES" "NEW FEATURES" "NEW FEATURES" ...
$ Text : chr "embedFonts() now defaults to format = \"ps2write\" for .ps and .eps\nfiles. This is available in Ghostscript 9.x (since 2010) "| __truncated__ "For consistency with [dpqr]norm(), [dp]lnorm(sdlog = 0) model a\npoint mass at exp(mulog) rather than return NaN (for an error)"| __truncated__ "capabilities() now reports if ICU is compiled in for use for\ncollation (it is only actually used if a suitable locale is set f"| __truncated__ "(OS X only.) Package tcltk checks when loaded if it is linked\nagainst the CRAN X11-based Tcl/Tk and if so that the Tcl/Tk\ncom"| __truncated__ ...
- attr(*, "bad")= logi FALSE FALSE FALSE FALSE FALSE FALSE ...
- attr(*, "package")= chr "R"
Here's a way to search for any others:
> newstuff$Text[ grepl("embed", newstuff$Text) ]
[1] "embedFonts() now defaults to format = \"ps2write\" for .ps and .eps\nfiles. This is available in Ghostscript 9.x (since 2010) whereas\nthe previous default, format = \"pswrite\", was removed in\nGhostscript 9.10."
[2] "Error messages from bugs in embedded Sexpr code in Sweave documents\nnow report the source location."
[3] "read.table(), readLines() and scan() have a new argument to\ninfluence the treatment of embedded nuls."
[4] "read.table(), readLines() and scan() now warn when an embedded nul\nis found in the input. (Related to PR#15625 which was puzzled by\nthe behaviour in this unsupported case.)"
>
>> As a result, both testA.pdf and testB.pdf cannot embed the fonts into the
>> graph.
>
> That sentence did not make sense to me. I would have expected 'testA.pdf" to have been altered at all.
>
> --
> David.
>
> Since You are posting through Nabble I'd suggest you read the Posting Guide:
>
> R-help at r-project.org 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.
>
>
>> Specifically, Adobe Acrobt reveals that "Times-Roman" is substituted
>> by "TimesNewRomanPSMT", and "ZapfDingbats" is substituted by "AdobePiStd".
>>
>> Any help is greatly appreciated.
>>
>> Edwin
>>
>> <http://r.789695.n4.nabble.com/file/n4709707/Capture.png>
>>
>>
>>
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Embed-fonts-in-an-R-graph-tp4709707.html
>> Sent from the R help mailing list archive at Nabble.com.
> --
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> R-help at r-project.org 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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list