Custom fonts with shiny server?

1,524 views
Skip to first unread message

gummyl...@gmail.com

unread,
Oct 16, 2013, 12:56:57 PM10/16/13
to shiny-...@googlegroups.com
How could I load custom fonts to use with shiny server for my online apps? Can you just upload your fonts and use the extrafonts package to install those? Or maybe there's a way to use google web fonts?

Ramnath Vaidyanathan

unread,
Oct 16, 2013, 1:08:11 PM10/16/13
to shiny-...@googlegroups.com
Here is a minimal example

require(shiny)
runApp(list(
  ui = bootstrapPage(
    tags$link(
      rel = "stylesheet", 
    ),
    tags$style("h1{font-family: 'Open Sans'}"),
    tags$h1("Test Font"),
    numericInput('n', 'Number of obs', 100),
    plotOutput('plot')
  ),
  server = function(input, output) {
    output$plot <- renderPlot({ hist(runif(input$n)) })
  }
))
Message has been deleted

gummyl...@gmail.com

unread,
Oct 16, 2013, 1:45:21 PM10/16/13
to shiny-...@googlegroups.com
Thanks a lot!

gummyl...@gmail.com

unread,
Oct 17, 2013, 2:17:38 AM10/17/13
to shiny-...@googlegroups.com
oh.. How do I do this for the server code? I want to use a custom font with ggplot2. 


On Wednesday, October 16, 2013 12:08:11 PM UTC-5, Ramnath Vaidyanathan wrote:

gummyl...@gmail.com

unread,
Oct 21, 2013, 2:56:09 AM10/21/13
to shiny-...@googlegroups.com
Nevermind, I got extrafonts to work. There are some issues with the default cairo options. I had to put options(shiny.usecairo = FALSE) to get the fonts to work.
Reply all
Reply to author
Forward
0 new messages