GuangchuangYu / emojifont

:lollipop:Emoji and fontawesom in both base and ggplot2 graphics
https://guangchuangyu.github.io/emojifont/
67 stars 22 forks source link

OSX and RStudio problem #5

Closed neuwirthe closed 8 years ago

neuwirthe commented 8 years ago

OK, I did more detailed investigations. The packages works with the quartz device in OSX.

library(emojifont)
load.emojifont('OpenSansEmoji.ttf')
set.seed(123)
x <- rnorm(10)
set.seed(321)
y <- rnorm(10)
plot(x, y, cex=0)
text(x, y, labels=emoji('cow'), cex=1.5, col='steelblue', family='OpenSansEmoji')

When I try to knit it in RStudio, I get a warning:

Warning in text.default(x, y, labels = emoji("cow"), cex = 1.5, col =
"steelblue", : no font could be found for family "OpenSansEmoji"

When I source R code in RStudio an explicitly use the quartz device, it works,

But with RStudio's own graphics device, it does not work.

GuangchuangYu commented 8 years ago

this is a known issue, see the limitation session in the vignette, https://cran.r-project.org/web/packages/emojifont/vignettes/emojifont.html#limitation.