true type fonts - r wordcloud external ttf vfont not recognized -
i've installed 'extrafont' package in order install external font library duality via ttf_import() method. however, when specifying font via wordcloud method, receive following error:
installation command:
# assuming font file, duality_.ttf, in working directory (see link font above) font_import(".",false,pattern="duality")
wordcloud command:
wordcloud(ap.d$word, ap.d$freq, scale=c(8,2), min.freq=10, vfont=c("duality","plain"), random.order=false, rot.per=0, use.r.layout=false, colors=pal2, fixed.asp=false)
output:
error in strwidth(words[i], cex = size[i], ...) : invalid 'vfont' value [typeface -2147483648]
in order verify font indeed installed, issued following commands
> choose_font("duality") [1] "duality" > fonts() ....[49] "waree" "duality"
how come duality font not visible vfont parameter of wordcloud? , how make visible cairo (the default renderer). tia!
i've been able overcome same problem using parameters passed text family
, font
, described in ?par
instead of vfont
. needed load font first. thing goes:
import font (sorry, link duality provided in op no longer available, use lucida handwriting instead, available in windows):
library(extrafont) font_import(pattern="lhandw")
load (see blog details):
loadfonts() # loadfonts(device = "win") if working in windows
wordcloud:
wordcloud(ap.d$word, ap.d$freq, scale=c(8,2), min.freq=10, family="lucida handwriting", font=1, random.order=false, rot.per=0, use.r.layout=false, colors=pal2, fixed.asp=false)
Comments
Post a Comment