yihui / xaringan

Presentation Ninja ๅนป็ฏๅฟ่€… ยท ๅ†™่ฝฎ็œผ
https://slides.yihui.org/xaringan/
Other
1.49k stars 281 forks source link

Emojis lose color when printed #330

Closed jmgirard closed 2 years ago

jmgirard commented 3 years ago

When I add emojis to my presentation and open it in Chome, they render nicely in color. But when I try to print it (to create a PDF file), they lose their color and render as white outlines. I suspect this has something to do with the device CSS changing fonts or something. Is there a way to prevent this replacement from happening (e.g., perhaps via CSS)? Or is there some better way to generate a PDF file for my presentation?

Appearance of emojis when viewed in Chrome image

Appearance of emojis when printed from Chrome image

---
title: "๐Ÿ‘ท ๐Ÿ—„๏ธ ๐Ÿ› ๏ธ"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---
jmgirard commented 3 years ago

This may be a Windows-specific thing. My friend tried it on Mac and retained the colors.

cderv commented 3 years ago

I don't think this is something specific to xaringan. It will be the same with html_document

---
title: "test emoji"
output: html_document
---

These are emoji : ๐Ÿ‘ท ๐Ÿ—„๏ธ ๐Ÿ› ๏ธ

It is highly possible that this is OS specific because emojis used here are fonts. And fonts is often OS specific. Or it could also be browser specific like differences between Safari and Chrome.

A possible workaround for you would be to use image emoji, but this is not yet something available from R directly (for example see https://github.com/hadley/emo/issues/29). The JS lib twemoji that offers this would need to be used directly.

Otherwise, you may consider fontawesome icon for example, or other set of icons. There are a few package that helps with this, and includes those icons as image too.

Anyway, I am not sure there is anything we can do in xaringan or rmarkdown about this.

jmgirard commented 3 years ago

Thanks for looking into it.