cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stevens" <at...@hotmail.com>
Subject Font problem using SVG text in PDFs
Date Mon, 05 Mar 2007 14:57:25 GMT
Can anyone help with this, or point me to a better place to ask?

I'm generating some PDFs using the FOP block in Cocoon 2.1.7.  These include 
a company logo, which is done using an SVG file that is copied into a 
fo:instream-foreign-object node by the XSL (the SVG file is passed into the 
XSL as a map:aggregate part).  The graphical part of the logo is fine, but 
I'm having a few problems getting the text part to display properly.

The text is in Times, which should be available in any viewer as it's one of 
the base 14 fonts mandated by the PDF spec.  The relevant SVG is
<svg:text xml:space="preserve" 
style="font-size:22px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Times,serif;"

x="0.79575568" y="18.302387" id="text1871">OURNAMEHERE</svg:text>
Running on a Windows-based server this displays fine, the logo text appears 
in Times as expected.  However, when deployed to our Solaris-based servers 
(which will be the production environment) the logo text appears in a 
sans-serif font - I assume this is Courier, which appears to be the default 
font according to the Batik docs.  I've tried many variations and 
combinations of the font-family value, Times/TimesNewRoman/Times New 
Roman/serif, on the svg:text node and/or a nested tspan element (where 
Inkscape originally had it), but all to no avail.

The FOP documentation states "If possible, Batik will use normal PDF text 
when inserting text. It does this by checking if the text can be drawn 
normally and the font is supported." But it doesn't really say just what 
"supported" means; I would have hoped that the base 14 fonts were always
supported, but it appears this isn't the case.  We're using the JPA library 
on the Solaris boxes as they're headless and don't have X windows installed, 
and 
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() 
only returns a handful of fonts (various Lucida variants and a few generic 
default ones like "Serif"); on the Windows box this also has the various 
standard Windows fonts, in particular including "Times New Roman".  So I 
tried embedding the Windows server's times.ttf font in the PDF, according to 
the instructions in the FOP documentation, but even that makes no 
difference.

Before I start trying to convert Times to an SVG font, or the text to a 
series of paths, I thought I'd ask whether anyone else here has had similar 
problems, and how they got around them?  Or would I be better off asking on 
the FOP and/or Batik lists?


Andrew.
--
http://pseudoq.sourceforge.net/  Open source java Sudoku application

_________________________________________________________________
Find a local pizza place, movie theater, and more….then map the best route! 
http://maps.live.com/?icid=hmtag1&FORM=MGAC01


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


Mime
View raw message