GuangchuangYu / emojifont

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

R session crash when plotting #8

Closed statnmap closed 7 years ago

statnmap commented 7 years ago

Hi, I want to update a blog post using your library emojifont that worked fine a few month ago. But today, a simple plot crashes my R session. I am working on Ubuntu 16.04. Rstudio crashes without message. With Rkward, there are some hidden warning messages before I plot saying:

1: font family '?VUUUUU?%P?,@73@' not found, will use 'wqy-microhei' instead
2: UTF-8 decoding error for 'pO
'

After trying to plot, the session crashes with this error:

Erreur : C stack usage  140735517452172 is too close to the limit

If I only send emoji('evergreen_tree') in the console, it returns the emoji

[1] "🌲"

The problem is the same even when I load the fonts before load.emojifont(font = "EmojiOne.ttf")

I tried installing both ttf directly, but this does not change. Any idea about what is going wrong ?

GuangchuangYu commented 7 years ago

screenshot 2017-08-17 09 47 53

Can you post a reproducible example?

statnmap commented 7 years ago

Well, I use your classic example. But, I just remarked the following strange behavior.

Test 1

If I run the code in this order in a new session, the first plot is ok:

# Order 1 ----
x <- rnorm(10)
y <- rnorm(10)
plot(x, y, cex=0)

library(emojifont)
text(x, y, labels=emoji('cow'), cex=1.5, col='steelblue', family='OpenSansEmoji')

order_ok But, then, if I close the plot and open a new one in the same session, the session crashes.

Test 2

If, in a new session, I call your library before a plot, the call to a plot crashes directly the session, even without emoji inside:

# Order 2 ----
library(emojifont)
x <- rnorm(10)
y <- rnorm(10)
plot(x, y, cex=0)
# Dont have time to run this line, the session crashes
text(x, y, labels=emoji('cow'), cex=1.5, col='steelblue', family='OpenSansEmoji')

message_before_crash

This is reproducible with any example as soon as I load your library before. Does your library modify anything in the plotting settings ?

GuangchuangYu commented 7 years ago

screenshot 2017-08-17 15 13 26

Sorry I can't reproduce this issue.

statnmap commented 7 years ago

FYI, I found the origin of the problem. Since library libfreetype6-dev in Ubuntu has been updated, it was necessary to reinstall library emojifont. However, you must also reinstall the libraries it depends on:

install.packages(c("sysfonts", "showtextdb", "showtext"))
install.packages("emojifont")

This solved the problem.

GuangchuangYu commented 7 years ago

thanks!