Problem loading TTC-Fonts

0
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
mg72's picture
18
Joined: Jul 19 2006 - 6:18pm
Last seen: 7 years 4 days ago

3 Answers:

1
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
giulio's picture
47042
Joined: Jan 2 2007 - 4:15pm
Last seen: 1 year 11 months ago
0
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
mg72's picture
18
Joined: Jul 19 2006 - 6:18pm
Last seen: 7 years 4 days ago
0
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
mg72's picture
18
Joined: Jul 19 2006 - 6:18pm
Last seen: 7 years 4 days ago
Feedback
randomness