GuangchuangYu / emojifont

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

RSTudio again. #6

Closed neuwirthe closed 8 years ago

neuwirthe commented 8 years ago

When opening a png device from the RStudio console, things work. Knitting also uses the png device, but knitting from Rmd files does not work with emojis. Is there a way to make it work this way?

GuangchuangYu commented 8 years ago

too much Rstudio issues from you, see https://github.com/GuangchuangYu/emojifont/issues/1 and https://github.com/GuangchuangYu/emojifont/issues/5. Even I told you emojifont is not compatible with Rstudio, you just ignore me and keep asking.

GuangchuangYu commented 8 years ago

Knitting without RStudio is OK (I just tested) and if knitting in RStudio won't work then knitr in RStudio is not using png device. I don't have RStudio to test (my favorite IDE is Emacs).

GuangchuangYu commented 8 years ago

I just install Rstudio, and knit the code you posted in last issue. It works. Knitr always use png no matter is in Rstudio or not.

2016-06-01-000517_1280x800_scrot

neuwirthe commented 8 years ago

Thanks for testing. Am I right in assuming the you used a Linux machine. In that case, it might be a knitr on OSX problem.

I will test on Windows and on Linux and report to you.

On 31 May 2016, at 17:50, Guangchuang Yu notifications@github.com wrote:

too much Rstudio issue from you, see #1 https://github.com/GuangchuangYu/emojifont/issues/1 and #5 https://github.com/GuangchuangYu/emojifont/issues/5. Even I told you emojifont is not compatible with Rstudio, you just ignore me and keep asking.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222732244, or mute the thread https://github.com/notifications/unsubscribe/AAJns4y7SHCBeWWtXUM5RkNwk1FzCvu-ks5qHFjdgaJpZM4IqaD3.

neuwirthe commented 8 years ago

OK, some more findings.

On Windows, with the file from the last message, I get

Quitting from lines 13-21 (emoji.Rmd) Error in text.default(x, y, labels = emoji("cow"), cex = 1.5, col = "steelblue", : invalid input '🐮' in 'utf8towcs' Calls: ... withVisible -> eval -> eval -> text -> text.default

And on the Mac, it seems to be a problem of telling pandoc to use the correct encoding when pandoc converts from the md file produces by knit to an html file.

Regards

Erich

On 31 May 2016, at 18:07, Guangchuang Yu notifications@github.com wrote:

I just install Rstudio, and knit the code you posted in last issue. It works. Knitr always use png no matter is in Rstudio or not.

https://cloud.githubusercontent.com/assets/626539/15681702/df8c4f9e-278c-11e6-8aa8-7b6aca45dd7b.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222737541, or mute the thread https://github.com/notifications/unsubscribe/AAJns3UAvPZNVddZn_9rOX9snR5aRktSks5qHFzZgaJpZM4IqaD3.

neuwirthe commented 8 years ago

Some more info:

It seems on the Mac one needs to install OpenSansEmoji.ttf as a Mac system font. Downloading and doublecklicking is enough, but just using load(‘emojifont,ttf’) in R is not enough.

I could not find this recommendation in the doc or the vignette. It it is really not there, you might decide to add it.

Doing this on Windows is not enough, then it still does not work.

Regards

Erich

On 31 May 2016, at 18:45, Erich Neuwirth erich.neuwirth@univie.ac.at wrote:

OK, some more findings.

On Windows, with the file from the last message, I get

Quitting from lines 13-21 (emoji.Rmd) Error in text.default(x, y, labels = emoji("cow"), cex = 1.5, col = "steelblue", : invalid input '🐮' in 'utf8towcs' Calls: ... withVisible -> eval -> eval -> text -> text.default

And on the Mac, it seems to be a problem of telling pandoc to use the correct encoding when pandoc converts from the md file produces by knit to an html file.

Regards

Erich

On 31 May 2016, at 18:07, Guangchuang Yu <notifications@github.com mailto:notifications@github.com> wrote:

I just install Rstudio, and knit the code you posted in last issue. It works. Knitr always use png no matter is in Rstudio or not.

https://cloud.githubusercontent.com/assets/626539/15681702/df8c4f9e-278c-11e6-8aa8-7b6aca45dd7b.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222737541, or mute the thread https://github.com/notifications/unsubscribe/AAJns3UAvPZNVddZn_9rOX9snR5aRktSks5qHFzZgaJpZM4IqaD3.

neuwirthe commented 8 years ago

This is what I get on the Mac. The set off rectangles are strange.

GuangchuangYu commented 8 years ago

thanks for your email. I use your package, RColorBrewer, too.

I don't think we need to install the OpenSansEmoji in OSX or Windows.

I just check with the Font Book and quite sure that the OpenSansEmoji is not install in my systems.

Also as I showed you in https://github.com/GuangchuangYu/emojifont/issues/1, emojifont works in Windows:

I do test knitting in OSX and your issue is reproducible, either in Rstudio or in R console. After reading the knitr options, http://yihui.name/knitr/options/, I find a parameter fig.showtext that designed to support changing fonts in R plot.

screenshot 2016-06-01 13 33 39

GuangchuangYu commented 8 years ago

The error msg in your Windows knitting is weird. I have no idea about it.

neuwirthe commented 8 years ago

Another discovery. When is use dthe svg device {r, dev=‘svg’} In Rmd files in RStudio on the Mac, things work without a problem.

On 01 Jun 2016, at 08:03, Guangchuang Yu notifications@github.com wrote:

The error msg in your Windows knitting is weird. I have no idea about it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222900898, or mute the thread https://github.com/notifications/unsubscribe/AAJnsx9wKnHCIepjRel9QJp3eU_6rlgzks5qHSDAgaJpZM4IqaD3.

GuangchuangYu commented 8 years ago

dev='svg' only works when you have the font installed.

neuwirthe commented 8 years ago

With svg I get working html files from Rmd files, but when I try to print, ther printer tells me that this is an invalid file. I also save the html to pdf, and then also got the same error: invalid file.

On 01 Jun 2016, at 10:54, Guangchuang Yu notifications@github.com wrote:

dev='svg' only works when you have the font installed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222932547, or mute the thread https://github.com/notifications/unsubscribe/AAJns9UDCBnb-y_8PNdd67mZz7oUdCHaks5qHUirgaJpZM4IqaD3.

GuangchuangYu commented 8 years ago

I print the pdf, it's just fine.

2016-06-01 18 09 29

neuwirthe commented 8 years ago

OK, then it is a problem of my printer.

On 01 Jun 2016, at 12:10, Guangchuang Yu notifications@github.com wrote:

I print the pdf, it's just fine.

https://cloud.githubusercontent.com/assets/626539/15705992/11598c52-2824-11e6-84da-de34e7c5fd59.jpg — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GuangchuangYu/emojifont/issues/6#issuecomment-222950305, or mute the thread https://github.com/notifications/unsubscribe/AAJns1yZ8LroJWkoBCSPk-doOQm-szdGks5qHVqWgaJpZM4IqaD3.

neuwirthe commented 8 years ago

I did some more investigation:

With the svg device, I can produce html files with emojifont. But then, I could not prnt it (in Preview on the Mac). Then I installed Acrobat Reader, and I can print the file with Acrobat Reader.

So with some twists and hacks, I can use the package on my Mac!

Thanks for creating this package.

Regards from Austria

Erich

GuangchuangYu commented 8 years ago

thanks for your feedback.

RobertMyles commented 7 years ago

Hi, I was having a similar problem with RStudio and OSX. dev = 'svg' solved it pretty much. Thanks, Erich! (& GuangchuangYu for the funny & great package)