【发布时间】:2019-01-19 14:05:25
【问题描述】:
我想在 shinyapps.io 上的闪亮应用(在绘图上)中使用自定义字体。我的 Roboto-Regular.ttf 在./www/ 目录中。这是我的 app.R 文件的上半部分:
dir.create('~/.fonts')
system("chmod +x ./www/Roboto-Regular.ttf")
system("cp ./www/Roboto-Regular.ttf ~/.fonts/")
system('fc-cache -f -v ~/.fonts/')
system('fc-match Roboto')
library(ggplot2)
library(shiny)
library(shinythemes)
library(extrafont)
font_import(pattern="Roboto",prompt=FALSE)
loadfonts()
print(fonts())
在部署应用程序时,我最终遇到如下错误:
Registering fonts with R
Scanning ttf files in /usr/share/fonts/, ~/.fonts/ ...
Extracting .afm files from .ttf files...
/home/shiny/.fonts/Roboto-Regular.ttfWarning in gzfile(dest, "w") :
cannot open compressed file '/opt/R/3.5.1/lib/R/library/extrafontdb/metrics/Roboto-Regular.afm.gz', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
有谁知道可能出了什么问题?
【问题讨论】:
-
我遇到了同样的问题。同时你也想通了吗?
-
我已经添加了我从 RStudio 得到的关于此的回复。如果可行,请告诉我,我会接受它作为答案。