title: How to load JasperReports font extensions into Spring based application?
body: <p>I'm trying to load JasperReports font extension to my project.
  I have jasperreports-fonts-6.0.0 on classpath (Maven) that contains variations of DejaVu fonts.</p>
  
  <p>But when I try to set pdf font name by properties:</p>
  
  <pre><code>final JRPropertiesUtil jrProps = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance());
  
  jrProps.setProperty(JRFont.DEFAULT_PDF_FONT_NAME, "DejaVu Sans");
  jrProps.setProperty(JRFont.DEFAULT_PDF_ENCODING, "Identity-H");
  jrProps.setProperty(JRFont.DEFAULT_PDF_EMBEDDED, "TRUE");
  </code></pre>
  
  <p>I keep getting error:</p>
  
  <pre><code>net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: 
  pdfFontName: DejaVu Sans
  pdfEncoding: Identity-H
  isPdfEmbedded : true
      at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2323)
      at net.sf.jasperreports.engine.export.JRPdfExporter.writePageAnchor(JRPdfExporter.java:985)
      at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:915)
      at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:537)
      at net.sf.jasperreports.engine.JasperExportManager.exportToPdfStream(JasperExportManager.java:196)
      at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:533)
  </code></pre>
  
  <p>But, when setting full path to the font in jar, everything works fine. </p>
  
  <pre><code>jrProps.setProperty(JRFont.DEFAULT_PDF_FONT_NAME, "net/sf/jasperreports/fonts/dejavu/DejaVuSerif.ttf");
  </code></pre>
  
  <p>Is there need to take additional action to include this font extension to Spring application?</p>
  
  <p>I really appreciate any help you can provide.</p>
  
  <p><strong>Solution:</strong></p>
  
  <p>Problem was wrong font parameter key.</p>
  
  <p>Changed </p>
  
  <p><code>jrProps.setProperty(JRFont.DEFAULT_PDF_FONT_NAME, "DejaVu Sans");</code></p>
  
  <p>to</p>
  
  <p><code>jrProps.setProperty(JRFont.DEFAULT_FONT_NAME, "DejaVu Sans");</code></p>