Tuesday 2 January 2018

r - xkcd style graph - error with registered fonts

itemprop="text">

I want to create the graph, like at
the href="https://stackoverflow.com/questions/12675147/how-can-we-make-xkcd-style-graphs-in-r/13985143#comment19302007_13985143">link
for the previous topic, but receive
error:




In
grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
Font

family not found in Windows font
database




Though
fonts() shows "Humor Sans" and "xksd" are installed. I use
Windows 7 64bit, R 2.15.2 RStudio 0.96.331.



Any
suggestions how to fix it?


itemprop="text">
class="normal">Answer



I think I
had the same problem some time ago. Here is what I
did:





  1. Put
    Humor-Sans font file into your project folder and make sure your working directory is
    set to the same.


  2. Import the fonts
    (this might take a while) by
    calling



    font_import()

  3. Look
    through the list of fonts and see if you can find Humor-Sans
    by



    fonts()

  4. Load
    the
    fonts




    loadfonts(device
    =
    "win")



Let
me know if it works!


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...