mg72 Posted July 20, 2006 Share Posted July 20, 2006 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? RegardsMarcus Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 21, 2006 Share Posted July 21, 2006 It seemes iText fails to load the font. Can be the font corrupted? I have no idea about how to fix it actually :S Giulio Link to comment Share on other sites More sharing options...
mg72 Posted July 21, 2006 Author Share Posted July 21, 2006 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); ThanksMarcus Link to comment Share on other sites More sharing options...
mg72 Posted September 26, 2006 Author Share Posted September 26, 2006 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 helpsMarcus Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now