I'm using FOP to generate PDF reports. The problem is I need the DIN开发者_运维知识库-Regular font instead of the default Times New Roman. Can anybody tall me how to change the font? I'm using fop-0.94.boc.02 version. Thanks
All you have to do is register the font and it's location in your config file, fop.xconf.
Like so:
<fonts>
<directory>/usr/share/fonts/TTF</directory>
<font-triplet name="DIN-Regular" style="normal" weight="bold"/>
(...)
</fonts>
In your FOP code you should refer the font like so:
<fo:block font-size="11.5pt" font-family="DIN-Regular"> Content
</fo:block>
Currently FOP supports only TrueType fonts correctly, I think.
You also have to take a look at the style of the font, in order to include it in your triplet. Do this by opening and investigating your font.
Make sure to include -c fop.xconf when you call fop and you should be good to go!
精彩评论