Installing a new font

0

Hi,

I have upgraded from IReport 5.10 to Jasper Studio 5.5.5, how do I install a new font using a .jar file? I don't have the actual fonts only this file.

In IReport you could simply add it as a new classpath and it would appear in the fonts list, but I can't figure it out in Jasper Studio. Going to the font option you have to select the individual fonts and I don't know how to add the new class path

Any help would be highly appreciated.

Thanks

shayl.voss's picture
Joined: Oct 28 2013 - 3:43am
Last seen: 5 years 6 months ago

2 Answers:

2

Hi,

you can modify the Build-Path of your JasperReports project. Simple right-click on the project, I suppose you have "MyReports" default one, and hit "Properties".

After that choose "Java Build Path", tab libraries and 1) "Add Jars" if you can access them in the workspace 2) "Add External Jars" if they are located in the file system. 

This way you should be able to access the fonts. 

Moreover in the Jaspersoft Studio Preferences you can access the page "Jaspersoft Studio > Fonts" and from there add manually fonts if you will have to work with TTF files.

Hope this can help.
Best regards,
Massimo.

mrabbi's picture
6890
Joined: Oct 31 2011 - 9:20am
Last seen: 3 days 17 hours ago

Excellent, thanks for the answer

shayl.voss - 5 years 8 months ago
0

I am having the exact same issue. I did Project Properties ->Fonts --> Configure Workspace settings ->Add->

  1. True Type : C:\tmp\ARIALN.TTF
  2. PDF Font Name : Left empty as none of the choices has arial narrow
  3. Embed this font in PDF doc : checked. 
  4. Everything else is default

Then applied my new font to a lable on my report and I keep getting this error:

java.lang.reflect.InvocationTargetException
at com.jaspersoft.studio.editor.preview.actions.export.AbstractExportAction$1.run(AbstractExportAction.java:122)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: com.lowagie.text.DocumentException: Font '' with 'Cp1252' is not recognized.
at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2062)
at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1818)
at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1787)
at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:89)
at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:100)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2158)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:861)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:821)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:698)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:420)
at com.jaspersoft.studio.editor.preview.actions.export.AbstractExportAction.exportWithProgress(AbstractExportAction.java:219)
at com.jaspersoft.studio.editor.preview.actions.export.AbstractExportAction$1.run(AbstractExportAction.java:119)
... 1 more
Caused by: com.lowagie.text.DocumentException: Font '' with 'Cp1252' is not recognized.
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2051)
... 12 more
 
haidar_hadi_205's picture
Joined: May 14 2014 - 12:47pm
Last seen: 5 years 3 weeks ago
Feedback
randomness