xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Pekala <m.pek...@idelfi.com>
Subject Re: Printing Latin-2 characters
Date Tue, 15 Sep 2009 07:43:11 GMT
On 2009-09-14 10:29:22 -0500 (Mon, Sep), Jill DeLong wrote:
> Thank you, Mariusz.
> 
> Do you know which font you are using for this?  It looks like we are trying
> to use Arial for the xsl but when I output using -at application/postscript,
> the resulting file is giving me < ... font-name="any" ... >.  I think this
> may be the culprit and I will try to use Helvetica/Times/Courier instead,
> unless you know of a font that works best for you?
> 

Ah, sorry. I should say it at once ;-)

I am using freefonts-ttf from http://savannah.nongnu.org/projects/freefont/

I have created xml files for these fonts (It may be not necessary now,
but it worked for me and I decided "if it works then don't fix it").

The info on how to make the font's xml file is on http://xmlgraphics.apache.org/fop/0.95/fonts.html
and I attached my old Rakefile, in case you find it useful.

Part of my fop.xconf file:
  <font metrics-url="file:///home/case/fonts/FreeSans.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSans.ttf">
    <font-triplet name="FreeSans"   style="normal" weight="normal"/>
    <font-triplet name="Verdana"    style="normal" weight="normal"/>
    <font-triplet name="Arial"      style="normal" weight="normal"/>
    <font-triplet name="sans-serif" style="normal" weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSansBold.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSansBold.ttf">
    <font-triplet name="FreeSans"   style="normal" weight="bold"/>
    <font-triplet name="Verdana"    style="normal" weight="bold"/>
    <font-triplet name="Arial"      style="normal" weight="bold"/>
    <font-triplet name="sans-serif" style="normal" weight="bold"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSansOblique.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSansOblique.ttf">
    <font-triplet name="FreeSans"   style="italic"  weight="normal"/>
    <font-triplet name="Verdana"    style="italic"  weight="normal"/>
    <font-triplet name="Arial"      style="italic"  weight="normal"/>
    <font-triplet name="sans-serif" style="italic"  weight="normal"/>

    <font-triplet name="FreeSans"   style="oblique" weight="normal"/>
    <font-triplet name="Verdana"    style="oblique" weight="normal"/>
    <font-triplet name="Arial"      style="oblique" weight="normal"/>
    <font-triplet name="sans-serif" style="oblique" weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSansBoldOblique.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSansBoldOblique.ttf">
    <font-triplet name="FreeSans"   style="italic"  weight="bold"/>
    <font-triplet name="Verdana"    style="italic"  weight="bold"/>
    <font-triplet name="Arial"      style="italic"  weight="bold"/>
    <font-triplet name="sans-serif" style="italic"  weight="bold"/>

    <font-triplet name="FreeSans"   style="oblique" weight="bold"/>
    <font-triplet name="Verdana"    style="oblique" weight="bold"/>
    <font-triplet name="Arial"      style="oblique" weight="bold"/>
    <font-triplet name="sans-serif" style="oblique" weight="bold"/>
  </font>


  <font metrics-url="file:///home/case/fonts/FreeSerif.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSerif.ttf">
    <font-triplet name="FreeSerif"  style="normal" weight="normal"/>
    <font-triplet name="Georgia"    style="normal" weight="normal"/>
    <font-triplet name="Times"      style="normal" weight="normal"/>
    <font-triplet name="serif"      style="normal" weight="normal"/>
    <font-triplet name="any"        style="normal" weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSerifBold.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSerifBold.ttf">
    <font-triplet name="FreeSerif"  style="normal" weight="bold"/>
    <font-triplet name="Georgia"    style="normal" weight="bold"/>
    <font-triplet name="Times"      style="normal" weight="bold"/>
    <font-triplet name="serif"      style="normal" weight="bold"/>
    <font-triplet name="any"        style="normal" weight="bold"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSerifItalic.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSerifItalic.ttf">
    <font-triplet name="FreeSerif"  style="italic"  weight="normal"/>
    <font-triplet name="Georgia"    style="italic"  weight="normal"/>
    <font-triplet name="Times"      style="italic"  weight="normal"/>
    <font-triplet name="serif"      style="italic"  weight="normal"/>
    <font-triplet name="any"        style="italic"  weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeSerifBoldItalic.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeSerifBoldItalic.ttf">
    <font-triplet name="FreeSerif"  style="italic"  weight="bold"/>
    <font-triplet name="Georgia"    style="italic"  weight="bold"/>
    <font-triplet name="Times"      style="italic"  weight="bold"/>
    <font-triplet name="serif"      style="italic"  weight="bold"/>
    <font-triplet name="any"        style="italic"  weight="bold"/>
  </font>


  <font metrics-url="file:///home/case/fonts/FreeMono.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeMono.ttf">
    <font-triplet name="FreeMono"   style="normal" weight="normal"/>
    <font-triplet name="Courier"    style="normal" weight="normal"/>
    <font-triplet name="monospace"  style="normal" weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeMonoBold.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeMonoBold.ttf">
    <font-triplet name="FreeMono"   style="normal" weight="bold"/>
    <font-triplet name="Courier"    style="normal" weight="bold"/>
    <font-triplet name="monospace"  style="normal" weight="bold"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeMonoOblique.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeMonoOblique.ttf">
    <font-triplet name="FreeMono"   style="italic"  weight="normal"/>
    <font-triplet name="Courier"    style="italic"  weight="normal"/>
    <font-triplet name="monospace"  style="italic"  weight="normal"/>

    <font-triplet name="FreeMono"   style="oblique" weight="normal"/>
    <font-triplet name="Courier"    style="oblique" weight="normal"/>
    <font-triplet name="monospace"  style="oblique" weight="normal"/>
  </font>
  <font metrics-url="file:///home/case/fonts/FreeMonoBoldOblique.xml" kerning="yes" embed-url="file:///home/case/fonts/f/FreeMonoBoldOblique.ttf">
    <font-triplet name="FreeMono"   style="italic"  weight="bold"/>
    <font-triplet name="Courier"    style="italic"  weight="bold"/>
    <font-triplet name="monospace"  style="italic"  weight="bold"/>

    <font-triplet name="FreeMono"   style="oblique" weight="bold"/>
    <font-triplet name="Courier"    style="oblique" weight="bold"/>
    <font-triplet name="monospace"  style="oblique" weight="bold"/>
  </font>
</fonts>


==== Rakefile:

FOP_CLASSPATH=%w[
  /home/case/fop-0.95beta/lib/xmlgraphics-commons-1.3.jar
  /home/case/fop-0.95beta/lib/xml-apis-ext.jar
  /home/case/fop-0.95beta/lib/xml-apis-1.3.02.jar
  /home/case/fop-0.95beta/lib/xercesImpl-2.7.1.jar
  /home/case/fop-0.95beta/lib/xalan-2.7.0.jar
  /home/case/fop-0.95beta/lib/serializer-2.7.0.jar
  /home/case/fop-0.95beta/lib/commons-logging-1.0.4.jar
  /home/case/fop-0.95beta/lib/commons-io-1.3.1.jar
  /home/case/fop-0.95beta/lib/batik-all-1.7.jar
  /home/case/fop-0.95beta/lib/avalon-framework-4.2.0.jar
  /home/case/fop-0.95beta/build/fop.jar
  /home/case/fop-0.95beta/build/fop-sandbox.jar
  /home/case/fop-0.95beta/build/fop-hyph.jar
  .
]
FOP_CLASSPATH_LINE = FOP_CLASSPATH.join(':')

FONTS=%w[
  FreeMonoBoldOblique
  FreeMonoBold
  FreeMonoOblique
  FreeMono
  FreeSansBoldOblique
  FreeSansBold
  FreeSansOblique
  FreeSans
  FreeSerifBoldItalic
  FreeSerifBold
  FreeSerifItalic
  FreeSerif
]

rule( '.xml' => proc {|task_name| 'f/' + task_name.sub(/\.xml$/,'.ttf')} ) do |t|
  sh "java", '-classpath', FOP_CLASSPATH_LINE, 'org.apache.fop.fonts.apps.TTFReader', t.source,
t.name
end

task( :all => FONTS.map {|f| f + '.xml'} )

#task :font do
#  #h "java", '-classpath', FOP_CLASSPATH_LINE, 'org.apache.fop.cli.Main', "a.fo", "b.pdf"
#  #h "java", '-classpath', FOP_CLASSPATH_LINE, 'org.apache.fop.fonts.apps.PFMReader', 'f/n019003l.afm',
'nimbus.xml'
#  sh "java", '-classpath', FOP_CLASSPATH_LINE, 'org.apache.fop.fonts.apps.TTFReader', 'f/FreeSans.ttf',
'free_sans.xml'
#end

===== EOF
-- 
iDelfi Polska Sp. z o.o., ul. Kołobrzeska 50, 10-434 Olsztyn
http://www.idelfi.com
NIP7393665905 REGON280269116 KRS0000297600 Kapitał zakładowy: 120 000 PLN

Mime
View raw message