As example we use example.ttf as the truetype font we want to install on our system. And use in an RML report within OpenERP.
Installing the font on your system
First you need to install your font on the server. If you use Ubuntu you can use the following commands to do this:
make a directory in the /usr/share/fonts/truetype folder for your custom fonts
cd /usr/share/fonts/truetype/ mkdir example
Change to the new folder and copy your file to this location
cd example cp example.ttf ./
update the font cache of your system
Enable the custom fonts
Open the customfonts.py file of your OpenERP Server (if you followed my installation of openerp from launchpad the location will be: /opt/openerp/server/openerp/report/render/rml2pdf/customfonts.py.
Add a new line to the CustomTTFonts list:
The ‘all’ part of the tuple has different options. You may also use ‘normal’ , ‘bold’, ‘italic’, ‘bolditalic’.
Using the font in a RML based report
You can now use the custom font in your RML reports. Just use the name you have chosen. The paraStyle will show someting like:
<paraStyle name="default_8" fontName="example" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>