Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 59384 invoked from network); 5 Mar 2007 15:38:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2007 15:38:09 -0000 Received: (qmail 94641 invoked by uid 500); 5 Mar 2007 15:38:14 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 94582 invoked by uid 500); 5 Mar 2007 15:38:14 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 94571 invoked by uid 99); 5 Mar 2007 15:38:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2007 07:38:14 -0800 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [213.133.33.40] (HELO smtp.is.nl) (213.133.33.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2007 07:38:02 -0800 Received: from [213.133.51.241] (HELO hai01.hippo.local) by smtp.is.nl (CommuniGate Pro SMTP 5.0.10) with ESMTP id 11397193 for users@cocoon.apache.org; Mon, 05 Mar 2007 16:37:40 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Subject: RE: Font problem using SVG text in PDFs Date: Mon, 5 Mar 2007 16:37:10 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Font problem using SVG text in PDFs Thread-Index: AcdfNrJyYYiYuGLOQdeEiM2WtRqvawABMihA References: From: "Jasha Joachimsthal" To: X-Virus-Checked: Checked by ClamAV on apache.org Hi Andrew, It's a bit a PITA but you can add fonts to your PDF. I hope it works for your SVG too. The info below came from http://xmlgraphics.apache.org/fop/0.20.5/fonts.html and http://cocoon.apache.org/2.1/userdocs/pdf-serializer.html=20 =20 If you want to use a specific fonts: * the font has to be present on the file system of the server; * all used variants (normal, bold, italic, bolditalic) are available as seperate font. They cannot be simulated like in a text editor! As an example Arial is used (sorry, bit lazy with copy-paste). First you have to extract the fonts to xml files. You have to repeat this for every variant. To do this, you need the jars of fop, xercexImpl, and xml-apis that come with Cocoon (below the standard Cocoon 2.1.8 is used). C:\projects\COCOON_2_1_8\lib>java -cp optional\fop-0.20.5.jar;endorsed\xercesImpl-2.7.1.jar;endorsed\xml-apis- 1.3.02.jar org.apache.fop.fonts.apps.TTFReader c:\windows\fonts\arial.ttf c:\hippo\fop-fonts\arial.ttf.xml TTF Reader v1.1.1 Repeat this for arialbd (bold), arialbi (bolditalics) and ariali (italics) and be sure to change the destination xml filename. Create a folder named fop-fonts and move the font xml files into that folder. Then create a file called fop-fonts.xml with these contents. Note the difference between the uri's in metrics-file and embed-file. The last step is to reference to this file from Cocoon. cocoon:/fop/fop-fonts.xml Although the location of the config file can be referenced using the cocoon protocol, its contents must contain absolute paths on the filesystem. Cocoon is now ready to embed fonts into the PDF. Regards, Jasha Joachimsthal Hippo Oosteinde 11 1017 WT Amsterdam The Netherlands +31 (0)20 5224466=20 www.hippo.nl=20 > -----Original Message----- > From: Andrew Stevens [mailto:ats37@hotmail.com]=20 > Sent: maandag 5 maart 2007 15:57 > To: users@cocoon.apache.org > Subject: Font problem using SVG text in PDFs >=20 > Can anyone help with this, or point me to a better place to ask? >=20 > I'm generating some PDFs using the FOP block in Cocoon 2.1.7.=20 > These include a company logo, which is done using an SVG=20 > file that is copied into a fo:instream-foreign-object node by=20 > the XSL (the SVG file is passed into the XSL as a=20 > map:aggregate part). The graphical part of the logo is fine,=20 > but I'm having a few problems getting the text part to=20 > display properly. >=20 > The text is in Times, which should be available in any viewer=20 > as it's one of the base 14 fonts mandated by the PDF spec. =20 > The relevant SVG is style=3D"font-size:22px;font-style:normal;font-weight:normal;fil > l:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-lin > ecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:T > imes,serif;"=20 > x=3D"0.79575568" y=3D"18.302387" = id=3D"text1871">OURNAMEHERE > Running on a Windows-based server this displays fine, the=20 > logo text appears in Times as expected. However, when=20 > deployed to our Solaris-based servers (which will be the=20 > production environment) the logo text appears in a sans-serif=20 > font - I assume this is Courier, which appears to be the=20 > default font according to the Batik docs. I've tried many=20 > variations and combinations of the font-family value,=20 > Times/TimesNewRoman/Times New Roman/serif, on the svg:text=20 > node and/or a nested tspan element (where Inkscape originally=20 > had it), but all to no avail. >=20 > The FOP documentation states "If possible, Batik will use=20 > normal PDF text when inserting text. It does this by checking=20 > if the text can be drawn normally and the font is supported."=20 > But it doesn't really say just what "supported" means; I=20 > would have hoped that the base 14 fonts were always=20 > supported, but it appears this isn't the case. We're using=20 > the JPA library on the Solaris boxes as they're headless and=20 > don't have X windows installed, and > java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().get > AvailableFontFamilyNames() > only returns a handful of fonts (various Lucida variants and=20 > a few generic default ones like "Serif"); on the Windows box=20 > this also has the various standard Windows fonts, in=20 > particular including "Times New Roman". So I tried embedding=20 > the Windows server's times.ttf font in the PDF, according to=20 > the instructions in the FOP documentation, but even that=20 > makes no difference. >=20 > Before I start trying to convert Times to an SVG font, or the=20 > text to a series of paths, I thought I'd ask whether anyone=20 > else here has had similar problems, and how they got around=20 > them? Or would I be better off asking on the FOP and/or Batik lists? >=20 >=20 > Andrew. > -- > http://pseudoq.sourceforge.net/ Open source java Sudoku application >=20 > _________________________________________________________________ > Find a local pizza place, movie theater, and more....then map=20 > the best route!=20 > http://maps.live.com/?icid=3Dhmtag1&FORM=3DMGAC01 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org