Re: Direct Printing and setting print parameters
in FOP 0.94

I'm not aware of any problems in that area. FOP should pick up
automatically all fonts installed in your operating system for direct
print. You say you found "Arial Negreta cursiva" in the used fonts. How
do you specify the fonts in FO? Do you use the localized font names?
That could explain the problems as we're currently guessing "bold" and
"italic" font variants by the English tags. "Negreta" and "cursiva" will
probably not be recognized as font style modifiers. So basically, your
question is the right one: How to configure fonts?

Basically the same way as for the other output formats. See:

You just need to add a <fonts> tag with the right children under the
section for the "application/X-fop-print" renderer. Something like this:




<renderer mime="application/X-fop-print">
<directory recursive="true">D:/Install/fonts/dejavu-ttf-2.5</directory>
<font embed-url="test\resources\fonts\glb12.ttf">
<font-triplet name="Gladiator" style="normal" weight="normal"/>

Note: I haven't tested this. And the fonts will most probably be
registered under their English names unless you use the <font> tag as
shown above where you can specify the font names yourself.


On 18.02.2009 21:21:13 tanya C wrote:
> Jeremias Maerki-2 wrote:
> >
> > The best approach was to create a new renderer: PageableRenderer. This
> > should only implement Pageable and provide the from/to and odd/even
> > functionality that the PrintRenderer offers. PrintRenderer can then
> > be derived from the PageableRenderer while preserving its original
> > behaviour.
> >
> > This can now be found in FOP Trunk. I've added a minimal example, too:
> >
> >
> > I'll be grateful for feedback on this as I don't have a real-life
> > use-case for this, unfortunately, in which I could test this. It was
> > simply fun to implement. ;-) HTH
> >
> >
> I used your example to send the form directly to the printer. I checked out
> FOP Trunk and build the fop.jar which I used for my test. It works with the
> minor issue of the font, which I can't figure out how to fix. The form uses
> Arial font with bold, normal, and italic style, but when it is sent directly
> to the printer, all the information on the form is printed in what looks
> like Arial Bold Italic. When I debugged the code, I saw that after
> transform() method is completed, PageableRenderer -> FontInfo -> usedFonts
> has these values key = "F28" value = "Arial Negreta cursiva".
> Here is the code:
> FopFactory fopFactory = FopFactory.newInstance();
> FOUserAgent userAgent = fopFactory.newFOUserAgent();
> userAgent.setFontBaseURL(fontDir);
> PageableRenderer renderer = new PageableRenderer();
> renderer.setUserAgent(userAgent);
> userAgent.setRendererOverride(renderer);
> Fop fop = fopFactory.newFop(userAgent);
> TransformerFactory factory = TransformerFactory.newInstance();
> Transformer transformer = factory.newTransformer(); // identity
> transformer
> Source src = new StreamSource(fo);
> Result res = new SAXResult(fop.getDefaultHandler());
> transformer.transform(src, res);
> Is there a way to define the fonts for the PageableRenderer in the
> fop-config.xml or in any other way?
> --
> View this message in context:
> Sent from the FOP - Users mailing list archive at

Jeremias Maerki

To unsubscribe, e-mail: fop-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: fop-users-help@xxxxxxxxxxxxxxxxxxxxxx