wch / extrafont

Tools for using fonts in R graphics
313 stars 49 forks source link

No font could be found #45

Open demidovakatya opened 8 years ago

demidovakatya commented 8 years ago

I loaded the xkcd font into the current directory. Following steps:

font_import(".", prompt = F)
loadfonts()
# Registering font with R using pdfFonts(): xkcd
ggplot(data = tg, aes(dose, len)) + geom_point() + theme(text=element_text(size=16, family="xkcd"))

# Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
#  polygon edge not found
# In addition: Warning message:
# In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
#  no font could be found for family "xkcd"

fonts()
# [1] "xkcd"

fonttable()
#  package     afmfile                                                   fontfile FullName
#1      NA xkcd.afm.gz /Users/mac/Documents/statinference-course-project/xkcd.ttf     xkcd
#  FamilyName FontName  Bold Italic Symbol afmsymfile
#1       xkcd     xkcd FALSE  FALSE  FALSE         NA

What could possibly go wrong?

AaronRanAn commented 8 years ago

I have the same issue too! I imported fonts at right path and it shows up when calling fonts(), but it just doesn't render in ggplot... Is there any possible solution?