Jacopo,

Currently I have no own suggestions but let me attract your attention to these quotations:

6.2. Some characters are not displayed, or displayed incorrectly, or displayed as “#”. This usually means the selected font doesn't have a glyph for the character. The standard text fonts supplied with Acrobat Reader have mostly glyphs for characters from the ISO Latin 1 character set. For a variety of reasons, even those are not completely guaranteed to work, for example you can't use the fi ligature from the standard serif font. Check the overview for the default PDF fonts.

If you use your own fonts, the font must have a glyph for the desired character. Furthermore the font must be available on the machine where the PDF is viewed or it must have been embedded in the PDF file. See embedding fonts.

For most symbols, it is better to select the symbol font explicitely, for example in order to get the symbol for the mathematical empty set, write:
<fo:inline font-family="Symbol">&#x2205;</fo:inline>
The "#" shows up if the selected font does not define a glyph for the required character, for example if you try:
<fo:inline font-family="Helvetica">&#x2205;</fo:inline>

and


The "Symbol" and "ZapfDingbats" fonts, however, currently present a problem because FOP cannot correctly determine the encoding of these two single-byte fonts through the PFM file. FOP now correctly interprets the "encoding" value in the XML font metrics file, but the PFMReader application writes "UnknownEncoding" to the generated XML file. In order to embed "Symbol" and "ZapfDingbats" you have to manually change the XML font metrics file and specify "SymbolEncoding" or "ZapfdingbatsEncoding" encoding respectively as the value for the "encoding" element.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<font-metrics type="TYPE1">
<font-name>Symbol</font-name>
<embed/>
<encoding>SymbolEncoding</encoding>
<cap-height>673</cap-height>
<x-height>766</x-height>

I will try reproduce this problem and work on it but I really don't know when.



Jacopo Cappellato пишет:
Oleg,

first of all, thanks for your notes.
I did what you have suggested (even if I just created the "normal" Arial font metrics, not the ones for bold and italics); now I can see in the PDF two small boxes instead of the ## characters... unfortunately I still can't see ideograms :-(

Do you have any ideas about this issue?

Jacopo

Oleg Andreyev wrote:
Jacopo Cappellato пишет:
Hi all,

I know this is not probably an OFBiz related issue but I know that we have several Chinese users and maybe this can be of interest for others... I'm having issues displaying Chinese characters in the OFBiz PDF reports (invoice, order etc...) created with xsl-fo: they appear as '####'.
Of course. Currently Ofbiz printing subsystem doesn't work if document uses any charsets out Latin-1. (May be work for localized readers).
I did some research in the Internet and the problem seems related to the font family used that doesn't include the Chinese fonts. I have tried to set a different font-family in the template's fo:root element, but unfortunately I couldn't find a font family that supports the Chinese characters (e.g. I've tried with Arial in an Ubuntu box).

I was searching in Google and seen many links to free Chinese fonts but if you will try use font-family that have required characters the result will be the same. You have to embed used fonts to pdf.
I've also found some instructions on how to generate an ad-hoc xml file with the necessary font family description, to be embedded in the pdf reports by FOP... but the steps were not very clear to me (especially, how to map them to the OFBiz framework).

Any hints on how I can solve this issue?
Steps below apply to cyrillic fonts, but I hope Chinese too.
1. Create FOP config file. Ready for use one attached to https://issues.apache.org/jira/browse/OFBIZ-1110. 2. Create font metrics for given font. (http://xmlgraphics.apache.org/fop/0.93/fonts.html)
3. Place fonts and metrics to framework/widget/config
4. Add to fop.xconf font triplets
Example from my config

<renderer mime="application/pdf">
<fonts>
<font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
<font metrics-url="arialbd.xml" kerning="yes" embed-url="arialbd.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
<font metrics-url="ariali.xml" kerning="yes" embed-url="ariali.ttf">
<font-triplet name="Arial" style="italic" weight="normal"/>
<font-triplet name="ArialMT" style="italic" weight="normal"/>
</font>
<font metrics-url="arialbi.xml" kerning="yes" embed-url="arialbi.ttf">
<font-triplet name="Arial" style="italic" weight="bold"/>
<font-triplet name="ArialMT" style="italic" weight="bold"/>
</font>
</fonts>
</renderer>
5. Modify fo.ftl to use font-family="Arial"

Oleg





Reply via email to