title: Fonts not available in R after importing
body: <p>I'm having some trouble importing fonts in the R environment. My end goal is to include my company's custom font(.ttf files) R for use in ggplot and RMarkdown. I've tried breaking down the problem and noticed that the same problem occurs importing regular Windows fonts. The importing doens't throw any errors, but the fonts are not available for use in plots. I'm using R version 3.5.1 running on Windows 10 Pro 1803.</p>
  <p>I've tried importing the Windows fonts using the extrafont package as well as using the showtext packakge. I have also tried to manually copy all the Windows ttf files from C:\WINDOWS\Fonts to C:\Users...\Documents\R\R-3.5.1\library\extrafontdb\metrics , same issue persists.</p>
  <p>Here's some code chunks with an R base dataset that throws the error:</p>
  <pre><code>library(ggplot2)
  library(extrafont) 
  font_import()
  
  # Only three fonts seem to have been imported...
  loadfonts(); windowsFonts()
  #$`serif`
  #[1] &quot;TT Times New Roman&quot;
  
  #$sans
  #[1] &quot;TT Arial&quot;
  
  #$mono
  #[1] &quot;TT Courier New&quot;
  
  
  ggplot(data = esoph) +
    aes(x = agegp, weight = ncases) +
    geom_bar() +
    ggtitle(&quot;This is a title&quot;) +
    theme(plot.title =  element_text(size = 14, family = &quot;Calibri&quot;))
  
  #Warning messages:
  #1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  #  font family not found in Windows font database
  #2: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  #  font family not found in Windows font database
  #3: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  #  font family not found in Windows font database
  
  </code></pre>
  <p>UPDATE: I have also tried importing using package showtext instead of extrafont.</p>
  <pre><code>library(ggplot2)
  library(showtext)
  
  # Check the current search path for fonts
  font_paths()    
  # [1] &quot;C:\\WINDOWS\\Fonts&quot;
  
  # List available font files in the search path
  font_files() 
  #                path                                file                            family            face
  # 1   C:/WINDOWS/Fonts                         AGENCYB.TTF                         Agency FB            Bold
  # 2   C:/WINDOWS/Fonts                         AGENCYR.TTF                         Agency FB         Regular
  # 3   C:/WINDOWS/Fonts                           ALGER.TTF                          Algerian         Regular
  # 166 C:/WINDOWS/Fonts             GeorgiaPro-SemiBold.ttf              Georgia Pro Semibold
  
  # Add one of these fonts
  font_add(&quot;Agency FB&quot;, &quot;AGENCYB.ttf&quot;)
  
  font_families()
  # [1] &quot;sans&quot;         &quot;serif&quot;        &quot;mono&quot;         &quot;wqy-microhei&quot; &quot;Calibri&quot;      &quot;CalistoMT&quot;    &quot;Agency FB&quot;  
  
  showtext_auto() 
  
  ggplot(data = esoph) +
    aes(x = agegp, weight = ncases) +
    geom_bar() +
    ggtitle(&quot;This is a title&quot;) +
    theme(plot.title =  element_text(size = 14, family = &quot;Agency FB&quot;))
  
  #Warning messages:
  #1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #2: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #3: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #4: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #5: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #6: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #7: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #8: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #9: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #10: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #11: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  #12: In grid.Call(C_textBounds, as.graphicsAnnot(x$label),  ... :
  #  font family not found in Windows font database
  
  </code></pre>
  <p>UPDATE I found out that using showtext, importing fonts from <em>Google does work</em>. But when I try to work locally (windows or custom fonts, fonts are not imported correctly. This <em>does</em> work:</p>
  <pre><code>library(showtext)
  library(ggplot2)
  font_add_google(&quot;Quattrocento Sans&quot;, &quot;Quattrocento Sans&quot;)
  
  showtext_auto() 
  windows() 
  
  a &lt;- ggplot(data = esoph) +
    aes(x = agegp, weight = ncases) +
    geom_bar() +
    ggtitle(&quot;This is a title&quot;) +
    theme(plot.title =  element_text(size = 14, family = &quot;Quattrocento Sans&quot;))
   
  print(a) 
  
  </code></pre>
  <p>I have limited experience in Windows systems so I don't really know where to start. I apologise if this message is a duplicate - I wasn't able to find any problem like it for Windows. Any help would be greatly appreciated!</p>