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

Wrong font on Linux (vscode-remote) #85

Open
albert-ying opened this issue Oct 20, 2021 · 3 comments
Open

Wrong font on Linux (vscode-remote) #85

albert-ying opened this issue Oct 20, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@albert-ying
Copy link

I noticed that the font in the browser is always some kind of serif font, even when I specify the font to be Helvetica.

This only happens on the remote Linux machine.

The code:

library(ggplot2)
p1 = ggplot(mtcars) +
  geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
  hrbrthemes::theme_ipsum(base_family = "Helvetica") +
  labs(
    title = "Fuel Economy",
    subtitle = "Fuel economy declines as weight increases, 1973-74",
    caption = "Data from the 1974 Motor Trend US magazine.",
    x = "Weight (1000 lbs)",
    y = "MPG",
    colour = "Gears"
  )

  p1

  ggsave("./test.pdf", p1)

Output in httpgd

image

Output in pdf

image

Also related to #51

@albert-ying albert-ying added the bug Something isn't working label Oct 20, 2021
@nx10
Copy link
Owner

nx10 commented Oct 20, 2021

Thanks for opening the issue.

I think this is caused by the helvetica font not being installed on the remote machine.
I will see if I can find a workaround when I get time.

Could you check if the font is installed on the remote machine and if installing it fixes the issue?

@albert-ying
Copy link
Author

Thank you! I just tried to install the Helvetica on the remote machine, and it works now!

But it is still puzzling to me, why does the ggsave to pdf works without the font installed while the httpgd doesn't?

@divijsinhaiihs
Copy link

Hey, I have the same issue. Even after registering the font with systemfonts::register_font() the issue persists. The font is correct in ggsave but not in httpgd, even tho the font is installed on the machine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants