xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hennebert <vincent.henneb...@anyware-tech.com>
Subject Re: ZapfDingbats in svg (fo:instream-foreign-object)
Date Wed, 23 Apr 2008 09:31:34 GMT

Pascal Sancho wrote:
> Hi,
> I use now JDK 1.6.0-06.
> DejaVu fonts work fine (using either 'DejaVuSans' or 'DejaVu Sans' value).
> ZapfDingbats in SVG gives me a '#' if I leave the stroke-text line commented in fop.xconf
> (I used latest FOP trunk, rev 650050).
> Note that this works fine for awt output.
> Pascal

Digging a bit further into this I get the following results:

On my Ubuntu system I’ve got a ‘Dingbats’ font, which is a clone of Zapf
Dingbats provided by URW. This font is available in Java through AWT, as
confirmed by the listing of all font families. When it is properly
configured in my fop.xconf file, I get it in the resulting PDF in both
- from the svg part, it is first picked up by Batik through AWT, then
  retrieved by the FOP PDF transcoder through the config file;
- from the FO part, it is directly picked up by FOP through the config

If I render the file with the AWT renderer, the behaviour is slightly
different since the FOP font configuration system is not used. Instead
AWT is used in both cases, and the Dingbats font is normally picked up
by AWT.

Conclusion: if you want to render into PDF an FO file that contains some
SVG with special characters, you have to make sure to choose a font
available in AWT /and/ configure it properly in fop.xconf. In this case:

1. Determine under which name the font is known by AWT:
        $ java ListAvailableFontFamilies
        DejaVu Sans
2. I can use the Dingbats font, let’s configure it in the FOP font
        <font kerning="yes" embed-url="path/to/dingbats.pfb">
            <font-triplet name="Dingbats" style="normal" weight="normal"/>
   Note that the value of the ‘name’ attribute /must/ match the value
   returned above by AWT, here ‘Dingbats’.
3. Use this name in the FO file:
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -1 56 28"
                height="10mm" width="20mm">
              <style type="text/css">
                text { font-family: 'Dingbats' }
              <text y="18" x="0">&#x2704;</text>
        <fo:block font-family="Dingbats">&#x2704;</fo:block>

If you don’t have any ZapfDingbats-like font available through AWT, you
must use another font that contains a glyph for the required characters,
like Jeremias said (here I could also have used FreeSerif, for example).

I hope I’m clear,

Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

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

View raw message