Page 1 of 1

Not able to Load Fonts Properly On Windows with Myeclipse

PostPosted: Fri Jun 03, 2011 3:03 am
by suncity65
hi all,

I was searching entire net and forum for solution for the below mentioned error, even increased the heap to 1024 but no use still i get below error, i am trying to run the sample CompareDocuments.java, with 2 docx files which have just 4 lines.
Please i request some one to help me in resolving this, i also removed the default fop.jar and added patched fop jar, but no use.


Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:324)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:361)
at org.docx4j.fonts.fop.fonts.truetype.FontFileReader.init(FontFileReader.java:51)
at org.docx4j.fonts.fop.fonts.truetype.FontFileReader.<init>(FontFileReader.java:80)
at org.docx4j.fonts.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:217)
at org.docx4j.fonts.PhysicalFonts.addPhysicalFont(PhysicalFonts.java:154)
at org.docx4j.fonts.PhysicalFonts.discoverPhysicalFonts(PhysicalFonts.java:117)
at org.docx4j.fonts.IdentityPlusMapper.<clinit>(IdentityPlusMapper.java:72)
at org.docx4j.samples.CompareDocuments.main(CompareDocuments.java:111)

Re: Not able to Load Fonts Properly On Windows with Myeclips

PostPosted: Fri Jun 03, 2011 10:25 am
by jason
You've probably got either a lot of fonts in your Windows fonts dir, or some really big ones.

To get around this problem, rather than using IdentityPlusMapper, you'll need your own implementation of the font mapper interface, to just use the subset of fonts which you know your docx is using. That way, docx4j won't automatically try to load all fonts.

There's a bit more discussion of font mapping in the Getting Started document.