-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Hebrew and digits don't render ("Failed to get emoji face") #6013
Comments
Thanks for the report! This is an issue with graphics devices, which is beyond the control of ggplot2. library(grid)
grid.newpage()
grid.text(
x = c(0.25, 0.5, 0.75),
y = 0.5,
label = c("זה טקסט",
"this is text with number 1",
"זה טקסט עם מספר 2")
)
Created on 2024-07-25 with reprex v2.1.1 |
Thanks @teunbrand. |
If we take another device library(grid)
grid.newpage()
grid.text(
x = c(0.25, 0.5, 0.75),
y = 0.5,
label = c("זה טקסט",
"this is text with number 1",
"זה טקסט עם מספר 2")
) Created on 2024-07-25 with reprex v2.1.1 Another thing that you could try is to explicitly use a font that you know contains all the glyphs that you need. Font used in example below is available here: https://fonts.google.com/noto/specimen/Noto+Sans+Hebrew. This sort-of looks correct to my untrained eye, but again, I'm no RtL language expert. knitr::opts_chunk$set(dev = "ragg_png")
library(grid)
grid.newpage()
grid.text(
x = c(0.25, 0.5, 0.75),
y = 0.5,
label = c("זה טקסט",
"this is text with number 1",
"זה טקסט עם מספר 2"),
gp = gpar(family = "Noto Sans Hebrew")
) Created on 2024-07-25 with reprex v2.1.1 |
Thanks! How do integrate this solution with ggplot? adding |
Honestly, I don't know: it seems to fail on my end too and results are inconsistent. Using straightforward print to device, the #+ setup, include=FALSE
knitr::opts_chunk$set(dev = "ragg_png")
#+ main
library(ggplot2)
df <- data.frame(
x = 1:3,
y = 0,
label = c("זה טקסט",
"this is text with number 1",
"זה טקסט עם מספר 2")
)
ggplot(df, aes(x, y)) +
geom_label(
aes(label = label),
family = "Noto Sans Hebrew", hjust = 'inward'
)
Created on 2024-07-25 with reprex v2.1.1 Using library(ggplot2)
df <- data.frame(
x = 1:3,
y = 0,
label = c("זה טקסט",
"this is text with number 1",
"זה טקסט עם מספר 2")
)
p <- ggplot(df, aes(x, y)) +
geom_label(
aes(label = label),
family = "Noto Sans Hebrew", hjust = 'inward'
)
ggsave("temp.png", p, device = ragg::agg_png)
#> Saving 7 x 5 in image
#> Failed to get emoji face: �, 10
#> Failed to get emoji face: , 0
#> Failed to get emoji face: , 65024
knitr::include_graphics("temp.png") Created on 2024-07-25 with reprex v2.1.1 |
This is weird - I now see that at least 4 months ago this did work (comparing a plot that use to render properly). |
Let's just re-open this because |
In the dev version of ggplot2, the |
I found a problem when mixing Hebrew text with numbers - it causes the text to not appear. This does not affect other text in the figure.
Here are some oddities:
reprex::reprex()
(on the same machine).ggsave()
as a.png
also has the missing text (as below).ggsave()
as a.pdf
has the text, but all of the Hebrew letters (regardless of mixing with numerals) are replaced with.
s, which I suspect is a "standard" encoding problem.Here is the code to reproduce the bug:
Session info
The text was updated successfully, but these errors were encountered: