Jump to content
We've recently updated our Privacy Statement, available here ×

Problem loading TTC-Fonts


mg72

Recommended Posts

Hello,

 

I've got problem starting iReport-Designer if there are TTC-Fonts (e.g. simsun.ttc) in the fonts directory. The splash-screen hangs (loading fonts) and I've got this exception:

 

Exception in thread "main" java.lang.NullPointerException
at com.lowagie.text.pdf.DefaultFontMapper.pdfToAwt(DefaultFontMapper.java:185)
at it.businesslogic.ireport.FontListLoader.loadTTFFonts(FontListLoader.java:112)
at it.businesslogic.ireport.gui.MainFrame.<init>(MainFrame.java:378)
at it.businesslogic.ireport.gui.MainFrame.main(MainFrame.java:7110)

 

Any ideas to fix the problem?

 

Regards

Marcus

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hi Giulio,

 

the font is still ok (tested with other applications like apache fop). iText might be a problem. I've tried to fix the problem also but had no idea left :( Using a new version of iText (1.4.2) does not help.

 

Please correct the FontListLoader so that the iReport designer does not hang up if loading a ttc font:

 

com.lowagie.text.pdf.BaseFont bf = com.lowagie.text.FontFactory.getFont( file.getPath() + file.separator + files).getBaseFont();
if (bf != null) {
java.awt.Font f = fontMapper.pdfToAwt(bf, 10);

 

Thanks

Marcus

Link to comment
Share on other sites

  • 2 months later...

I've found a solution for the problem! You have to create the BaseFont another way:

 

OLD:

com.lowagie.text.pdf.BaseFont bf = com.lowagie.text.FontFactory.getFont( file.getPath() + file.separator + files).getBaseFont();

 

NEW:

com.lowagie.text.pdf.BaseFont bf = com.lowagie.text.pdf.BaseFont.createFont(file.getPath() + file.separator + files + "," + a, com.lowagie.text.pdf.BaseFont.IDENTITY_H, com.lowagie.text.pdf.BaseFont.EMBEDDED);

 

I guess the problem is the encoding of the ttc-file. While reading the ttc with parameter IDENTITY_H opens the font correctly.

 

Hope that helps

Marcus

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...