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