You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Faehndrich Philippe <ph...@bluewin.ch> on 2010/11/07 15:09:26 UTC

FOPSerializer user config

Hello,

Working with Cocoon 2.1.11 and fop-0.94.jar, I'm trying to use a Truetype font 
I need for some Unicode characters.

I've built the font metric files, and added a line in the main sitemap.xmap, 
but it's obvious Cocoon doesn't take this line into account.

I've tried both of the following syntax:
<map:serializer logger="sitemap.serializer.fo2pdf" mime-type="application/pdf" 
name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer">
    <user-config>WEB-INF/lib/fop-fonts/font-config.xml</user-config>
</map:serializer>

and:

<map:serializer logger="sitemap.serializer.fo2pdf" mime-type="application/pdf" 
name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer">
    <user-config src="WEB-INF/lib/fop-fonts/font-config.xml"/>
map:serializer>

with relative path to the sitemap-xmap file and absolute path (<user-
config>/srv/tomcat6/webapps/cocoon/WEB-INF/lib/fop-fonts/font-config.xml</user-
config> or <user-config src="/srv/tomcat6/webapps/cocoon/WEB-INF/lib/fop-
fonts/font-config.xml"/>), but none of the these solutions work.

I just get the same PDF output as if I didn't modify anything. As I have no 
error and no mention of the FOP process in the log files, I have no idea if the 
error is the sitemap.xmap, in the font-config.xml or in the metric files.

Could someone help me? I didn't find anything I understand enough in the 
documentation.

Philippe Faehndrich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: FOPSerializer user config

Posted by Laurent Medioni <lm...@odyssey-group.com>.
Hi,
To get some more detailed logs from fop you can add the following logger to your log4j.xconf file:
    <logger name="org.apache.fop" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="COCOON_DEFAULT" />
    </logger>
If you have the default config file then the DEBUG logs from fop should end up in log4j.log

You should then get some info on why your fop config file is not taken into account...

Because 'DejaVuSerif,normal,400' (DejaVuSerif/normal/normal) and 'DejaVuSerif,normal,700' (DejaVuSerif/normal/bold) should be matched by your configuration...

As Eduard suggested also try absolute urls (starting with file://) for metrics-url and embed-url, I also remember having issues with relative path...

Laurent

____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Re: FOPSerializer user config

Posted by Faehndrich Philippe <ph...@bluewin.ch>.
Le lundi 08 novembre 2010 17.51:57, Laurent Medioni a écrit :
> Try to get DEBUG logs from org.apache.fop.fonts using log4j, I am not sure
> you can get them from the Cocoon logs...

I'm afraid it's a little difficult for me. I'm a Cocoon user, having some 
practice with XSLT, SQL queries and XSL-FO stylesheets, but not a Java 
developer. I have absolute no idea how I could parameter log4j for a more 
comprehensive output.

For now, after having replaced the native logkit system by log4j, using the 
proposed default log4j.xconf config file, I get a (very) verbose log file, with 
some interesting lines I hadn't in my precedent cocoon.log.

These lines are:
cocoon/log4j.log:http-8080-1 WARN  fonts.FontInfo - Font 
'DejaVuSerif,normal,400' not found. Substituting with 'any,normal,400'.

cocoon/log4j.log:http-8080-1 WARN  fonts.FontInfo - Font 
'DejaVuSerif,normal,700' not found. Substituting with 'any,normal,700'.

But the (about 10 megas) log4j.log doesn't tell me why (or I don't understand 
where it does). 

I'm not even sure Cocoon reads the font metric files or my font-config.xml 
(there are no mention of those files in the log).

> I remember solving my issue using these logs because it showed that I
> needed to map "SansSerif" to my nice new Arial Unicode font... Here is the
> font declaration in fop.xconf:
> <font metrics-url="file:///X:/somewhere/arial_uni.xml" kerning="yes"
> embed-url="file:///X:/somewhere/ARIAL_UNI.TTF"> <font-triplet name="Arial"
> style="normal" weight="normal"/>
> 	<font-triplet name="Arial" style="normal" weight="bold"/>
> 	<font-triplet name="Arial" style="italic" weight="normal"/>
> 	<font-triplet name="Arial" style="italic" weight="bold"/>
> 	<font-triplet name="Arial Unicode MS" style="normal" weight="normal"/>
> 	<font-triplet name="Arial Unicode MS" style="normal" weight="bold"/>
> 	<font-triplet name="Arial Unicode MS" style="italic" weight="normal"/>
> 	<font-triplet name="Arial Unicode MS" style="italic" weight="bold"/>
> 	<font-triplet name="SansSerif" style="normal" weight="normal"/>
> 	<font-triplet name="SansSerif" style="normal" weight="bold"/>
> 	<font-triplet name="SansSerif" style="italic" weight="normal"/>
> 	<font-triplet name="SansSerif" style="italic" weight="bold"/>
> </font>
> I do not know what your document content is but you should try to match all
> the possible font triplets from your document... Laurent

Here is my font-config.xml. It is a little different from yours, but I believe 
it conforms to the documentation I've found on 
"http://cocoon.apache.org/2.1/userdocs/pdf-serializer.html". 

I've made it for more fonts than I'm really using (DejaVuSerif and DejaVuSerif 
bold would be enough for my actual document, but I can't exclude I'll be using 
italic or the sans serif varaint in the future).

<configuration>
  <fonts>
    <font metrics-file="DejaVuSerif.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSerif.ttf">
      <font-triplet name="DejaVuSerif" style="normal" weight="normal"/>
    </font>
    <font metrics-file="DejaVuSerifItalic.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSerif-
Italic.ttf">
      <font-triplet name="DejaVuSerif" style="italic" weight="normal"/>
    </font>
    <font metrics-file="DejaVuSerifBold.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSerif-
Bold.ttf">
      <font-triplet name="DejaVuSerif" style="normal" weight="bold"/>
    </font>
    <font metrics-file="DejaVuSerifBoldItalic.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSerif-
BoldItalic.ttf">
      <font-triplet name="DejaVuSerif" style="italic" weight="bold"/>
    </font>
    <font metrics-file="DejaVuSans.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSans.ttf">
      <font-triplet name="DejaVuSans" style="normal" weight="normal"/>
    </font>
    <font metrics-file="DejaVuSansOblique.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSans-
Oblique.ttf">
      <font-triplet name="DejaVuSans" style="italic" weight="normal"/>
    </font>
    <font metrics-file="DejaVuSansBold.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSans-
Bold.ttf">
      <font-triplet name="DejaVuSans" style="normal" weight="bold"/>
    </font>
    <font metrics-file="DejaVuSansBoldItalic.xml" 
          kerning="yes" embed-file="/usr/share/fonts/truetype/DejaVuSans-
BoldItalic.ttf">
      <font-triplet name="DejaVuSans" style="italic" weight="bold"/>
    </font>
  </fonts>
</configuration>

Anyhow, thank you for your help. If you have some hints further, I take them 
gratefully.

Philippe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: FOPSerializer user config

Posted by Laurent Medioni <lm...@odyssey-group.com>.
Try to get DEBUG logs from org.apache.fop.fonts using log4j, I am not sure you can get them from the Cocoon logs...

I remember solving my issue using these logs because it showed that I needed to map "SansSerif" to my nice new Arial Unicode font...
Here is the font declaration in fop.xconf:
<font metrics-url="file:///X:/somewhere/arial_uni.xml" kerning="yes" embed-url="file:///X:/somewhere/ARIAL_UNI.TTF">
	<font-triplet name="Arial" style="normal" weight="normal"/>
	<font-triplet name="Arial" style="normal" weight="bold"/>
	<font-triplet name="Arial" style="italic" weight="normal"/>
	<font-triplet name="Arial" style="italic" weight="bold"/>
	<font-triplet name="Arial Unicode MS" style="normal" weight="normal"/>
	<font-triplet name="Arial Unicode MS" style="normal" weight="bold"/>
	<font-triplet name="Arial Unicode MS" style="italic" weight="normal"/>
	<font-triplet name="Arial Unicode MS" style="italic" weight="bold"/>
	<font-triplet name="SansSerif" style="normal" weight="normal"/>
	<font-triplet name="SansSerif" style="normal" weight="bold"/>
	<font-triplet name="SansSerif" style="italic" weight="normal"/>
	<font-triplet name="SansSerif" style="italic" weight="bold"/>
</font>
I do not know what your document content is but you should try to match all the possible font triplets from your document...
Laurent

-----Original Message-----
From: Faehndrich Philippe [mailto:phfaehndrich@bluewin.ch] 
Sent: lundi, 8. novembre 2010 17:09
To: users@cocoon.apache.org
Subject: Re: FOPSerializer user config

Le lundi 08 novembre 2010 10.50:00, Laurent Medioni a écrit :
> Hi,
> The first syntax should work.
> Are you sure the font added in font-config.xml is actually used in your
> document ? To be sure try to get some more logs from fop in DEBUG. It
> should display some messages about what fonts are used...
> 
> Laurent

The problem is, with DEBUG, Cocoon gives me a huge amount of informations in 
the log file, but just about nothing concerning the fo2pdf process.

Just like if the FOPSerializer wouldn't write a single line in the log file.

Is there a way to get specifically more details on the fo2pdf process in the 
log file?

Philippe



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Re: FOPSerializer user config

Posted by Faehndrich Philippe <ph...@bluewin.ch>.
Le lundi 08 novembre 2010 10.50:00, Laurent Medioni a écrit :
> Hi,
> The first syntax should work.
> Are you sure the font added in font-config.xml is actually used in your
> document ? To be sure try to get some more logs from fop in DEBUG. It
> should display some messages about what fonts are used...
> 
> Laurent

The problem is, with DEBUG, Cocoon gives me a huge amount of informations in 
the log file, but just about nothing concerning the fo2pdf process.

Just like if the FOPSerializer wouldn't write a single line in the log file.

Is there a way to get specifically more details on the fo2pdf process in the 
log file?

Philippe



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: FOPSerializer user config

Posted by Laurent Medioni <lm...@odyssey-group.com>.
Hi,
The first syntax should work.
Are you sure the font added in font-config.xml is actually used in your document ?
To be sure try to get some more logs from fop in DEBUG. It should display some messages about what fonts are used...

Laurent

-----Original Message-----
From: Faehndrich Philippe [mailto:phfaehndrich@bluewin.ch] 
Sent: dimanche, 7. novembre 2010 15:09
To: users@cocoon.apache.org
Subject: FOPSerializer user config

Hello,

Working with Cocoon 2.1.11 and fop-0.94.jar, I'm trying to use a Truetype font 
I need for some Unicode characters.

I've built the font metric files, and added a line in the main sitemap.xmap, 
but it's obvious Cocoon doesn't take this line into account.

I've tried both of the following syntax:
<map:serializer logger="sitemap.serializer.fo2pdf" mime-type="application/pdf" 
name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer">
    <user-config>WEB-INF/lib/fop-fonts/font-config.xml</user-config>
</map:serializer>

and:

<map:serializer logger="sitemap.serializer.fo2pdf" mime-type="application/pdf" 
name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer">
    <user-config src="WEB-INF/lib/fop-fonts/font-config.xml"/>
map:serializer>

with relative path to the sitemap-xmap file and absolute path (<user-
config>/srv/tomcat6/webapps/cocoon/WEB-INF/lib/fop-fonts/font-config.xml</user-
config> or <user-config src="/srv/tomcat6/webapps/cocoon/WEB-INF/lib/fop-
fonts/font-config.xml"/>), but none of the these solutions work.

I just get the same PDF output as if I didn't modify anything. As I have no 
error and no mention of the FOP process in the log files, I have no idea if the 
error is the sitemap.xmap, in the font-config.xml or in the metric files.

Could someone help me? I didn't find anything I understand enough in the 
documentation.

Philippe Faehndrich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.