Kerning irregularities in ggtext markdown titles

31 views Asked by At

I keep generating irregularities in kerning when using ggtext for ggplot titles.

For instance:

library(tidyverse)
library(showtext)
library(ggtext)

font_add_google("Public Sans")

p1 <- mtcars %>% 
  ggplot(
    aes(
      wt, mpg
    )
  ) +
  geom_point() +
  theme_minimal(base_family = "Public Sans") +
  labs(
    title =  "Lorem ipsum dolor sit amet, vel vel est donec nulla nam aliquet in in auctor. Sed dolor orci aliquet nunc" 
  ) +
  theme(
    plot.title = element_markdown()
  )

showtext_auto()
ggsave(
  plot = p1,
  filename = "mtcars plot.pdf",
  width = 11.3,
  height = 4.5
)

generates a plot like this (red highlighting added to show the kerning irregularities.)

enter image description here

Is this a known bug or am I misusing this library?

0

There are 0 answers