Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using R package extrafont is generating error "font width unknown for character 0x48"

Tags:

r

fonts

library(extrafont)
setEPS()
postscript("demo.eps", width=3.3, height=3.3, onefile=FALSE, horizontal=FALSE,      paper = "special", family = "Times New Roman")
plot(rnorm(100), main="Hey Some Data")
dev.off()

I have extrafont package installed and also imported fonts and loaded the fonts for postscript device. Everything was ok. But when postscript device was started with a specific font and the plot command was given it started throwing a list of error messages which basically says "font width unknown for character 0x53" etc. I embedded the font also in the graph with extrafont command embed_fonts(). It produced a plot, but no font changes were made. But when I used cairo_ps device, it worked perfectly fine. Why is it not working with postscript device? Any help?

like image 411
Amritendu Mukhopadhyay Avatar asked Apr 05 '16 11:04

Amritendu Mukhopadhyay


1 Answers

Use "ArialMT" instead of "Arial" and "Times" instead of "Times New Roman", that worked for me with R 3.6.1 and ggplot in Windows 10.

https://stackoverflow.com/a/35465167/10125052

like image 83
Mike Avatar answered Nov 15 '22 06:11

Mike