You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by wojtekb82_23 <wo...@o2.pl> on 2006/10/28 13:24:54 UTC

Problem with fonts.

Hello,

I have a problem with my reginal chars in generated PDF files (Polish).

I followed the tutorial http://cocoon.apache.org/2.1/userdocs/pdf-serializer.html

I applied those things to my forrest project.

I made a dirrectory with font metrics. I made the config.xml. I edited my stitemap.xmap.

I have some Polish chars in my-new-file.xml
The genereated html file is OK. The chars are encoded properly.
But in the pdf file there still is the problem, insted of letters i see ###### signs (except the ó and Ó sign).

The size of the PDF file is about 5kB, so the fonts are not included in it.

I use the lastest 0.7 forrest.



Direcotory tree of my project:

------------------------------------------------------------------------------------------------
Folder PATH listing
Volume serial number is ....-....
C:.
ł   .project
ł   .classpath
ł   forrest.properties
ł   
ŔÄÄÄsrc
    ŔÄÄÄdocumentation
        ł   sitemap.xmap
        ł   skinconf.xml
        ł   README.txt
        ł   config2.xml
        ł   fonts.bat
        ł   config.xml
        ł   
        ĂÄÄÄclasses
        ł       CatalogManager.properties
        ł       
        ĂÄÄÄcontent
        ł   ł   test1.html
        ł   ł   
        ł   ŔÄÄÄxdocs
        ł       ł   tabs.xml
        ł       ł   hello.pdf
        ł       ł   index.xml
        ł       ł   site.xml
        ł       ł   my-new-file.xml
        ł       ł   
        ł       ĂÄÄÄimages
        ł       ł       icon.png
        ł       ł       group-logo.gif
        ł       ł       project.svg
        ł       ł       usemap.gif
        ł       ł       group.svg
        ł       ł       project-logo.gif
        ł       ł       
        ł       ŔÄÄÄsamples
        ł           ł   linking.xml
        ł           ł   cocoon-pyramid.aart
        ł           ł   faq.xml
        ł           ł   ascii-art.xml
        ł           ł   customSchema.xml
        ł           ł   hello-v10.dtd
        ł           ł   custom.xml
        ł           ł   index.xml
        ł           ł   static.xml
        ł           ł   embedded_html.html
        ł           ł   helloAgain.pdf
        ł           ł   usemap.xml
        ł           ł   sample.xml
        ł           ł   document-v13.xml
        ł           ł   
        ł           ŔÄÄÄsubdir
        ł                   hello.zip
        ł                   book-sample.xml
        ł                   index.xml
        ł                   
        ĂÄÄÄresources
        ł   ĂÄÄÄschema
        ł   ł       catalog.xcat
        ł   ł       hello-v10.dtd
        ł   ł       
        ł   ŔÄÄÄstylesheets
        ł           hello2document.xsl
        ł           
        ĂÄÄÄtranslations
        ł       langcode.xml
        ł       menu_de.xml
        ł       menu_af.xml
        ł       tabs_es.xml
        ł       menu_ru.xml
        ł       menu_no.xml
        ł       tabs.xml
        ł       languages_en.xml
        ł       menu_sk.xml
        ł       languages_es.xml
        ł       menu_es.xml
        ł       menu_it.xml
        ł       menu.xml
        ł       
        ŔÄÄÄfop-fonts
                arial.ttf.xml
                arialbd.ttf.xml
                ariali.ttf.xml
                arialbi.ttf.xml
                arial.ttf
                arialbd.ttf
                arialbi.ttf
                ariali.ttf
                times.ttf.xml
                timesdb.ttf.xml
                timesbi.ttf.xml
                timesi.ttf.xml
                times.ttf
                timesbd.ttf
                timesbi.ttf
                timesi.ttf              
------------------------------------------------------------------------------------------------





My sitemap.xmap:

------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<!--
  Copyright 2002-2005 The Apache Software Foundation or its licensors,
  as applicable.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:components>
    <map:actions>
      <map:action logger="sitemap.action.sourcetype" name="sourcetype" src="org.apache.forrest.sourcetype.SourceTypeAction">
        <sourcetype name="hello-v1.0">
          <document-declaration public-id="-//Acme//DTD Hello Document V1.0//EN" />
        </sourcetype>
      </map:action>
    </map:actions>   
    
    <map:selectors default="parameter">
	    <map:selector logger="sitemap.selector.parameter" name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
    </map:selectors>
    
	<map:serializers>	
		<map:serializer name="fo2pdf"
		                src="org.apache.cocoon.serialization.FOPSerializer"
		                mime-type="application/pdf">
			<user-config src="config.xml" />			
		</map:serializer>		
	 </map:serializers>
  </map:components>
  
  <map:resources>    
    <map:resource name="transform-to-document">
      <map:act type="sourcetype" src="{src}">
        <map:select type="parameter">
          <map:parameter name="parameter-selector-test" value="{sourcetype}" />

          <map:when test="hello-v1.0">
            <map:generate src="{project:content.xdocs}{../../1}.xml" />
            <map:transform src="{project:resources.stylesheets}/hello2document.xsl" />
            <map:serialize type="xml-document"/>
          </map:when>
        </map:select>
      </map:act>
    </map:resource>
  </map:resources>
  
 <map:pipelines>
  <map:pipeline>
    <map:match pattern="old_site/*.html">
     <map:select type="exists">
      <map:when test="{project:content}{1}.html">
        <map:read src="{project:content}{1}.html" mime-type="text/html"/>
        <!--
          Use this instead if you want JTidy to clean up your HTML
          <map:generate type="html" src="{project:content}/{0}" />
          <map:serialize type="html"/>
        -->
      </map:when>
     </map:select>
   </map:match>
  
   <map:match pattern="**.xml">
      <map:call resource="transform-to-document">
        <map:parameter name="src" value="{project:content.xdocs}{1}.xml" />
      </map:call>
    </map:match>
  </map:pipeline>
 </map:pipelines>

</map:sitemap>
------------------------------------------------------------------------------------------------



My config.xml

------------------------------------------------------------------------------------------------
<configuration>
  <fonts>
    <font metrics-file="fop-fonts/arial.ttf.xml" 
          kerning="yes" embed-file="fop-fonts/arial.ttf">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>
    </font>
    <font metrics-file="fop-fonts/arialbd.ttf.xml" 
          kerning="yes" embed-file="fop-fonts/arialbd.ttf">
      <font-triplet name="Arial" style="normal" weight="bold"/>
      <font-triplet name="ArialMT" style="normal" weight="bold"/>
    </font>
    <font metrics-file="fop-fonts/arialbi.ttf.xml"
          kerning="yes" embed-file="fop-fonts/arialbi.ttf">
      <font-triplet name="Arial" style="italic" weight="bold"/>
      <font-triplet name="ArialMT" style="italic" weight="bold"/>
    </font>
    <font metrics-file="fop-fonts/ariali.ttf.xml"
          kerning="yes" embed-file="fop-fonts/ariali.ttf">
      <font-triplet name="Arial" style="italic" weight="normal"/>
      <font-triplet name="ArialMT" style="italic" weight="normal"/>
    </font>
    
    <font metrics-file="fop-fonts/times.ttf.xml" 
          kerning="yes" embed-file="fop-fonts/times.ttf">
      <font-triplet name="Times" style="normal" weight="normal"/>
      <font-triplet name="TimesMT" style="normal" weight="normal"/>
    </font>
    <font metrics-file="fop-fonts/timesbd.ttf.xml" 
          kerning="yes" embed-file="fop-fonts/timesbd.ttf">
      <font-triplet name="Times" style="normal" weight="bold"/>
      <font-triplet name="TimesMT" style="normal" weight="bold"/>
    </font>
    <font metrics-file="fop-fonts/timesbi.ttf.xml"
          kerning="yes" embed-file="fop-fonts/arialbi.ttf">
      <font-triplet name="Times" style="italic" weight="bold"/>
      <font-triplet name="TimesMT" style="italic" weight="bold"/>
    </font>
    <font metrics-file="fop-fonts/timesi.ttf.xml"
          kerning="yes" embed-file="fop-fonts/timesi.ttf">
      <font-triplet name="Times" style="italic" weight="normal"/>
      <font-triplet name="TimesMT" style="italic" weight="normal"/>
    </font>
  </fonts>
</configuration>
------------------------------------------------------------------------------------------------

Re: Problem with fonts.

Posted by "Wojtek B." <wo...@tlen.pl>.
I tried to answer a similar question on the 10th october on this mailing 
list.
You will find my mail here:
http://mail-archives.apache.org/mod_mbox/forrest-user/200610.mbox/<200610101559.28358.boerre%40skolelinux.no>
Hope it is useful for  you.
----------------------------------

Thanks. I saw that solution before, but the problem is that I do not want to 
modify any files outside my project (I do not want to modify the FOP plugin 
files).
As I understood from the tutorial for cocoon it is possible to pass all 
needed "parameters" to FOP from sitemap.xmap of my forrest project. But that 
won't work. And that is my point, maybe somebody knows what should I do.

Anyway, once again thatnks for the reply.

Kind regards,
WB



Re: Problem with fonts.

Posted by Børre Gaup <bo...@skolelinux.no>.
Láv, golggotmánu 28. b. 2006 13.24, wojtekb82_23 čálii:
> Hello,
>
> I have a problem with my reginal chars in generated PDF files (Polish).
>
I tried to answer a similar question on the 10th october on this mailing list. 
You will find my mail here: 
http://mail-archives.apache.org/mod_mbox/forrest-user/200610.mbox/<200610101559.28358.boerre%40skolelinux.no>

Hope it is useful for  you.
-- 
Børre Gaup