[R] PDF fonts problem

Mihalicza Péter mihalicza.peter at eski.hu
Thu Sep 18 18:13:38 CEST 2008


Dear List,

I am writing a paper in Hungarian, that I Sweave and than pdfLaTeX. 
Everything is fine, except for two accented letters in the graphs that 
behave strange, though on the screen and in eps exports they look 
perfect. The problem is that I need pdf graphs, since I would like to 
have a PDF after LaTeX-ing.
For the example below I downloaded the following two font sets:
1. Latin Modern from http://www.ctan.org/get/fonts/lm.zip
2. Computer Moder Super from 
http://www.ctan.org/get/fonts/ps-type1/cm-super.zip
Both are specifically made for Eastern European languages (among many 
other).

The example is (I hope it is fully reproducible):

Sys.setlocale(category="LC_CTYPE", locale="hungarian")

LM <- Type1Font("LM", paste("lm/fonts/afm/public/lm/", c("lmb10.afm", 
"lmbx10.afm", "lmbo10.afm", "lmbxo10.afm"), sep=""))
pdfFonts(LM=LM)
postscriptFonts(LM=LM)

CMS <- Type1Font("CMS", paste("cm-super/afm/", c("sfrm1000.afm", 
"sfrb1000.afm", "sfti1000.afm", "sfsl1000.afm"), sep=""))
pdfFonts(CMS=CMS)
postscriptFonts(CMS=CMS)

#Default
pdf("tryfont-default.pdf")
grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
dev.off()
#The u151 and the u171 characters "slips into" the characters following 
them ("h" and "l")

postscript("tryfont-default.eps")
grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
dev.off()
#everything is perfect

#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

postscript("tryfont-cms.eps", family="CMS")
grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
dev.off()
#everything is perfect

#LM
pdf("tryfont-lm.pdf", family="LM")
grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
dev.off()
#same as CMS

embedFonts("tryfont-lm.pdf",
outfile="tryfont-lm-embed.pdf",
fontpaths="lm/fonts/afm/public/lm/")
#same as CMS

postscript("tryfont-LM.eps", family="LM")
grid.text("gg\u151hh\uF6ii\uF3jj kk\u171ll\uFCmm\uFAnn")
dev.off()
#same as CMS

After trying all this, I am out of ideas.
Could anyone suggest a solution?

 > sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=Hungarian_Hungary.1250;LC_CTYPE=Hungarian_Hungary.1250;LC_MONETARY=Hungarian_Hungary.1250;LC_NUMERIC=C;LC_TIME=Hungarian_Hungary.1250

attached base packages:
[1] datasets  utils     stats     graphics  grDevices splines   grid    
[8] methods   base    

other attached packages:
[1] ggplot2_0.6        colorspace_0.95    RColorBrewer_1.0-2 
MASS_7.2-44      
[5] proto_0.3-8        reshape_0.8.0      Hmisc_3.4-3      

loaded via a namespace (and not attached):
[1] cluster_1.11.11 lattice_0.17-13


Thank you,
Peter

-- 
Peter Mihalicza
economist

National Institute for Strategic Health Research
6-8. Arany János utca, Budapest-1051, Hungary
www.eski.hu

Tel.: +36-1-354-5320
E-mail: mihalicza.peter at eski.hu



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the R-help mailing list