xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bowditch <bowditch_ch...@hotmail.com>
Subject Re: Chinese PDFs and non embedded fonts
Date Mon, 23 Apr 2012 14:19:34 GMT
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<jean-philippe.courson@cognitran.com<mailto: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
>>>     <mailto:fop-users-unsubscribe@xmlgraphics.apache.org>
>>>     For additional commands, e-mail:
>>>     fop-users-help@xmlgraphics.apache.org
>>>     <mailto: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


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


Mime
View raw message