title: Using system fonts with iText
body: <p>I'm trying to generate PDF document in Java using iText.  <a href="http://itextpdf.com/api" rel="nofollow">link</a></p>
  
  <p>But I also want to give users an opportunity to choose which font to use for the document. There are many fonts, installed in the system, I can list them using </p>
  
  <pre><code>GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
  </code></pre>
  
  <p>but when I try to pass font names to <code>BaseFont</code> constructor directly </p>
  
  <pre><code>BaseFont.createFont(s, BaseFont.IDENTITY_H, true);
  </code></pre>
  
  <p>I get an exception like</p>
  
  <pre><code>com.lowagie.text.DocumentException: Font 'Abyssinica SIL' with 'Identity-H' is not recognized.
  </code></pre>
  
  <p>Another option is to pass to the <code>BaseFont</code> the path to the font file (either stored inside jar or somewhere on the system), but in the first case I have to deploy all the fonts with my application, and in the second case I have to think of a way of getting system font files locations. As far as I know, Java puts a layer of abstraction over fonts - public API doesn't know anything of paths, and usage of private API (something like FontManager) is discouraged. </p>
  
  <p>Yet another option is to use constants, declared in <a href="http://api.itextpdf.com/itext/com/itextpdf/text/pdf/BaseFont.html" rel="nofollow">BaseFont</a> , but that gives only 4 fonts (Courier, Helvetica, Symbol and Times Roman). </p>
  
  <p>Is there a way to use system fonts in PDFs, generated with iText without deploying them with application and using workarounds like FontManager?</p>