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

Arabic Text Support #55

Open
iyedg opened this issue Jan 16, 2022 · 1 comment
Open

Arabic Text Support #55

iyedg opened this issue Jan 16, 2022 · 1 comment

Comments

@iyedg
Copy link

iyedg commented Jan 16, 2022

When trying to use Arabic text in a ggplot, it usually functions normally (as shown in my first example without showtext). However, using a font family with showtext I get a problem where arabic text gets split into individual letters and are reversed. Any idea if there are transofrmations I should do to how I normally load fonts for latin scripts ?

Thank you for the effort you put in this library!

library(magrittr)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)

airquality %>%
  ggplot(aes(x = Day, y = Temp)) +
  geom_point() +
  scale_y_continuous(position = "right") +
  labs(
    title = "الحب سماء لا تمطر غير الأحلام",
    y = "الحرارة",
    x = "اليوم"
  ) +
  theme(
    axis.title.y.left = element_blank(),
    plot.title = element_text(hjust = 1),
  )

Created on 2022-01-16 by the reprex package (v2.0.1.9000)

Standard output and standard error
-- nothing to show --
library(magrittr)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
library(showtext)
#> Loading required package: sysfonts
#> Loading required package: showtextdb

showtext_auto()
font_add_google("Tajawal", "tajawal")

airquality %>%
  ggplot(aes(x = Day, y = Temp)) +
  geom_point() +
  scale_y_continuous(position = "right") +
  labs(
    title = "الحب سماء لا تمطر غير الأحلام",
    y = "الحرارة",
    x = "اليوم"
  ) +
  theme(
    axis.title.y.left = element_blank(),
    plot.title = element_text(hjust = 1, family = "tajawal"),
  )

Created on 2022-01-16 by the reprex package (v2.0.1.9000)

@riyadh-radhi
Copy link

I'm having similar issues. It would be great if someone has hints on how to solve this. Thanks!

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

2 participants