[R] help using extrafont package | R graphics

Law, Jason Jason.Law at portlandoregon.gov
Thu May 1 01:45:40 CEST 2014


On my system, the name of the Garamond font file is GARA.TTF. 

Thus,
font_import(pattern = 'GARA') 

will work, but 
font_import(pattern="gara") 

won't.  Unfortunately, font_import seems to fail rather ungracefully when there is no match to a pattern.

Jason

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Evan Cooch
Sent: Saturday, April 26, 2014 1:55 PM
To: r-help at r-project.org
Subject: [R] help using extrafont package | R graphics

Greetings --

Submitted this a little while ago -- for some reason, still being held up by the moderator. Trying again...


For a host of reasons, I need to use/embed Garamond font with various R 
graphics for a particular publication. I've figured out how to more or 
less get there from here, using the following sequence:


library(extrafont)

Then, I need to import the system fonts (Windoze box, R 3.1.0).

So, I use

font_import()

But, this takes a *huge* amount of time, and often throws errors as it 
chokes on various fonts (I have probably 250+ fonts installed). I only 
want *one* font (Garamond). But, for the life of me, I can't figure out 
how to get font_import to select only the single font I want. In theory

font_import(paths = NULL, recursive = TRUE, prompt = TRUE, pattern = NULL)

as defaults, where pattern is a regex that font filenames must match.

The file name for Garamong is gara.ttf, so I tried

font_import(pattern="gara")

R responds with 'Importing fonts make take a few minutes, depending on 
the...etc, etc'.
Continue? [y/n]

Hit 'y', and am presented with

Scanning ttf files in C:\Windows\Fonts ...
Extracting .afm files from .ttf files...
Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors 
= FALSE) :
   arguments imply differing number of rows: 0, 1

I have no idea what to do with this.

Suggestions/pointers to the obvious welcome. And I thought futzing with 
fonts in LaTeX was fun! ;-)


	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list