You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2015/11/03 16:44:27 UTC

[jira] [Commented] (PDFBOX-3086) OutOfMemory while building font cache caused by "PingFang" font (Mac OS X El Capitan)

    [ https://issues.apache.org/jira/browse/PDFBOX-3086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14987490#comment-14987490 ] 

Maruan Sahyoun commented on PDFBOX-3086:
----------------------------------------

This is a duplicate of PDFBOX-3082. I was able to run successfully with {{Xmx1512M}} (with PingFang on my System too).

> OutOfMemory while building font cache caused by "PingFang" font (Mac OS X El Capitan)
> -------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3086
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3086
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>         Environment: Mac OS X El Capitan
>            Reporter: Florian Polter
>
> We're facing a OutOfMemory error while building the font cache. This happens for the font file "PingFang" which is a new system font for Mac OS X El Capitan (http://appleinsider.com/articles/15/06/08/apple-targets-china-japan-with-new-os-x-el-capitan-system-fonts-and-input).
> The font file seems to be very large (about 65.5m). We tried to adjust our vm options (with -Xmx8096m for example) but had no chance to build the project.
> As the "PingFang" font is a system font there is no (supported) chance to remove the font from the system.
> Here you'll see the output from the test:
> {code:borderStyle=solid}
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running de.testproject.platform.pdf.service.PdfServiceTest
> Nov 03, 2015 11:34:01 AM org.apache.pdfbox.pdmodel.font.FileSystemFontProvider loadCache
> WARNING: New fonts found, font cache will be re-built
> Nov 03, 2015 11:34:01 AM org.apache.pdfbox.pdmodel.font.FileSystemFontProvider <init>
> WARNING: Building font cache, this may take a while
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.564 sec <<< FAILURE! - in de.testproject.platform.pdf.service.PdfServiceTest
> generateScreenshotFromPdfTest(de.testproject.platform.pdf.service.PdfServiceTest)  Time elapsed: 1.522 sec  <<< ERROR!
> java.lang.OutOfMemoryError: Java heap space
> 	at org.apache.fontbox.cff.IndexData.initData(IndexData.java:95)
> 	at org.apache.fontbox.cff.CFFParser.readIndexData(CFFParser.java:163)
> 	at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:393)
> 	at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115)
> 	at org.apache.fontbox.ttf.CFFTable.read(CFFTable.java:53)
> 	at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
> 	at org.apache.fontbox.ttf.OpenTypeFont.getCFF(OpenTypeFont.java:61)
> 	at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFontImpl(FileSystemFontProvider.java:432)
> 	at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)
> 	at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:243)
> 	at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:224)
> 	at org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:132)
> 	at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:151)
> 	at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:413)
> 	at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFontBoxFont(FontMapperImpl.java:376)
> 	at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getFontBoxFont(FontMapperImpl.java:350)
> 	at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:113)
> 	at org.apache.pdfbox.pdmodel.font.PDType1Font.<clinit>(PDType1Font.java:75)
> 	at de.testproject.platform.pdf.service.PdfServiceTest.generateScreenshotFromPdfTest(PdfServiceTest.java:47)
> {code}
> h3. Update
> Made a test by updating the checkFontfile method in FontFileFinder.java to ignore the "PingFang" font and it works.
> {code:title=FontFileFinder.java|borderStyle=solid}
>     private boolean checkFontfile(File file)
>     {
>         String name = file.getName().toLowerCase();
>         return (name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".pfb") || name.endsWith(".ttc") && !name.startsWith("pingfang"));
>     }
> {code}
> Of course this isn't a nice solution but i've no idea how to resolve the issue as i'm not aware of the PDFBox development. Maybe someone else has a clean solution for this problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org