Closed
Description
(Related to yixuan/showtext#33)
Minimal reprex (must be run on a machine without aqua capabilities and viewed on a high-resolution display):
library(shiny)
library(showtext)
font_add_google("Gochi Hand", "gochi")
showtext_auto()
# showtext's dpi option currently doesn't work with CairoPNG (see issue above for more details)
opts <- options(shiny.usecairo = FALSE)
onStop(function() { options(ops) })
shinyApp(
ui = fluidPage(
numericInput("n", "n", 1),
plotOutput("plot")
),
server = function(input, output) {
output$plot <- renderPlot({
plot(head(cars, input$n), family = "gochi")
title("Hello world")
})
}
)
Notice how the text is much smaller than it should be because showtext is unaware of the device resolution. Shiny needs to set showtext::showtext_opts(dpi = ...)
with the resolution it passes to the graphics device for this to work properly.