Your configuration is slightly wrong. It should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<fop>
<fonts>
<substitutions>
<substitution>
<from font-family="URW Bookman L" font-weight="400"/>
<to font-family="URW Bookman L" font-weight="200"/>
</substitution>
</substitutions>
</fonts>
<renderers>
<renderer mime="application/pdf">
<fonts>
<directory recursive="true">/usr/local/share/fonts</directory>
<auto-detect/>
</fonts>
</renderer>
</renderers>
</fop>
The substitutions are defined for all renderers. Plus see my changes to
the from/to elements.
I've also fixed a couple of problems in Trunk found while looking into
this:
http://svn.apache.org/viewvc?rev=682616&view=rev
http://svn.apache.org/viewvc?rev=682617&view=rev
Now I need to check why the font lookup didn't automatically replace the
weight 400 with weight 200. I thought I had added that at some point.
On 05.08.2008 05:25:09 Alias John Brown wrote:
>
> I have been trying to use the "URW Bookman L" font, which is one of the
> Ghostscript fonts (b018012l.pfb). Apache FOP recognises it only when it is
> bold.
> More accurately, it uses the Demi Bold font when Bold is requested.
> Howevere, it does not use the Light font when Normal is requested,
> which is what I want.
>
> When I run fc-list, I get the following information:
>
> $ fc-list | grep URW\ Book
> URW Bookman L:style=Demi Bold
> URW Bookman L:style=Light
> URW Bookman L:style=Light Italic
> URW Bookman L:style=Demi Bold Italic
>
> I wrote a small FO file:
>
> ?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" font-family="URW
> Bookman L">
> <fo:layout-master-set>
> <fo:simple-page-master master-name="A4" page-height="29.7cm"
> page-width="21cm" margin="2cm">
> <fo:region-body/>
> </fo:simple-page-master>
> </fo:layout-master-set>
> <fo:page-sequence master-reference="A4">
> <fo:flow flow-name="xsl-region-body">
> <fo:block>
> <fox:destination internal-destination="hello"/>
> </fo:block>
> <fo:block id="hello-normal" font-weight="normal">Hello World
> Normal!</fo:block>
> <fo:block id="hello-bold" font-weight="bold">Hello World
> Bold!</fo:block>
> <fo:block id="hello-italic" font-style="italic">Hello World
> Italic!</fo:block>
> <fo:block id="hello-bold-italic" font-weight="bold"
> font-style="italic">Hello World Bold Italic!</fo:block>
> </fo:flow>
> </fo:page-sequence>
> </fo:root>
>
> I wrote fop.xconf like this:
>
>
> $ fop -c fop.xconf font.fo font.pdf
> Aug 4, 2008 6:35:36 PM org.apache.fop.events.LoggingEventListener
> processEvent
> WARNING: Font "URW Bookman L,normal,400" not found. Substituting with
> "any,normal,400".
> Aug 4, 2008 6:35:36 PM org.apache.fop.events.LoggingEventListener
> processEvent
> WARNING: Font "URW Bookman L,normal,700" not found. Substituting with "URW
> Bookman L,normal,600".
> Aug 4, 2008 6:35:37 PM org.apache.fop.events.LoggingEventListener
> processEvent
> WARNING: Font "URW Bookman L,italic,400" not found. Substituting with
> "any,italic,400".
> Aug 4, 2008 6:35:37 PM org.apache.fop.events.LoggingEventListener
> processEvent
> WARNING: Font "URW Bookman L,italic,700" not found. Substituting with "URW
> Bookman L,italic,600".
> Aug 4, 2008 6:35:37 PM org.apache.fop.events.LoggingEventListener
> processEvent
> WARNING: Destination: Unresolved ID reference "hello" found.
>
>
> I tried various combinations of the following:
>
> <substitutions>
> <substitution>
> <from font-family="URW Bookman L" font-weight="normal"
> font-style="normal"/>
> <to font-family="URW Bookman L" font-weight="?" font-style="?"/>
> </substitution>
> </substitutions>
>
> but nothing worked.
>
> I made a font metrics file. Within the font metric file, I changed the name
> of the font
> from URWBookmanL-Ligh to "URW Bookman L", and in the fop.xconf, I wrote:
>
> <font-triplet name="URW Bookman L" style="normal" weight="normal"/>
>
>
> This seemed to work, but it was very tiresome. Normal, Bold and Bold Italic
> are
> working now, so I only have to do it one more time to make Italic work.
>
> How can I get font substitution to work?
>
> My complete fop.xconf is:
> <?xml version="1.0" encoding="UTF-8"?>
> <fop>
> <renderers>
> <renderer mime="application/pdf">
> <fonts>
> <substitutions>
> <substitution>
> <from font-family="URW Bookman L" font-weight="normal"
> font-style="normal"/>
> <to font-family="URW Bookman L" font-weight="?" font-style="?"/>
> </substitution>
> </substitutions>
> <!--
>
> <font-triplet name="URW Bookman L" style="normal" weight="normal"/>
>
> -->
> <!-- <directory recursive="true">/usr/local/share/fonts</directory> -->
> <directory recursive="true">/usr/share/fonts/type1/gsfonts</directory>
> <auto-detect/>
> </fonts>
> </renderer>
> </renderers>
> </fop>
>
>
> I am using fop-trunk r 682557 (Jul 31, 2008).
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Font-%3Csubstitution%3E-not-working-with-Ghostscript-font-tp18823889p18823889.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]