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

Issue with ggplot text rendering not working for work sans #56

Closed
snruboo opened this issue Mar 9, 2021 · 1 comment
Closed

Issue with ggplot text rendering not working for work sans #56

snruboo opened this issue Mar 9, 2021 · 1 comment

Comments

@snruboo
Copy link

snruboo commented Mar 9, 2021

Related to this question on stackoverflow:
https://stackoverflow.com/questions/66489793/ggplot-text-rendering-not-working-for-some-fonts

I have been trying to add a google font to my ggplots, but the text renders with lots of gaps in it. Does anyone know how to fix this?

Seems like it may be an operating system specific problem. I'm using: OS: MacOS Catalina 10.15.7 R version: 4.0.4

Here is an example with massive text to demonstrate the problem:

library(ggplot2)
library(sysfonts)
library(showtext)
font_add_google("Work Sans")
showtext_auto()
ggplot(mtcars, aes(wt, mpg)) +
geom_point()+
theme(text = element_text(family = "Work Sans", size =100),
axis.text = element_blank())

@weiweihuanghuang
Copy link
Owner

This is because you need to remove the overlaps for the fonts, if you use the static fonts in the repo it won't have this problem. Looks like it was answered on the stack overflow. The fonts served on google need the overlaps for variable fonts to work unfortunately.

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