Hi Bernard

Thanks for that explanation; that makes a lot of sense now.

I think I'm still having a little trouble working out which are the line(s)
where you're telling FOP which fonts are available, though.

Specifically what I have is a byte-array containing a font's data, and I
need to make FOP use that font when it renders an FO (there's no XSL
translation - that has already been done).

I've been through the docs a number of times now, but I can't see where I
can add a font manually to FOP's runtime config, or tell it to refresh it's
font cache after providing a directory of fonts, or anything like that. :(

Bernmeister wrote:
> Hi Phill,
> The PropertiesManager is a class of mine which basically extends
> java.util.Properties and essentially reads/writes a hash table of
> key/value pairs.  I store in the properties a list of the font names and
> their respective font files (as discovered via FOP).  For me on Ubuntu
> 12.04 I get:
> FontList=Andale Mono,Arial,Arial Black,Bitstream Charter,Century
> Schoolbook L,Comic Sans
> MS,Courier,...FontFiles=file\:/usr/share/fonts/truetype/openoffice/opens___.ttf,file\:/usr/share/fonts/truetype/ttf-khmeros-core/KhmerOS.ttf,...
> I cannot remember precisely why I had to implement this "cache" but I
> think it had to do with supporting i18n.  Originally I simply used the
> hard coded default fonts which FOP "provided" but I found on some
> non-English machines I'd get the 'square' symbol and so wanted to provide
> a way for a user to specify a font to use for the render.  To do this I
> got FOP to tell me what fonts were available and present that to the user. 
> I just cache that information so I don't have to ask FOP each time (which
> can take a few minutes).
> When I do the render I pass the font name as one of the transformer
> parameters:
> xslParams.put( "font-family", (String)m_fontName.getSelectedItem() );
> where m_fontName is the selected font name in the JComboBox shown to the
> user. 
> Cheers,
> Bernard.
>> Date: Wed, 13 Jun 2012 06:41:58 -0700
>> From: phillip.old...@gmail.com
>> To: fop-users@xmlgraphics.apache.org
>> Subject: RE: Still having trouble loading fonts at runtime - suggestions?
>> Hi Bernard
>> Thanks for that code - that's really helpful.
>> However, from what I can tell (java isn't one of my main languages, I'm a
>> Python dev) it seems as though it doesn't actually tell FOP to reload any
>> fonts, but rather gathers a list of fonts and then asks
>> `PropertiesManager`
>> to set the fonts. I can't see a reference to `PropertiesManager` in the
>> FOP
>> docs; is that a class in your app, or am I missing something?
>> Cheers,
>> Phill

View this message in context: 
Sent from the FOP - Users mailing list archive at Nabble.com.

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

Reply via email to