yixuan / showtext

Using Fonts More Easily in R Graphs
http://cran.r-project.org/web/packages/showtext/index.html
478 stars 38 forks source link

showtext messing up emoji rendering #54

Open matiasandina opened 2 years ago

matiasandina commented 2 years ago

I am trying to use emojis in a ggplot y axis for which I use a custom font (via showtext). I have noticed that emojis don't render after showtext_auto(). Is there a way this could be supported?

library(ggplot2)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(purrr)
#remotes::install_github("hadley/emo")
library(emo)

dat <- tibble(names = c("smile","school","office","blush","smirk","heart_eyes"),
              emoji = map_chr(names, emo::ji)) %>% 
  tibble::rowid_to_column("n")

dat %>% ggplot(aes(n, emoji)) + 
  geom_col(orientation="y") +
  theme(axis.text.y = element_text(size = 18))


library(showtext)
#> Loading required package: sysfonts
#> Loading required package: showtextdb
showtext_auto()
dat %>% ggplot(aes(n, emoji)) + 
  geom_col(orientation="y") +
  theme(axis.text.y = element_text(size = 18))

Created on 2021-12-01 by the reprex package (v0.3.0)

emreit1991 commented 2 months ago

I am having the same issue as above! Is this something that is planning to be addressed? Thank you!

salim-b commented 2 months ago

I also can't make emojis work with showtext. I thought the symbol argument of sysfonts::font_add() would allow to specify a separate emoji font (like Noto Color Emoji), but that doesn't seem to work, i.e. emojis are still replaced by a placeholder... 😕

@yixuan Any hints what's going on with emojis in showtext?