You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jean-Philippe Courson <je...@cognitran.com> on 2012/04/20 13:55:59 UTC

Chinese PDFs and non embedded fonts

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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Chinese PDFs and non embedded fonts

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hello again,

Thanks for confirming. I have just run a simple test on my machine using a similar character set on FOP 1.0 and mine did render correctly.

At this stage, the only thing I can think of is Java is unable to see the font. I have created a small Java program (with source included) which will list the installed fonts. 

Can you therefore try the following to confirm the font is listed:

1) Extract the files
2) You can recompile it if you like, but I have included the *.class file in the zip
2) In a command line navigate to the extracted bin folder and type "java program"
3) Check that the SimSun is listed amongst the displayed fonts.

My apologies if I am telling you things you already know how to do.

If it is not listed then it might be worth checking that the font has been correctly installed. Alternatives may be that the JVM hasn't picked up the font for some reason.

I am going to be away on holiday for a week from now, but am sure if you are still having problems someone else will be able to help.

Regards,

Robert Meyer

From: jean-philippe.courson@cognitran.com
Subject: Re: Chinese PDFs and non embedded fonts
Date: Fri, 20 Apr 2012 15:24:30 +0100
To: fop-users@xmlgraphics.apache.org

Hi Robert,
Thanks for your answer.
Yes it is:
  <renderers>
    <renderer mime="application/pdf">      <filterList>
        <value>flate</value>      </filterList>      <fonts>        <auto-detect/>      </fonts>
    </renderer>
Best Regards,JP
On 20 Apr 2012, at 15:15, Robert Meyer wrote:Hello,

Can you just confirm that when using the referenced-fonts method, the <auto-detect /> line is within a <fonts> tag pair in the renderer?

If it is not, then that may be why it is refusing the find the font you are referencing.

Best Regards,

Robert Meyer

> From: jean-philippe.courson@cognitran.com
> Subject: Chinese PDFs and non embedded fonts
> Date: Fri, 20 Apr 2012 12:55:59 +0100
> To: fop-users@xmlgraphics.apache.org
> 
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
 		 	   		  

Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Hi Robert,

Thanks for your answer.

Yes it is:

  <renderers>
    <renderer mime="application/pdf">
      <filterList>
        <value>flate</value>
      </filterList>
      <fonts>
        <auto-detect/>
      </fonts>
    </renderer>

Best Regards,
JP

On 20 Apr 2012, at 15:15, Robert Meyer wrote:

> Hello,
> 
> Can you just confirm that when using the referenced-fonts method, the <auto-detect /> line is within a <fonts> tag pair in the renderer?
> 
> If it is not, then that may be why it is refusing the find the font you are referencing.
> 
> Best Regards,
> 
> Robert Meyer
> 
> > From: jean-philippe.courson@cognitran.com
> > Subject: Chinese PDFs and non embedded fonts
> > Date: Fri, 20 Apr 2012 12:55:59 +0100
> > To: fop-users@xmlgraphics.apache.org
> > 
> > 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: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> >


RE: Chinese PDFs and non embedded fonts

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hello,

Can you just confirm that when using the referenced-fonts method, the <auto-detect /> line is within a <fonts> tag pair in the renderer?

If it is not, then that may be why it is refusing the find the font you are referencing.

Best Regards,

Robert Meyer

> From: jean-philippe.courson@cognitran.com
> Subject: Chinese PDFs and non embedded fonts
> Date: Fri, 20 Apr 2012 12:55:59 +0100
> To: fop-users@xmlgraphics.apache.org
> 
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Hi Chris,

Thanks for your reply.

The configuration-referenced.xml starts like this:

<fop version="1.0">
  <base>.</base>
  <source-resolution>72</source-resolution>
  <target-resolution>72</target-resolution>
  <default-page-settings height="11in" width="8.26in"/>
  <fonts>
    <referenced-fonts>
      <match font-family=".*"/>
    </referenced-fonts>
  </fonts>

I also tried not using <auto-detect/>:

1) Using a CID-keyed font metrics file:

~/Downloads/fop-1.0/test$ java -cp ../build/fop.jar:../lib/avalon-framework-4.2.0.jar:../lib/batik-all-1.7.jar:../lib/commons-io-1.3.1.jar:../lib/commons-logging-1.0.4.jar:../lib/serializer-2.7.0.jar:../lib/xalan-2.7.0.jar:../lib/xercesImpl-2.7.1.jar:../lib/xml-apis-1.3.04.jar:../lib/xml-apis-ext-1.3.04.jar:../lib/xmlgraphics-commons-1.4.jar org.apache.fop.fonts.apps.TTFReader fonts/SimSun.ttf simsun-cid.xml
TTF Reader for Apache FOP 1.0
Parsing font...
Reading fonts/SimSun.ttf...
Font Family: [宋体, SimSun]
Creating xml font file...
Creating CID encoded metrics...
Writing xml font file simsun-cid.xml...
This font contains no embedding license restrictions.

~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-referenced-no-autodetect-cid.xml output-referenced-no-autodetect-cid.pdf

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". This SimSun font is correctly installed on my machine.

2) Using a WinAnsi-encoded font metrics file:

~/Downloads/fop-1.0/test$ java -cp ../build/fop.jar:../lib/avalon-framework-4.2.0.jar:../lib/batik-all-1.7.jar:../lib/commons-io-1.3.1.jar:../lib/commons-logging-1.0.4.jar:../lib/serializer-2.7.0.jar:../lib/xalan-2.7.0.jar:../lib/xercesImpl-2.7.1.jar:../lib/xml-apis-1.3.04.jar:../lib/xml-apis-ext-1.3.04.jar:../lib/xmlgraphics-commons-1.4.jar org.apache.fop.fonts.apps.TTFReader -enc ansi fonts/SimSun.ttf simsun-ansi.xml
TTF Reader for Apache FOP 1.0
Parsing font...
Reading fonts/SimSun.ttf...
Font Family: [宋体, SimSun]
Creating xml font file...
Creating WinAnsi encoded metrics...
Writing xml font file simsun-ansi.xml...
This font contains no embedding license restrictions.

~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-referenced-no-autodetect-ansi.xml output-referenced-no-autodetect-ansi.pdf
Apr 24, 2012 3:30:52 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "仅" (0x4ec5) not available in font "SimSun".
Apr 24, 2012 3:30:52 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "供" (0x4f9b) not available in font "SimSun".
Apr 24, 2012 3:30:52 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "参" (0x53c2) not available in font "SimSun".
Apr 24, 2012 3:30:52 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "考" (0x8003) not available in font "SimSun".

The produced PDF shows # characters for every chinese symbol.

I attached to this email all the files used in the example as well as the produced PDFs.

Thanks in advance for your help,

Best regards,
JP


Re: Chinese PDFs and non embedded fonts

Posted by Chris Bowditch <bo...@hotmail.com>.
On 23/04/2012 14:35, Jean-Philippe Courson wrote:
> Hi all,

Hi Jean,
>
> Thank you for your replies.
>
> Please find attached a sample FO file highlighting the issue and 2 configuration files: one embedding the font, and another one referencing it.

I can't see the <referenced-fonts> element in either configuration file. 
So it still looks to me like you aren't configuring the font correctly. 
I also recommend that you don't use <auto-detect/> in this scenario.

Thanks,

Chris
>
> I attached as well a small JAVA program I use to verify that the font is correctly installed.
>
> For testing purpose, you can download the SimSun font from http://jumal.is.free.fr/SimSun.ttf.
>
> 1) I verify that the font is correctly installed:
>
> ~/Downloads/fop-1.0/test$ java AvailableFonts | grep SimSun
> SimSun
> java.awt.Font[family=SimSun,name=SimSun,style=plain,size=1]
>
> 2) I generate a PDF embedding the font:
>
> ~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-embedded.xml output-embedded.pdf
> Apr 23, 2012 1:49:38 PM org.apache.fop.apps.FopFactoryConfigurator configure
> INFO: Default page-height set to: 11in
> Apr 23, 2012 1:49:38 PM org.apache.fop.apps.FopFactoryConfigurator configure
> INFO: Default page-width set to: 8.26in
>
> The PDF produced is OK: Hello 仅供参考
>
> 3) I generate a PDF, using the same FO file, referencing the font:
>
> ~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-referenced.xml output-referenced.pdf
> Apr 23, 2012 1:49:52 PM org.apache.fop.apps.FopFactoryConfigurator configure
> INFO: Default page-height set to: 11in
> Apr 23, 2012 1:49:52 PM org.apache.fop.apps.FopFactoryConfigurator configure
> INFO: Default page-width set to: 8.26in
> Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
> WARNING: Glyph "仅" (0x4ec5) not available in font "SimSun".
> Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
> WARNING: Glyph "供" (0x4f9b) not available in font "SimSun".
> Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
> WARNING: Glyph "参" (0x53c2) not available in font "SimSun".
> Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
> WARNING: Glyph "考" (0x8003) not available in font "SimSun".
>
> FOP issues warnings telling that the glyphs are not available for the font (I just saw this warning making this example),  and the PDF produced is having all glyphs replaced with '#': Hello ####
>
> Am I doing something wrong with the configuration or is this issue due a FOP limitation or bug?
>
> Thank you all in advance for your help
>
> Best regards,
> JP
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On 23 Apr 2012, at 10:08, Chris Bowditch wrote:
>
>> On 20/04/2012 18:54, Glenn Adams wrote:
>>
>> Hi Glenn,
>>> it is best you create a bug at [1] to track this; you can upload attachments on the new bug; file it under the "Fop" product;
>> I'm not happy to encourage users on this list to open bugs before confirming there is a defect.
>>
>> Everything I've read on this thread so far suggests this is a configuration issue. Metrics files are deprecated in FOP v1.0+
>>
>> How to reference instead of embed is to add the embed-url attribute on the fonts elements and use the<referenced-fonts>  element as described in [1]
>>
>> Thanks,
>>
>> Chris
>>
>> [1] http://xmlgraphics.apache.org/fop/trunk/fonts.html#embedding
>>
>>> [1] https://issues.apache.org/bugzilla/
>>>
>>> On Fri, Apr 20, 2012 at 5:55 AM, Jean-Philippe Courson<je...@cognitran.com>>  wrote:
>>>
>>>     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:
>>>     fop-users-unsubscribe@xmlgraphics.apache.org
>>>     <ma...@xmlgraphics.apache.org>
>>>     For additional commands, e-mail:
>>>     fop-users-help@xmlgraphics.apache.org
>>>     <ma...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


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


Re: Chinese PDFs and non embedded fonts

Posted by Chris Bowditch <bo...@hotmail.com>.
On 24/04/2012 19:16, Luis Bernardo wrote:

Hi Luis,
> Just by itself the embed-url attribute does not imply that the font 
> will be embedded. I know that the attribute name is confusing, and the 
> documentation may not be up to date, but I believe that is the case. 
> Fonts are subset embedded by default unless the referenced-fonts 
> element is present, in which case they are referenced.

That is correct. The error reported by Adobe Reader suggests that the 
Simsun font is not registered with Adobe Reader. I believe it is not 
sufficient for the font to just be installed in the Operating System. I 
think the fonts also need to be registered with Adobe. Which makes the 
use case of referencing fonts instead of embedding somewhat worthless.

Thanks,

Chris
>
> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>> Hi Glenn,
>>
>> Thanks for your reply.
>>
>> In your example, you are embedding the font:
>>
>> <font embed-url="simsun.ttf">  the embed-url attribute will get the 
>> font embedded.
>>
>> I have no problem creating a chinese PDF when the font is embedded.
>>
>> The issue I am raising is when trying to reference (not embed) the font.
>>
>> Thanks for your help,
>>
>> Best regards,
>> JP
>>
>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>>> I just tried this with the font you referenced and had no problem. 
>>> Attached is the configuration file and input file I used and 
>>> resulting output. I'm using the current FOP 1.1dev (trunk) build.
>>>
>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you 
>>> notice that I disabled the font cache and placed the font in a 
>>> "fonts" subdirectory where I did the test.
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>


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


Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
bug filed at https://issues.apache.org/bugzilla/show_bug.cgi?id=53142

jean-philippe, you may want to create a bugzilla account and add yourself
to the CC list for this bug

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
bug filed at https://issues.apache.org/bugzilla/show_bug.cgi?id=53142

jean-philippe, you may want to create a bugzilla account and add yourself
to the CC list for this bug

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
btw, this code has been present since 2008-05-08 [1]

[1] http://svn.apache.org/viewvc?view=revision&revision=654461

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
btw, this code has been present since 2008-05-08 [1]

[1] http://svn.apache.org/viewvc?view=revision&revision=654461

On Tue, Apr 24, 2012 at 1:16 PM, Glenn Adams <gl...@skynav.com> wrote:

> ok, on digging into this further i have found:
>
> (1) luis is correct that embedding is performed by default without the
> referenced-fonts element;
>
> (2) in particular, when i add <referenced-fonts><match
> font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
> not found; when i remove, it works fine (and embeds subset);
>
> (3) looking at TTFFontLoader i find the following:
>
>         boolean isCid = this.embedded;
>         if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
>             isCid = false;
>         }
>
>         if (isCid) {
>             multiFont = new MultiByteFont();
>             returnFont = multiFont;
>             multiFont.setTTCName(ttcFontName);
>         } else {
>             singleFont = new SingleByteFont();
>             returnFont = singleFont;
>         }
>
> This code assumes that *all* non-embedded fonts are single byte fonts, so
> takes the else clause, constructing a SingleByteFont.
>
> Clearly this code is bogus and needs to use other means to determine if
> the font is CID keyed or not. In this case, it is CID keyed, and works fine
> when embedded is true.
>
> I will open a bug on this.
>
> Thanks Jean-Philippe for your persistence!
>
>
> On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:
>
>>
>> Just by itself the embed-url attribute does not imply that the font will
>> be embedded. I know that the attribute name is confusing, and the
>> documentation may not be up to date, but I believe that is the case. Fonts
>> are subset embedded by default unless the referenced-fonts element is
>> present, in which case they are referenced.
>>
>>
>> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the
>>> font embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>>  I just tried this with the font you referenced and had no problem.
>>>> Attached is the configuration file and input file I used and resulting
>>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>>
>>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>>> notice that I disabled the font cache and placed the font in a "fonts"
>>>> subdirectory where I did the test.
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
ok, on digging into this further i have found:

(1) luis is correct that embedding is performed by default without the
referenced-fonts element;

(2) in particular, when i add <referenced-fonts><match
font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
not found; when i remove, it works fine (and embeds subset);

(3) looking at TTFFontLoader i find the following:

        boolean isCid = this.embedded;
        if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
            isCid = false;
        }

        if (isCid) {
            multiFont = new MultiByteFont();
            returnFont = multiFont;
            multiFont.setTTCName(ttcFontName);
        } else {
            singleFont = new SingleByteFont();
            returnFont = singleFont;
        }

This code assumes that *all* non-embedded fonts are single byte fonts, so
takes the else clause, constructing a SingleByteFont.

Clearly this code is bogus and needs to use other means to determine if the
font is CID keyed or not. In this case, it is CID keyed, and works fine
when embedded is true.

I will open a bug on this.

Thanks Jean-Philippe for your persistence!

On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:

>
> Just by itself the embed-url attribute does not imply that the font will
> be embedded. I know that the attribute name is confusing, and the
> documentation may not be up to date, but I believe that is the case. Fonts
> are subset embedded by default unless the referenced-fonts element is
> present, in which case they are referenced.
>
>
> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>
>> Hi Glenn,
>>
>> Thanks for your reply.
>>
>> In your example, you are embedding the font:
>>
>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the font
>> embedded.
>>
>> I have no problem creating a chinese PDF when the font is embedded.
>>
>> The issue I am raising is when trying to reference (not embed) the font.
>>
>> Thanks for your help,
>>
>> Best regards,
>> JP
>>
>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>>  I just tried this with the font you referenced and had no problem.
>>> Attached is the configuration file and input file I used and resulting
>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>
>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>> notice that I disabled the font cache and placed the font in a "fonts"
>>> subdirectory where I did the test.
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
ok, on digging into this further i have found:

(1) luis is correct that embedding is performed by default without the
referenced-fonts element;

(2) in particular, when i add <referenced-fonts><match
font-family="SimSun"/></referenced-fonts> i see the same behavior: glyphs
not found; when i remove, it works fine (and embeds subset);

(3) looking at TTFFontLoader i find the following:

        boolean isCid = this.embedded;
        if (this.encodingMode == EncodingMode.SINGLE_BYTE) {
            isCid = false;
        }

        if (isCid) {
            multiFont = new MultiByteFont();
            returnFont = multiFont;
            multiFont.setTTCName(ttcFontName);
        } else {
            singleFont = new SingleByteFont();
            returnFont = singleFont;
        }

This code assumes that *all* non-embedded fonts are single byte fonts, so
takes the else clause, constructing a SingleByteFont.

Clearly this code is bogus and needs to use other means to determine if the
font is CID keyed or not. In this case, it is CID keyed, and works fine
when embedded is true.

I will open a bug on this.

Thanks Jean-Philippe for your persistence!

On Tue, Apr 24, 2012 at 12:16 PM, Luis Bernardo <lm...@gmail.com>wrote:

>
> Just by itself the embed-url attribute does not imply that the font will
> be embedded. I know that the attribute name is confusing, and the
> documentation may not be up to date, but I believe that is the case. Fonts
> are subset embedded by default unless the referenced-fonts element is
> present, in which case they are referenced.
>
>
> On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
>
>> Hi Glenn,
>>
>> Thanks for your reply.
>>
>> In your example, you are embedding the font:
>>
>>  <font embed-url="simsun.ttf">  the embed-url attribute will get the font
>> embedded.
>>
>> I have no problem creating a chinese PDF when the font is embedded.
>>
>> The issue I am raising is when trying to reference (not embed) the font.
>>
>> Thanks for your help,
>>
>> Best regards,
>> JP
>>
>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>>  I just tried this with the font you referenced and had no problem.
>>> Attached is the configuration file and input file I used and resulting
>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>>
>>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you
>>> notice that I disabled the font cache and placed the font in a "fonts"
>>> subdirectory where I did the test.
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
>> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Luis Bernardo <lm...@gmail.com>.
Just by itself the embed-url attribute does not imply that the font will 
be embedded. I know that the attribute name is confusing, and the 
documentation may not be up to date, but I believe that is the case. 
Fonts are subset embedded by default unless the referenced-fonts element 
is present, in which case they are referenced.

On 4/24/12 4:15 PM, Jean-Philippe Courson wrote:
> Hi Glenn,
>
> Thanks for your reply.
>
> In your example, you are embedding the font:
>
>   <font embed-url="simsun.ttf">  the embed-url attribute will get the font embedded.
>
> I have no problem creating a chinese PDF when the font is embedded.
>
> The issue I am raising is when trying to reference (not embed) the font.
>
> Thanks for your help,
>
> Best regards,
> JP
>
> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>
>> I just tried this with the font you referenced and had no problem. Attached is the configuration file and input file I used and resulting output. I'm using the current FOP 1.1dev (trunk) build.
>>
>> As Chris points out, you may wish to avoid<auto-detect/>. Also, you notice that I disabled the font cache and placed the font in a "fonts" subdirectory where I did the test.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


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


Re: Chinese PDFs and non embedded fonts

Posted by mehdi houshmand <me...@gmail.com>.
Hi,

Unless you know this specific font is embeddable (which I don't), that's
not ubiquitously true. There is a flag in the font program which indicates
whether it is embeddable or not [1]. If you open it an font viewer, it
should tell you the restrictions set.

[1] http://www.microsoft.com/typography/otspec/os2.htm#fst

Mehdi

On 24 April 2012 16:57, Glenn Adams <gl...@skynav.com> wrote:

> I notice at [1] that editable embedding is allowed. Note that FOP does not
> embed the entire font, but only those glyphs used in the document. I would
> be surprised if you were subject to redistribution licensing costs given
> this situation.
>
> [1] http://www.microsoft.com/typography/fonts/font.aspx?FM ID=1802<http://www.microsoft.com/typography/fonts/font.aspx?FMID=1802>
>
>
> On Tue, Apr 24, 2012 at 9:46 AM, Jean-Philippe Courson <
> jean-philippe.courson@cognitran.com> wrote:
>
>> Hi Glenn,
>>
>> I don't want to embed the fonts to avoid significant font redistribution
>> licensing costs.
>>
>> The produced PDFs will be distributed to people having the fonts
>> installed on their machine.
>>
>> Thanks for your help
>>
>> Best regards,
>> JP
>>
>> On 24 Apr 2012, at 16:28, Glenn Adams wrote:
>>
>> why do you *not* want to embed? note that only the actually used glyphs
>> will be embedded in a subset font, so size should not be an issue
>>
>> On Tue, Apr 24, 2012 at 9:15 AM, Jean-Philippe Courson <
>> jean-philippe.courson@cognitran.com> wrote:
>>
>>> Hi Glenn,
>>>
>>> Thanks for your reply.
>>>
>>> In your example, you are embedding the font:
>>>
>>>  <font embed-url="simsun.ttf"> the embed-url attribute will get the font
>>> embedded.
>>>
>>> I have no problem creating a chinese PDF when the font is embedded.
>>>
>>> The issue I am raising is when trying to reference (not embed) the font.
>>>
>>> Thanks for your help,
>>>
>>> Best regards,
>>> JP
>>>
>>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>>
>>> > I just tried this with the font you referenced and had no problem.
>>> Attached is the configuration file and input file I used and resulting
>>> output. I'm using the current FOP 1.1dev (trunk) build.
>>> >
>>> > As Chris points out, you may wish to avoid <auto-detect/>. Also, you
>>> notice that I disabled the font cache and placed the font in a "fonts"
>>> subdirectory where I did the test.
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>>
>>>
>>
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
two more suggestions:

(1) remove the first <fonts> element (containing the referenced fonts
element)
(2) use a current FOP 1.1dev (trunk) build [1]

[1] http://ci.apache.org/projects/xmlgraphics/fop/snapshots/

On Tue, Apr 24, 2012 at 10:30 AM, Jean-Philippe Courson <
jean-philippe.courson@cognitran.com> wrote:

> Just tried, same result.
>
> <?xml version="1.0"?>
> <fop version="1.0">
>   <use-cache>false</use-cache>
>   <base>.</base>
>
>   <fonts>
>     <referenced-fonts>
>       <match font-family=".*"/>
>     </referenced-fonts>
>   </fonts>
>   <renderers>
>     <renderer mime="application/pdf">
>       <filterList>
>         <value>flate</value>
>       </filterList>
>       <fonts>
>         <directory>./fonts</directory>
>       </fonts>
>     </renderer>
>   </renderers>
> </fop>
>
> ~/Downloads/fop-1.0/test$ ls fonts/
> SimSun.ttf
>
> ~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c
> configuration-referenced-with-directory-element.xml
> output-referenced-with-directory-element.pdf
> Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener
> processEvent
>
> WARNING: Glyph "仅" (0x4ec5) not available in font "SimSun".
> Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener
> processEvent
>
> WARNING: Glyph "供" (0x4f9b) not available in font "SimSun".
> Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener
> processEvent
>
> WARNING: Glyph "参" (0x53c2) not available in font "SimSun".
> Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener
> processEvent
>
> WARNING: Glyph "考" (0x8003) not available in font "SimSun".
>
> Regards,
> JP
>
>
>
>
>
> On 24 Apr 2012, at 17:09, Glenn Adams wrote:
>
> btw, have you tried using the <directory/> element without the
> <auto-detect/> element? e.g.
>
> <fonts>
>   <directory>./fonts-to-reference-without-embedding</directory>
> </fonts>
>
> this allows you to restrict the set of fonts to be accessed for reference
> only (non-embedded) use
>
> On Tue, Apr 24, 2012 at 9:57 AM, Glenn Adams <gl...@skynav.com> wrote:
>
>> I notice at [1] that editable embedding is allowed. Note that FOP does
>> not embed the entire font, but only those glyphs used in the document. I
>> would be surprised if you were subject to redistribution licensing costs
>> given this situation.
>>
>> [1] http://www.microsoft.com/typography/fonts/font.aspx?FMID=1802
>>
>>
>> On Tue, Apr 24, 2012 at 9:46 AM, Jean-Philippe Courson <
>> jean-philippe.courson@cognitran.com> wrote:
>>
>>> Hi Glenn,
>>>
>>> I don't want to embed the fonts to avoid significant font redistribution
>>> licensing costs.
>>>
>>> The produced PDFs will be distributed to people having the fonts
>>> installed on their machine.
>>>
>>> Thanks for your help
>>>
>>
>
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Just tried, same result.

<?xml version="1.0"?>
<fop version="1.0">
  <use-cache>false</use-cache>
  <base>.</base>
  <fonts>
    <referenced-fonts>
      <match font-family=".*"/>
    </referenced-fonts>
  </fonts>
  <renderers>
    <renderer mime="application/pdf">
      <filterList>
        <value>flate</value>
      </filterList>
      <fonts>
        <directory>./fonts</directory>
      </fonts>
    </renderer>
  </renderers>
</fop>

~/Downloads/fop-1.0/test$ ls fonts/
SimSun.ttf

~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-referenced-with-directory-element.xml output-referenced-with-directory-element.pdf
Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "仅" (0x4ec5) not available in font "SimSun".
Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "供" (0x4f9b) not available in font "SimSun".
Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "参" (0x53c2) not available in font "SimSun".
Apr 24, 2012 5:27:33 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "考" (0x8003) not available in font "SimSun".

Regards,
JP


On 24 Apr 2012, at 17:09, Glenn Adams wrote:

> btw, have you tried using the <directory/> element without the <auto-detect/> element? e.g.
> 
> <fonts>
>   <directory>./fonts-to-reference-without-embedding</directory>
> </fonts>
> 
> this allows you to restrict the set of fonts to be accessed for reference only (non-embedded) use
> 
> On Tue, Apr 24, 2012 at 9:57 AM, Glenn Adams <gl...@skynav.com> wrote:
> I notice at [1] that editable embedding is allowed. Note that FOP does not embed the entire font, but only those glyphs used in the document. I would be surprised if you were subject to redistribution licensing costs given this situation.
> 
> [1] http://www.microsoft.com/typography/fonts/font.aspx?FMID=1802
> 
> 
> On Tue, Apr 24, 2012 at 9:46 AM, Jean-Philippe Courson <je...@cognitran.com> wrote:
> Hi Glenn,
> 
> I don't want to embed the fonts to avoid significant font redistribution licensing costs.
> 
> The produced PDFs will be distributed to people having the fonts installed on their machine. 
> 
> Thanks for your help
> 


Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
btw, have you tried using the <directory/> element without the
<auto-detect/> element? e.g.

<fonts>
  <directory>./fonts-to-reference-without-embedding</directory>
</fonts>

this allows you to restrict the set of fonts to be accessed for reference
only (non-embedded) use

On Tue, Apr 24, 2012 at 9:57 AM, Glenn Adams <gl...@skynav.com> wrote:

> I notice at [1] that editable embedding is allowed. Note that FOP does not
> embed the entire font, but only those glyphs used in the document. I would
> be surprised if you were subject to redistribution licensing costs given
> this situation.
>
> [1] http://www.microsoft.com/typography/fonts/font.aspx?FMID=1802
>
>
> On Tue, Apr 24, 2012 at 9:46 AM, Jean-Philippe Courson <
> jean-philippe.courson@cognitran.com> wrote:
>
>> Hi Glenn,
>>
>> I don't want to embed the fonts to avoid significant font redistribution
>> licensing costs.
>>
>> The produced PDFs will be distributed to people having the fonts
>> installed on their machine.
>>
>> Thanks for your help
>>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
I notice at [1] that editable embedding is allowed. Note that FOP does not
embed the entire font, but only those glyphs used in the document. I would
be surprised if you were subject to redistribution licensing costs given
this situation.

[1] http://www.microsoft.com/typography/fonts/font.aspx?FMID=1802

On Tue, Apr 24, 2012 at 9:46 AM, Jean-Philippe Courson <
jean-philippe.courson@cognitran.com> wrote:

> Hi Glenn,
>
> I don't want to embed the fonts to avoid significant font redistribution
> licensing costs.
>
> The produced PDFs will be distributed to people having the fonts installed
> on their machine.
>
> Thanks for your help
>
> Best regards,
> JP
>
> On 24 Apr 2012, at 16:28, Glenn Adams wrote:
>
> why do you *not* want to embed? note that only the actually used glyphs
> will be embedded in a subset font, so size should not be an issue
>
> On Tue, Apr 24, 2012 at 9:15 AM, Jean-Philippe Courson <
> jean-philippe.courson@cognitran.com> wrote:
>
>> Hi Glenn,
>>
>> Thanks for your reply.
>>
>> In your example, you are embedding the font:
>>
>>  <font embed-url="simsun.ttf"> the embed-url attribute will get the font
>> embedded.
>>
>> I have no problem creating a chinese PDF when the font is embedded.
>>
>> The issue I am raising is when trying to reference (not embed) the font.
>>
>> Thanks for your help,
>>
>> Best regards,
>> JP
>>
>> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>> > I just tried this with the font you referenced and had no problem.
>> Attached is the configuration file and input file I used and resulting
>> output. I'm using the current FOP 1.1dev (trunk) build.
>> >
>> > As Chris points out, you may wish to avoid <auto-detect/>. Also, you
>> notice that I disabled the font cache and placed the font in a "fonts"
>> subdirectory where I did the test.
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Sergiu Dumitriu <se...@xwiki.com>.
On 04/24/2012 11:46 AM, Jean-Philippe Courson wrote:
> Hi Glenn,
>
> I don't want to embed the fonts to avoid significant font redistribution
> licensing costs.
>
> The produced PDFs will be distributed to people having the fonts
> installed on their machine.

Is that particular font a hard requirement, or could you use a free font 
such as http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download ?

> Thanks for your help
>
> Best regards,
> JP
>
> On 24 Apr 2012, at 16:28, Glenn Adams wrote:
>
>> why do you *not* want to embed? note that only the actually used
>> glyphs will be embedded in a subset font, so size should not be an issue
>>
>> On Tue, Apr 24, 2012 at 9:15 AM, Jean-Philippe Courson
>> <jean-philippe.courson@cognitran.com
>> <ma...@cognitran.com>> wrote:
>>
>>     Hi Glenn,
>>
>>     Thanks for your reply.
>>
>>     In your example, you are embedding the font:
>>
>>     <font embed-url="simsun.ttf"> the embed-url attribute will get the
>>     font embedded.
>>
>>     I have no problem creating a chinese PDF when the font is embedded.
>>
>>     The issue I am raising is when trying to reference (not embed) the
>>     font.
>>
>>     Thanks for your help,
>>
>>     Best regards,
>>     JP
>>
>>     On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>>
>>     > I just tried this with the font you referenced and had no
>>     problem. Attached is the configuration file and input file I used
>>     and resulting output. I'm using the current FOP 1.1dev (trunk) build.
>>     >
>>     > As Chris points out, you may wish to avoid <auto-detect/>. Also,
>>     you notice that I disabled the font cache and placed the font in a
>>     "fonts" subdirectory where I did the test.
>>     >


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/

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


Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Hi Glenn,

I don't want to embed the fonts to avoid significant font redistribution licensing costs.

The produced PDFs will be distributed to people having the fonts installed on their machine. 

Thanks for your help

Best regards,
JP

On 24 Apr 2012, at 16:28, Glenn Adams wrote:

> why do you *not* want to embed? note that only the actually used glyphs will be embedded in a subset font, so size should not be an issue
> 
> On Tue, Apr 24, 2012 at 9:15 AM, Jean-Philippe Courson <je...@cognitran.com> wrote:
> Hi Glenn,
> 
> Thanks for your reply.
> 
> In your example, you are embedding the font:
> 
>  <font embed-url="simsun.ttf"> the embed-url attribute will get the font embedded.
> 
> I have no problem creating a chinese PDF when the font is embedded.
> 
> The issue I am raising is when trying to reference (not embed) the font.
> 
> Thanks for your help,
> 
> Best regards,
> JP
> 
> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
> 
> > I just tried this with the font you referenced and had no problem. Attached is the configuration file and input file I used and resulting output. I'm using the current FOP 1.1dev (trunk) build.
> >
> > As Chris points out, you may wish to avoid <auto-detect/>. Also, you notice that I disabled the font cache and placed the font in a "fonts" subdirectory where I did the test.
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 


Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
why do you *not* want to embed? note that only the actually used glyphs
will be embedded in a subset font, so size should not be an issue

On Tue, Apr 24, 2012 at 9:15 AM, Jean-Philippe Courson <
jean-philippe.courson@cognitran.com> wrote:

> Hi Glenn,
>
> Thanks for your reply.
>
> In your example, you are embedding the font:
>
>  <font embed-url="simsun.ttf"> the embed-url attribute will get the font
> embedded.
>
> I have no problem creating a chinese PDF when the font is embedded.
>
> The issue I am raising is when trying to reference (not embed) the font.
>
> Thanks for your help,
>
> Best regards,
> JP
>
> On 23 Apr 2012, at 15:26, Glenn Adams wrote:
>
> > I just tried this with the font you referenced and had no problem.
> Attached is the configuration file and input file I used and resulting
> output. I'm using the current FOP 1.1dev (trunk) build.
> >
> > As Chris points out, you may wish to avoid <auto-detect/>. Also, you
> notice that I disabled the font cache and placed the font in a "fonts"
> subdirectory where I did the test.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Hi Glenn,

Thanks for your reply.

In your example, you are embedding the font:

 <font embed-url="simsun.ttf"> the embed-url attribute will get the font embedded.

I have no problem creating a chinese PDF when the font is embedded.

The issue I am raising is when trying to reference (not embed) the font.

Thanks for your help,

Best regards,
JP

On 23 Apr 2012, at 15:26, Glenn Adams wrote:

> I just tried this with the font you referenced and had no problem. Attached is the configuration file and input file I used and resulting output. I'm using the current FOP 1.1dev (trunk) build.
> 
> As Chris points out, you may wish to avoid <auto-detect/>. Also, you notice that I disabled the font cache and placed the font in a "fonts" subdirectory where I did the test.
> 


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


Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
with attachments

On Mon, Apr 23, 2012 at 8:26 AM, Glenn Adams <gl...@skynav.com> wrote:

> I just tried this with the font you referenced and had no problem.
> Attached is the configuration file and input file I used and resulting
> output. I'm using the current FOP 1.1dev (trunk) build.
>
> As Chris points out, you may wish to avoid <auto-detect/>. Also, you
> notice that I disabled the font cache and placed the font in a "fonts"
> subdirectory where I did the test.
>
>

Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
I just tried this with the font you referenced and had no problem. Attached
is the configuration file and input file I used and resulting output. I'm
using the current FOP 1.1dev (trunk) build.

As Chris points out, you may wish to avoid <auto-detect/>. Also, you notice
that I disabled the font cache and placed the font in a "fonts"
subdirectory where I did the test.

Re: Chinese PDFs and non embedded fonts

Posted by Jean-Philippe Courson <je...@cognitran.com>.
Hi all,

Thank you for your replies.

Please find attached a sample FO file highlighting the issue and 2 configuration files: one embedding the font, and another one referencing it.

I attached as well a small JAVA program I use to verify that the font is correctly installed.  

For testing purpose, you can download the SimSun font from http://jumal.is.free.fr/SimSun.ttf. 

1) I verify that the font is correctly installed:

~/Downloads/fop-1.0/test$ java AvailableFonts | grep SimSun
SimSun
java.awt.Font[family=SimSun,name=SimSun,style=plain,size=1]

2) I generate a PDF embedding the font:

~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-embedded.xml output-embedded.pdf
Apr 23, 2012 1:49:38 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-height set to: 11in
Apr 23, 2012 1:49:38 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-width set to: 8.26in

The PDF produced is OK: Hello 仅供参考

3) I generate a PDF, using the same FO file, referencing the font:

~/Downloads/fop-1.0/test$ ../fop -fo test-fo.xml -c configuration-referenced.xml output-referenced.pdf
Apr 23, 2012 1:49:52 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-height set to: 11in
Apr 23, 2012 1:49:52 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-width set to: 8.26in
Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "仅" (0x4ec5) not available in font "SimSun".
Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "供" (0x4f9b) not available in font "SimSun".
Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "参" (0x53c2) not available in font "SimSun".
Apr 23, 2012 1:49:55 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "考" (0x8003) not available in font "SimSun".

FOP issues warnings telling that the glyphs are not available for the font (I just saw this warning making this example),  and the PDF produced is having all glyphs replaced with '#': Hello ####

Am I doing something wrong with the configuration or is this issue due a FOP limitation or bug?

Thank you all in advance for your help

Best regards,
JP


Re: Chinese PDFs and non embedded fonts

Posted by Chris Bowditch <bo...@hotmail.com>.
On 20/04/2012 18:54, Glenn Adams wrote:

Hi Glenn,
>
> it is best you create a bug at [1] to track this; you can upload 
> attachments on the new bug; file it under the "Fop" product;

I'm not happy to encourage users on this list to open bugs before 
confirming there is a defect.

Everything I've read on this thread so far suggests this is a 
configuration issue. Metrics files are deprecated in FOP v1.0+

How to reference instead of embed is to add the embed-url attribute on 
the fonts elements and use the <referenced-fonts> element as described 
in [1]

Thanks,

Chris

[1] http://xmlgraphics.apache.org/fop/trunk/fonts.html#embedding

>
> [1] https://issues.apache.org/bugzilla/
>
> On Fri, Apr 20, 2012 at 5:55 AM, Jean-Philippe Courson 
> <jean-philippe.courson@cognitran.com 
> <ma...@cognitran.com>> wrote:
>
>     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:
>     fop-users-unsubscribe@xmlgraphics.apache.org
>     <ma...@xmlgraphics.apache.org>
>     For additional commands, e-mail:
>     fop-users-help@xmlgraphics.apache.org
>     <ma...@xmlgraphics.apache.org>
>
>


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


Re: Chinese PDFs and non embedded fonts

Posted by Glenn Adams <gl...@skynav.com>.
please provide the following info:

(1) version of FOP you are using and platform on which you are running it
(2) a maximally minimal input FO file that demonstrates your problem
(3) the output PDF file produced by this input file (1)
(4) the FOP xconf file you used to create (3)
(5) all console output

a maximally minimal input file is one which is (1) complete, (2)
demonstrates the problem, and (3) for which nothing else can be removed
without affecting (1) or (2)

it is best you create a bug at [1] to track this; you can upload
attachments on the new bug; file it under the "Fop" product;

[1] https://issues.apache.org/bugzilla/

On Fri, Apr 20, 2012 at 5:55 AM, Jean-Philippe Courson <
jean-philippe.courson@cognitran.com> wrote:

> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>