Hey guys!
I am trying to create shiny app, that produces rmarkdown pdf reports with content depending on user input. Text will be in Latin and Ukrainian alphabet. App works perfectly locally, however hosted on shinyapps.io does not display Ukrainian text.
Minimal example:
App.r
dir.create('~/.fonts')
f = dir("www")
file.copy(paste("www/",f,sep=""), "~/.fonts")
system('fc-cache -f ~/.fonts')
shinyApp(
ui = fluidPage(
downloadButton("report", "Generate report")
),
server = function(input, output) {
output$report <- downloadHandler(
filename = "report.pdf",
content = function(file) {
tempReport <- file.path(tempdir(), "report.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
params <- NULL
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
)
}
)
Report.Rmd
---
geometry: "left=5mm,top=5mm,right=10mm,bottom=5mm"
output:
pdf_document:
latex_engine: xelatex
extra_dependencies:
tikz: null
enumitem: null
xcolor: null
polyglossia: null
blindtext: null
rotating: null
multicol: null
header-includes:
- \newfontfamily{\cyrillicfont}{Arimo-Regular.ttf}
- \newfontfamily{\cyrillicfontsf}{Arimo-Regular.ttf}
---
This is text in latin alphabet.
Це український текст.
If anyone has idea how to make it working on shinyapps.io, I would appreciate.