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 Chris Bowditch <bo...@hotmail.com> on 2013/08/01 14:58:57 UTC

Re: Getting a list of font names without the memory hit...‏

The auto-detect feature creates the font cache, to save time on 
sunsequent calls to FOP, you can disable the cache using the setting: 
<use-cache>false</use-cache> in your fop.xconf.

I suspect the reason for the high memory consumption is your use of 
auto-detect feature. Though I've not replicated the issue. If your 
intention  is to allow the user to pick any font installed on the 
Operating System, why not use the java.awt classes to list the available 
fonts instead? I've not tried it but I suspect it will use less memory 
as it doesn't need to load the full contents of every font in the system.

Thanks,

Chris

On 31/07/2013 12:53, Bernard Giannetti wrote:
> Now I'm chasing my tail...looking at FontCachehas gotten me back to 
> FontInfo.getFonts()!
>
> Any other ideas please?!
>
>
> ------------------------------------------------------------------------
> From: thebernmeister@hotmail.com
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: Getting a list of font names without the memory hit...‏
> Date: Wed, 31 Jul 2013 21:33:14 +1000
>
> I'm readingorg.apache.fop.fonts.FontCache now...red-faced and fingers 
> crossed!
>
>
>
> ------------------------------------------------------------------------
> From: thebernmeister@hotmail.com
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: Getting a list of font names without the memory hit...‏
> Date: Wed, 31 Jul 2013 21:29:59 +1000
>
> The config file or the cache file?
>
> My config file has no fonts listed for PDF:
>
> <renderer mime="application/pdf">
> <filterList>
> <value>flate</value>
> </filterList>
>
> <fonts>
> <auto-detect/>
> </fonts>
> </renderer>
>
>
> > Date: Wed, 31 Jul 2013 04:26:33 -0700
> > From: djseek@yahoo.com
> > To: fop-users@xmlgraphics.apache.org
> > Subject: RE: Getting a list of font names without the memory hit...‏
> >
> > Why don't you just read the config file which list all the available 
> fonts?
>


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


RE: Getting a list of font names without the memory hit...‏

Posted by Bernard Giannetti <th...@hotmail.com>.


Thanks Chris - simplest solution is often the best:
String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
Getting a list of fonts this way does NOT appear to impact memory at all...so much better!
I don't have the <use-cache> tag in my config file, so I assume the cache is on by default.  I did a test run of creating a PDF:
With no <use-cache> present: memory used 111 MBWith <use-cache>false</use-cache> present: memory used 330 MB
I think I'll stick with the default!
Thanks again,
Bernard.

> Date: Thu, 1 Aug 2013 13:58:57 +0100
> From: bowditch_chris@hotmail.com
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Getting a list of font names without the memory hit...‏
> 
> The auto-detect feature creates the font cache, to save time on 
> sunsequent calls to FOP, you can disable the cache using the setting: 
> <use-cache>false</use-cache> in your fop.xconf.
> 
> I suspect the reason for the high memory consumption is your use of 
> auto-detect feature. Though I've not replicated the issue. If your 
> intention  is to allow the user to pick any font installed on the 
> Operating System, why not use the java.awt classes to list the available 
> fonts instead? I've not tried it but I suspect it will use less memory 
> as it doesn't need to load the full contents of every font in the system.