Embedded font don't work in Apache FOP

2019-09-05 04:48发布

问题:

I am using FOP to tranform xml to pdf, and I need to use Chinese characters.I did do something to use Chinese font,but it seems don't work at all. I create the font xml file.

and registered in the fop.xconf

<font metrics-url="/home/zhufree/Tools/fop-2.1/conf/simkai.xml" kerning="yes" embed-url="/home/zhufree/Tools/fop-2.1/conf/kaiti.ttf">
   <font-triplet name="simkai" style="normal" weight="normal" />
   <font-triplet name="simkai" style="normal" weight="bold" />
   <font-triplet name="simkai" style="italic" weight="normal" />
   <font-triplet name="simkai" style="italic" weight="bold" />
</font>

the font xml file and font ttf file are in the same directory with fop.xconf,when I try to transform,it still show me cant find the font.

What should I do to show the Chinese character?

Update: I solved the problem by using specific configuration file in java code, and it worked well.Thanks.