nx10 / httpgd

Asynchronous http server graphics device for R.
https://nx10.github.io/httpgd
GNU General Public License v2.0
389 stars 19 forks source link

Wrong font on Linux (vscode-remote) #85

Open albert-ying opened 3 years ago

albert-ying commented 3 years ago

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

nx10 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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