You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sourabh Patwardhan <so...@persistent.co.in> on 2005/04/25 16:11:29 UTC

Problem with Asian language fonts

Hi,

I am using FOP 0.20.5 to generate PDF documents on the fly in my web application
I get an OutOfMemoryError when I try to generate PDFs with Asian language fonts

I found out that this is due to embedding the font in the PDF
It seems that for every rendering of the PDF, the FOP driver loads the entire font file in memory
(I am using some custom third-party fonts which have approx 30 MB TTF files)

When there are concurrent requests for PDF generation in my web app, the memory demand surges and causes OutOfMemoryError
It seems that the memory allocated for the TTF file is not released as soon as the rendering is complete
Increasing JVM heap size does help..but only upto a certain extent

I tried removing the "embed-file" option from the config file and the memory problem does not occur
However, Adobe Acrobat 6 does not seem to find the custom font even when it is installed on my Windows system
The custom font is not from the Asian Font Pack from Adobe; it is a Monotype Sans font from Agfa

I have two questions:
1. Is it possible to prevent loading of the TTF file into memory every time a PDF is rendered? (by doing some sort of caching)
2. Is it possible (through any public FOP API) to pass the TTF file only once to FOP, so that it is cached in memory?

Any alternative solution / suggestion is welcome!


Thanks and regards,
Sourabh Patwardhan

Re: Problem with Asian language fonts

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jeremias Maerki wrote:
> You said that the problem happens when there are concurrent requests.

The whole font file is loaded into memory, which eats quite a bit
considered that ARIALUNI.TTF is ~23MB and other common east asean
fonts are around 5MB. Together with the usual in-memory buffering
of the resulting PDF and the well known appetite of FOP for even
more memory its no surprise that there are problems with running
multiple concurrent rendering sessions.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Problem with Asian language fonts

Posted by Jeremias Maerki <de...@greenmail.ch>.
On 25.04.2005 16:11:29 Sourabh Patwardhan wrote:
> I have two questions:
> 1. Is it possible to prevent loading of the TTF file into memory every time a PDF is rendered? (by doing some sort of caching)
> 2. Is it possible (through any public FOP API) to pass the TTF file only once to FOP, so that it is cached in memory?

To both questions: No, unless you try to improve the situation in code.

I'm pretty confident that there is no memory-leak with the TTF files.
You said that the problem happens when there are concurrent requests.
Maybe you could investigate a way to limit the number of concurrent
FOP requests. Just a thought...

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org