Hi,

I am trying to produce chinese PDFs not embedding fonts. I am using the SimSun 
font. 

When embedding the font, everything is fine. However, when trying to reference 
the font, FOP produced an invalid PDF, despite the Simsun font being installed 
on the machines were the PDF is produced and opened.

I tried both auto-configuring the fonts and the old style, metric based manual 
font configuration:

1) Auto-configured fonts:

<fonts>
   <referenced-fonts>
     <match font-family=".*"/>
   </referenced-fonts>
 </fonts>  
<renderers>
   <renderer mime="application/pdf">
     ...
     <auto-detect/>

The produced PDF shows # characters for every chinese symbol. 

2) Manually configured fonts:
 
<renderers>
   <renderer mime="application/pdf">
     ...
     <fonts>
       <font metrics-url="file:///Users/jumal/Downloads/fop-1.0/SimSun.xml" 
kerning="yes">
         <font-triplet name="SimSun" style="normal" weight="normal"/>
         <font-triplet name="SimSun" style="normal" weight="bold"/>
         <font-triplet name="SimSun" style="italic" weight="normal"/>
         <font-triplet name="SimSun" style="italic" weight="bold"/>
       </font> 

    a) Metric file generated with the default options: 
         
         java -cp ... org.apache.fop.fonts.apps.TTFReader SimSun.ttf SimSun.xml

         The produced PDF can not be opened by Acrobat Reader which gives the 
following error message: "Cannot find or create the font 'SimSun'. Some 
characters may not display or print correctly".

    b) Metric file generated with the -enc ansi options: 
         
         java -cp ... org.apache.fop.fonts.apps.TTFReader -enc ansi SimSun.ttf 
SimSun.xml

         The produced PDF shows # characters for every chinese symbol. 
 
Having a look at 
http://xmlgraphics.apache.org/fop/trunk/fonts.html#truetype-metrics, and in 
particular:

TTFReader [options]:
        ...
        • -enc ansi Creates a WinAnsi-encoded font metrics file. Without this 
option, a CID-keyed font metrics file is created. The table below summarises 
the differences between these two encoding options as currently used within 
FOP. Please note that this information only applies to TrueType fonts and 
TrueType collections:
Issue                                   WinAnsi                                 
                                                                                
        CID-keyed
Usable Character Set      Limited to WinAnsi character set, which is roughly 
equivalent to iso-8889-1.  Limited only by the characters in the font itself.
Embedding the Font        Optional.                                             
                                                                              
Mandatory. Not embedding the font produces invalid PDF documents.

it looks like you need to use the -enc ansi to be able to reference a font. 
Does this mean that have to use WinAnsi (windows-1252) encoding for the input 
XML files? 

If it is the case, that would mean to produce for example chinese PDFs, you 
would have to embed the font, as windows-1252 cannot be used to encode chinese 
symbols.

Am I missing something or the only way to produce chinese PDF is to embed the 
font with the font licensing costs it implies?

Cheers,
JP

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to