Page 1 of 1

can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?

PostPosted: Sun Oct 10, 2010 8:48 pm
by ThanksDocx4j
Another question, I got the following Error/Warning messages while generating a PDF document using template, the PDF document was actually generated successfully. Just wondering what's meaning of the messages? Thanks a lot.

2010-10-10 20:27:31,396 ERROR PhysicalFonts.addPhysicalFont(162) | Aborting: file:/C:/Windows/FONTS/ACaslonPro-Bold.otf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?)

Re: can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?

PostPosted: Mon Oct 11, 2010 7:28 pm
by jason
Those error messages do indicate a problem.

As indicated, try deleting your fop-fonts.cache. It may be corrupt.

You'll find it in C:\Users\username\.fop

(Current svn docx4j creates its own cache, distinct from any you might already have on your machine, but v2.5.0 doesn't do this)

Re: can't get EmbedFontInfo[] .. try deleting fop-fonts.cach

PostPosted: Tue Dec 10, 2013 11:49 am
by atul.tewari
I see this issue surface on 3.0. Here is the code:
Code: Select all
HTMLSettings htmlSettings = Docx4J.createHTMLSettings();
         
          htmlSettings.setFontFamilyStack(false);
            htmlSettings.setImageDirPath("." + "_files");
            htmlSettings.setImageTargetUri("_files");
            htmlSettings.setWmlPackage(wordMLPackage);
           
            Docx4jProperties.setProperty("docx4j.Convert.Out.HTML.OutputMethodXML", true);

            ByteArrayOutputStream os = new ByteArrayOutputStream();
           
            Docx4J.toHTML(htmlSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
            os.flush();


The code errors out at the following line " Docx4J.toHTML(htmlSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);"

Here are the debug and exception logs:
EBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 2 Regular
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 3 Gurmukhi MT; 6.0d2e1; 2006-10-20
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 4 Gurmukhi MT
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 5 6.0d2e1
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 6 MonotypeGurmukhi
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 7 Monotype Gurmukhi is a Trademark of Monotype Typography Ltd.
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 256 Alternates
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 1 0 0 257 Show Invisibles
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1028 2 ???
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1030 2 Ordin?r
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1031 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1033 2 Regular
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1035 2 Normaali
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1036 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1040 2 Regolare
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1041 2 ?????
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1042 2 ???
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1043 2 Regulier
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1044 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1046 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1049 2 ???????
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 1053 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 2052 2 ???
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readName line 1236 - 3 1 3082 2 Normal
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readCMAP line 226 - 1 cmap tables
DEBUG org.docx4j.fonts.fop.fonts.truetype.TTFFile .readCMAP line 236 - Platform ID: 0 Encoding: 3
ERROR org.docx4j.fonts.fop.fonts.truetype.TTFFile .readCMAP line 252 - Unsupported TrueType font: No Unicode or Symbol cmap table not present. Aborting
WARN org.docx4j.fonts.PhysicalFonts .addPhysicalFont line 216 - Aborting: file:/Library/Fonts/Gurmukhi.ttf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?)
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:127)
at org.apache.commons.io.output.ByteArrayOutputStream.write(ByteArrayOutputStream.java:154)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1026)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:218)
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:208)
at org.docx4j.fonts.PhysicalFonts.addPhysicalFont(PhysicalFonts.java:196)
at org.docx4j.fonts.PhysicalFonts.discoverPhysicalFonts(PhysicalFonts.java:144)
at org.docx4j.fonts.IdentityPlusMapper.<clinit>(IdentityPlusMapper.java:74)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.getFontMapper(WordprocessingMLPackage.java:337)
at org.docx4j.fonts.RunFontSelector.getPhysicalFont(RunFontSelector.java:773)
at org.docx4j.fonts.RunFontSelector.<init>(RunFontSelector.java:85)
at org.docx4j.convert.out.html.HTMLConversionContext.createRunFontSelector(HTMLConversionContext.java:129)
at org.docx4j.convert.out.html.HTMLConversionContext.<init>(HTMLConversionContext.java:124)
at org.docx4j.convert.out.html.AbstractHTMLExporter3.createContext(AbstractHTMLExporter3.java:60)
at org.docx4j.convert.out.html.AbstractHTMLExporter3.createContext(AbstractHTMLExporter3.java:29)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:67)
at org.docx4j.Docx4J.toHTML(Docx4J.java:502)
at com._21ct.msword.MsWordTemplate.convertTemplateToHtml(MsWordTemplate.java:210)
at com._21ct.msword.MsWordTemplate.main(MsWordTemplate.java:82)

Re: can't get EmbedFontInfo[] .. try deleting fop-fonts.cach

PostPosted: Tue Dec 10, 2013 11:55 am
by atul.tewari
I forgot to mention I am running this on Mavericks - not that it should make a difference, but the fonts configs are cached under ~/.fontconfig/

Jason,
Is there a property that allows ignoring font-cache? Or in 3.0 this is not the issue?

Re: can't get EmbedFontInfo[] .. try deleting fop-fonts.cach

PostPosted: Tue Dec 10, 2013 12:27 pm
by jason
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space


Give Java more memory, or:

Code: Select all
      // Font regex (optional)
      // Set regex if you want to restrict to some defined subset of fonts
      // Here we have to do this before calling createContent,
      // since that discovers fonts
      String regex = null;
      // Windows:
      // String
      // regex=".*(calibri|cour|arial|times|comic|georgia|impact|LSANS|pala|tahoma|trebuc|verdana|symbol|webdings|wingding).*";
      // Mac
      // String
      // regex=".*(Courier New|Arial|Times New Roman|Comic Sans|Georgia|Impact|Lucida Console|Lucida Sans Unicode|Palatino Linotype|Tahoma|Trebuchet|Verdana|Symbol|Webdings|Wingdings|MS Sans Serif|MS Serif).*";
      PhysicalFonts.setRegex(regex);


As per the comment, you'd need to do that early in your code.

Re: can't get EmbedFontInfo[] .. try deleting fop-fonts.cach

PostPosted: Tue Dec 10, 2013 12:39 pm
by atul.tewari
Thanks Jason. Adding the regex did the trick. I really appreciate your prompt response.

Regards,
Atul