Runs Ghostscript to process a PDF or PostScript file and embed all fonts in the file.
embedFonts(file, format, outfile = file, fontpaths = character(), options = character())
a character string giving the name of the original file.
the format for the new file (with fonts embedded) given as
the name of a ghostscript output device.
If not specified, it is guessed from the suffix of
the name of the new file (with fonts embedded).
a character vector giving directories that Ghostscript will search for fonts.
a character vector containing further options to Ghostscript.
This function is not necessary if you just use the standard default fonts for PostScript and PDF output.
If you use a special font, this function is useful for embedding that font in your PostScript or PDF document so that it can be shared with others without them having to install your special font (provided the font licence allows this).
If the special font is not installed for Ghostscript,
you will need to tell Ghostscript where the font is, using
You will need
ghostscript: the full path to the executable can
be set by the environment variable R_GSCMD. If this is
unset, a GhostScript executable will be looked for by name on your
path: on a Unix alike
"gs" is used, and on Windows the setting
of the environment variable GSC is used, otherwise commands
"gswin32c.exe" are tried.
format is by default
"ps2write", when the original
file has a
.eps suffix, or
the original file has a
format = "pswrite" or
"epswrite" can be used: as from 9.14
format = "eps2write" is
also available. If an invalid device is given, the error message will
list the available devices.
Note that Ghostscript may do font substitution, so the font embedded may differ from that specified in the original file.
Some other options which can be useful (see your Ghostscript documentation) are -dMaxSubsetPct=100, -dSubsetFonts=true and -dEmbedAllFonts=true.
The shell command used to invoke Ghostscript is returned invisibly. This may be useful for debugging purposes as you can run the command by hand in a shell to look for problems.
Paul Murrell and Brian Ripley (2006). “Non-standard fonts in PostScript and PDF graphics.” R News, 6(2), 41–47. https://www.r-project.org/doc/Rnews/Rnews_2006-2.pdf.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.