forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Williams" <william...@gmail.com>
Subject Re: FOPNGSerializer, user-config and locationmaps
Date Mon, 18 Aug 2008 10:54:57 GMT
On Mon, Aug 18, 2008 at 6:29 AM, Sjur Moshagen <sjurnm@mac.com> wrote:
> Hello all,
>
> I'm trying to set up locationmap-based user configuration of the
> FOPNGSerializer, but I'm having some problems.
>
> In the present output.xmap within the pdf plugin, FOPNGSerializer is
> defined/initialised as follows:
>
>    <map:serializers default="fo2pdf">
>      <map:serializer name="fo2pdf"
> src="org.apache.cocoon.blocks.fop.FOPNGSerializer"
> mime-type="application/pdf" />
>    </map:serializers>
>
> This is fine as long as you don't need to change any of the default fonts.
> But as is discussed on the mailing lists from time to time, the default
> fonts are not enough in some cases, and cause some or all of your chars to
> appear as squares in the pdf document.[1]
>
> The solution is to specify a font configuration file, and point the
> FOPNGSerializer to it. This is done using a <user-config> element as a
> daughter to the <map:serializer> element, like this:
>
>    <map:serializers default="fo2pdf">
>      <map:serializer name="fo2pdf"
> src="org.apache.cocoon.blocks.fop.FOPNGSerializer"
> mime-type="application/pdf">
>
>  <user-config>/Users/sjur/gtsvn/xtdoc/sd/src/documentation/resources/fonts/config.xml</user-config>
>       </map:serializer>
>    </map:serializers>
>
> The above specification works for me, but as you can see, the path is
> hardcoded, and you have to change the output.xmap in the plugin. What I
> would like to have is something like:
>
>    <map:serializers default="fo2pdf">
>      <map:serializer name="fo2pdf"
> src="org.apache.cocoon.blocks.fop.FOPNGSerializer"
> mime-type="application/pdf">
>        <user-config>{lm:pdf.user-config}</user-config>
>       </map:serializer>
>    </map:serializers>
>
> combined with a locationmap match (in locationmap.xml in the plugin) like:
>
>    <match pattern="pdf.user-config">
>      <select>
>        <location src="resources/fonts/config.xml"/>
>      </select>
>    </match>
>
> The intended behavior is that if the config.xml file exists in the project
> directory hierarchy, the path to it should be returned, and the config file
> used. If there is NO such file defined, the locationmap should return the
> empty string, as a <user-config> element with no content will behave as
> nothing was specified, and fall back to defaults. This is what most users
> would want.
>
> But the locationmap instead returns:
>
> /usr/local/forrest/build/plugins/org.apache.forrest.plugin.output.pdf/pdf.user-config}
>
> which of course triggers an error.
>
> To me it looks like the locationmap, when nothing is found, returns the path
> to the locationmap.xml file (excluding the filename), combined with the last
> part of the lm: specification in the sitemap: 'pdf.user-config}'
>
> An empty locationmap selection:
>
>    <match pattern="pdf.user-config">
>      <select>
>        <location src="resources/fonts/config.xml"/> <!-- no such file,
> select the next one -->
>        <location src=""/> <!-- should return an empty string, but returns a
> bad, non-empty string -->
>      </select>
>    </match>
>
> returns the same bogus string as above.
>
> Anybody any clue about what is going on? How can I get the intended
> behaviour?
>
> Sjur
>
> [1] http://marc.info/?l=forrest-user&m=118525205328423&w=2

Hi Sjur,
I mailed Cocoon about this[1] long ago and filed a bug[2] which says
it's now fixed.  I reckon we'd need to update Cocoon to see if that's
true(I don't see any actual commits against it).  I don't remember
much more than that unfortunately but I hope that helps.

--tim

[1] - http://marc.info/?t=111996379000002&r=1&w=2
[2] - https://issues.apache.org/jira/browse/COCOON-1542

Mime
View raw message