r - pdf with extrafont creates overlapping text -


i'm trying use arial typeface in pdfs, when follow instructions in extrafont file, text @ each point written on each other:

library(extrafont) library(ggplot2)  my_pdf <- function(file, width, height){   loadfonts()   pdf(file = file, width = width, height = height,       family = "arial") }   my_pdf("arialtester.pdf") qplot(1:10, 1:10, "point") + ggtitle(paste0(letters,letters, collapse="")) dev.off() 

i below in pdf. note title meant alphabet.

the context of question knitr, need device function can set chunk option (i.e. dev = 'my_pdf')

enter image description here

what have done incorrectly?

you need use embed_fonts().

library(extrafont) library(ggplot2)  my_pdf <- function(file, width, height){   loadfonts()   pdf(file = file, width = width, height = height,       family = "arial") }  my_pdf("arialtester.pdf") g <- qplot(1:10, 1:10, "point") + ggtitle(paste0(letters,letters, collapse="")) +   theme(text = element_text(family = "arial")) plot(g) dev.off() embed_fonts("arialtester.pdf") 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -