Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showtext messing up emoji rendering #54

Open
matiasandina opened this issue Dec 1, 2021 · 4 comments
Open

showtext messing up emoji rendering #54

matiasandina opened this issue Dec 1, 2021 · 4 comments

Comments

@matiasandina
Copy link

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
Copy link

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

@salim-b
Copy link

salim-b commented Jul 8, 2024

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?

@rsh52
Copy link

rsh52 commented Nov 12, 2024

I'm also finding that showtext_auto() breaks emoji rendering, it would be great to resolve this @yixuan

@rsh52
Copy link

rsh52 commented Nov 13, 2024

For those interested, following these examples and tips from June Choe and Cara Thompson were extremely helpful:

In my use case, I wanted to make a specific font (FontAwesome) available to users of a package I'm developing. First step is to use systemfonts::register_font() with the appropriate font TTF and check its availability with systemfonts::registry_fonts(). Once confirmed and the font was loaded, I no longer needed to use showtext to get my font to render, and it no longer impacted emoji rendering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants