[R] Computer Modern

Paul Murrell p.murrell at auckland.ac.nz
Fri Jul 24 05:19:33 CEST 2009


Hi


Mr Derik wrote:
> Thank you for your help.
> 
> I've read all the documentation I can find and I still can't get this to
> work.
> 
> postscriptFonts()
> 
> in my console produces a list of fonts already mapped yes?
> 
> one of which is:
> 
> $ComputerModernItalic
> $family
> [1] "ComputerModernItalic"
> 
> $metrics
> [1] "CM_regular_10.afm" "CM_boldx_10.afm"   "cmti10.afm"
> "cmbxti10.afm"      "CM_symbol_10.afm"
> 
> $encoding
> [1] "TeXtext.enc"
> 
> attr(,"class")
> [1] "Type1Font"
> 
> So modifying the code of Paul's website:
> 
> pdf("destructiontest.pdf")
> par(family="ComputerModernItalic")
> demo(plotmath)
> dev.off()
> 
> Should give me what I want. Instead I get a file which can't be opened and
> 25 warnings which all look like this:
> 
> 25: In text.default(2 * c - 0.5, -r, title) :
>   font family not found in PostScript font database


But you are creating a PDF file, not a PostScript file, and if you look 
at names(pdfFonts()) you'll see that there is no ComputerModernItalic there.


> I've tried the "Test full Adobe Symbol font" code off Paul's website with
> the fonts loaded into my working dir as described. I get 35 warnings of the
> type:
> 
> 1: In grid.Call.graphics("L_text", as.graphicsAnnot(x$label),  ... :
>   font width unknown for character 0x7f
> 
> and a pdf with dots in place of every character.
> 
> I can open the example pdf on Paul's website and see the correct CM font so
> my viewer must be working.
> 
> Any other ideas would be welcome.


Is it possible that you have set the fonts up using PostScriptFonts() 
when you should really be using pdfFonts() ?

Paul


> Paul Murrell wrote:
>> Hi
>>
>> Also see http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html
>>
>> Paul
>>
>>
>> (Ted Harding) wrote:
>>> On 02-Jul-09 09:06:44, Mr Derik wrote:
>>>> I am trying to use computer modern fonts in postscript files
>>>> for a latex document. Ultimately I want to automate this through
>>>> sweave. I've read the documentation ans have tried the following
>>>> code to use lattice to produce a graph using computer modern:
>>>>
>>>> library(lattice)
>>>> library(grid)
>>>> testPlot=(
>>>> xyplot(seq(1:10) ~ seq(1:10),
>>>>                     main="one to ten",
>>>>                     xlab="the quick fox",
>>>>                     ylab="jumped over the lazy brown dog",
>>>>                     xlim=c(0,1),
>>>>                     ylim=c(0,1),
>>>>                     col="black",
>>>>                     type="l" ,
>>>>                     lwd=2
>>>>                     )
>>>>                     )
>>>> setwd("C:\\R_folder\\CMtests")
>>>> postscript("cm_test.eps", width = 4.0, height = 3.0,
>>>>            horizontal = FALSE, onefile = FALSE, paper = "special",
>>>>            family = "ComputerModern", encoding = "TeXtext.enc")
>>>>        print(testPlot)
>>>> dev.off()
>>>>
>>>> This produces a plot with courier.
>>>>
>>>> I am using R 2.9.0 on a windows XP machine. I did manage to produce
>>>> one plot with CM as the font so I know it's possible with my set up.
>>>> I can't get back to that. Please help me with the code.
>>>> Thank You
>>> I think you may need to also use the "fonts" pAramater to postscript().
>>> See in '?postscript':
>>>
>>>   fonts: a character vector specifying additional R graphics font
>>>         family names for font families whose declarations will be
>>>         included in the PostScript file and are available for use
>>>         with the device. See 'Families' below.  Defaults to 'NULL'.
>>>
>>> Since the Computer Modern family is most probably not built in
>>> to your printer, the PostScript file will need to include font
>>> definitions for these fonts. If I understand aright, this is what
>>> would be achieved by appropriate use of the "fonts" parameter.
>>>
>>> If the font definitions are not included, the calls for them will
>>> not be recognised by the printer which may then substitute a default
>>> (likely to be Courier).
>>>
>>> See also the section "TeX fonts" in '?postscript'.
>>>
>>> Ted.
>>>
>>> --------------------------------------------------------------------
>>> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 02-Jul-09                                       Time: 11:59:29
>>> ------------------------------ XFMail ------------------------------
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> 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.
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
>>
>>
> 
> --
> View this message in context: http://www.nabble.com/Computer-Modern-tp24303553p24424418.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

-- 
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