[R] PDF fonts problem

Paul Murrell p.murrell at auckland.ac.nz
Mon Sep 22 04:42:15 CEST 2008


Hi


Mihalicza Péter wrote:
> Dear Dr. Murrel,
> 
> Thank you for all the clarifications!
> 
> Paul Murrell írta:
>> Hi
>>
>>>
>>> #CMS
>>> pdf("tryfont-cms.pdf", family="CMS")
>>> grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
>>> dev.off()
>>> #u151 and u171 doesn't show, though the other accented ones do
>>>
>>> embedFonts("tryfont-cms.pdf",
>>> outfile="tryfont-cms-embed.pdf",
>>> fontpaths="/cm-super/afm/")
>>> #after embedding the same "slipping" occurs
>>
>> The 'fontpaths' argument describes where the PFB files are, not where 
>> the AFM files are.  So this is probably failing to embed the fonts 
>> because it can't find the fonts.  Does it work if you change to 
>> something like ...
>>
>>  embedFonts("tryfont-cms.pdf",
>>            outfile="tryfont-cms-embed.pdf",
>>            fontpaths="cm-super/pfb/")
>>
>> Paul
>>
>>
> This solved my problem, so I am really very grateful! I am not too 
> familiar with font protocols.
> Just for the sake of knowledge: if my embedFonts specification should 
> not have made any difference, why did the output pdf differed from the 
> one before embedding?


Your embedFonts() specification (especially your 'fontpaths' argument)
*did* make a difference.  This function calls ghostscript to perform the
embedding and if ghostscript cannot find the PFB files it cannot embed
the font.  If the PDF file does not have embedded fonts, the PDF reader
will use (substitute) its own fonts and the result can look awful.

Paul


> Thanks again,
> Peter
> 
> 
> 

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