You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jacob Cantwell <ja...@webmcq.com> on 2001/10/08 01:50:19 UTC

RE: Cocoon, Fop, and embedded Truetype fonts

howdy brad,

embedding .ttfs in FOP with C2 does work. there is a page on apache.org
about this:
http://xml.apache.org/cocoon2/pdf-serializer.html

but here is my rough guide anyway:

i was able to install .ttfs in c2 but not c1, my biggest problems were
finding a good font and fop's funny way of referencing fonts in the
userconfig.xml file.

1) build your metric files with the help of the fonts support page at
http://xml.apache.org/fop/

2) in your sitemap serializer section add:

<map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/pdf">
  <user-config src="d:/fop/conf/userconfig.xml"/>
</map:serializer>


3) In the userconfig.xml file, add entries such as these below. MSMINCHO.TTF
and PMINGLIU.TTF are free fonts with windows that work well. I had some
problems with free downloaded fonts. I also found that C2 wasn't actually
finding the fonts unless I put them in the folder where I started my JVM, in
my case my tomcat/bin directory. The C2 log files will tell you if it can't
find the fonts.  Reading the above link in 1) I see that you can use
absolute URLs to. (You might have to delete your tomcat working directory if
you modify this file.)


<configuration>
...
<fonts>
  <!-- japanese font -->
  <font metrics-file="MSMINCHO.xml" kerning="yes" embed-file="MSMINCHO.TTF">
    <font-triplet name="MSMincho" style="normal" weight="normal"/>
  </font>
  <!-- chinese font -->
  <font metrics-file="PMINGLIU.xml" kerning="yes" embed-file="PMINGLIU.TTF">
    <font-triplet name="PMingLiU" style="normal" weight="normal"/>
  </font>
 </fonts>
</configuration>

4) also XML files have different encoding standards for different languages.
eg Chinese uses: <?xml version="1.0" encoding="gb2312"?> so you may need to
look into this if your characters aren't showing up.

i had an easier time embedding adobe .pfm fonts, but the .ttf did embed in
the end and then i did a little scooby dance!

i think thats it. cheers,
jacob


<!-- ====== built-with="Xalan" ===== -->
<contact_info>
<name>     Jacob Cantwell   </name>
<company>  WebMCQ Pty. Ltd. </company>
<website>  www.webmcq.com </website>
</contact_info>




-----Original Message-----
From: berkland@scandinavian.wisc.edu
[mailto:berkland@scandinavian.wisc.edu]
Sent: Sunday, 7 October 2001 6:27 PM
To: Jacob Cantwell
Subject: Cocoon, Fop, and embedded Truetype fonts



Hi -

I saw that you posted to one of the Cocoon lists.  I've been struggling to
get cocoon
to embed Truetype fonts in the PDFs it produces.  I've been looking around,
but
haven't seen any clear indications that anyone has it working.  I was just
wondering
if you've had any luck yet.

--Brad Berkland (berkland@scandinavian.wisc.edu)
  Scandinavian Studies
  UW-Madison