Hi Evan,
If you just need one font, you may try the showtext package. Here is a
piece of code that you can test:

library(showtext)
# If you have this font installed
font.add("gara", "gara.ttf")
# Or you can install a similar one from Google Font
# font.add.google("EB Garamond", "gara")

# Try some plots
pdf("test.pdf")
showtext.begin()
par(family = "gara")
plot(1, main = "Garamond", type = "n")
text(1, 1, "Some Text", cex = 5)
showtext.end()
dev.off()


A more detailed introduction of the showtext package is available at
http://statr.me/2014/01/using-system-fonts-in-r-graphs/. Hope this would be
helpful for you.


Best,
Yixuan






2014-04-26 16:54 GMT-04:00 Evan Cooch <evan.co...@gmail.com>:
> 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@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.



-- 
Yixuan Qiu <yixuan....@cos.name>
Department of Statistics,
Purdue University

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to