Custom Fonts in Visualforce Page (renderas="pdf")
The current v31.0 "official" line is that there is a limited set of fonts available.
Fonts Available When Using Visualforce PDF Rendering
Visualforce PDF rendering supports a limited set of fonts. Use the following font names to ensure that PDF output renders as you expect.
The fonts available when you’re rendering a page as a PDF are as follows. The first listed font-family value for each typeface is the recommended choice.
- Typeface
- Style font-family Value to Use (Font Synonyms)
- Arial Unicode MS
- Arial Unicode MS
- Helvetica
- sans-serif
- SansSerif
- Dialog
- Times
- serif
- Times
- Courier
- monospace
- Courier
- Monospaced
- DialogInput
Note
- These rules apply to server-side PDF rendering. You might see different results when viewing pages in a web browser.
- Text styled with any value besides those listed above receives the default font style, Times. This means that, ironically, while Helvetica’s synonyms render as Helvetica, using “Helvetica” for the font-family style renders as Times. We recommend using “sans-serif”.
- Arial Unicode MS is the only multibyte font available, providing support for the extended character sets of languages that don’t use the Latin character set.
Source - Fonts Available When Using Visualforce PDF Rendering
Note also that there is talk of a new and improved PDF rendering engine in the works. This may give you better font options, but is only in closed pilot last time I checked.
Assuming the PDF generation in Salesforce is based on Flying Saucer, the Flying Saucer FAQ includes an example of how to embed a custom font:
@font-face {
font-family: "UbuntuMono";
src: url("UbuntuMono-R.ttf");
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
* {
font-family: "UbuntuMono";
}
which suggests it is possible. You would need to use a public URL for the font or a static resource URL.
But I have not tried it.
PS
Just spent 30 minutes trying to get this to work for a Google font and while it works well for the HTML output I could not get it to work for PDF output. So either by design or accident it looks like this does not work in Salesforce.