Odoo Help


How to use custom fonts in RML reports?

Martin Trigaux (mat)
on 12/19/14, 5:03 AM 4,460 views

To print report in Chinese or Comic Sans MS

This question has been included in the official documentation.

Martin Trigaux (mat)

--Martin Trigaux (mat)--
Martin Trigaux (mat)
| 6 4 7
Grand Rosiere, Belgium
--Martin Trigaux (mat)--

Community manager: help with the code and translations contributions from the community on GitHub and Transifex.

Developed the gamification module and is also now responsible of the documentation and Point of Sale.

Martin Trigaux (mat)
On 12/19/14, 5:05 AM

Some languages (e.g. Chinese) needs different charset not supported by classic fonts (or you just want Comic Sans MS in your reports). Good news, you can use custom TTF fonts. For Chinese, we make it easier for Sun-ExtA but you can use any TTF font,

Version 7.0


The list of available fonts is hardcoded in CustomTTFontsvariable in openerp/report/render/rml2pdf/customfonts.py. If you want to add another font than DejaVu Sans, Liberation Serif, FreeMono or Sun-ExtA, you will need to modify the source file to add the font in the format:

('family name', 'font name', 'ttf file name', 'mode')
  • family name: the name of font interpreted by reportlab (e.g. check with FontForge Element > Font Info)
  • font name: what should be put in your rml file. Family name can common between several fonts while font name should be unique (e.g. "DejaVu Sans" vs "DejaVu Sans Bold")
  • file name: just the name of your ttf file, not the full patch
  • mode: one between normal, italic, oblique, bold, bolditalic, bold italic, boldoblique, bold oblique or all

Careful: the font and file names are case sensitive !!!

To be discovered by odoo, your font should be in one of these folders

  • the search folders defined in reportlab library, variable TTFSearchPath (e.g.~/.fonts on linux, check /usr/lib/python2.7/site-packages/reportlab/rl_settings.py for full list)

When rendering a report, check your logs (debug mode helps) for warning or info message about fonts not found. Restarting your odoo server after installing a font may help.

To use your font on every report modify the RML Header of your company (Settings > Companies > Header/Footer) and change and locate the fontName="DejaVu Sans" or setFont name="DejaVu Sans" to replace by the font name you wish to use.

This will only modify global settings, if you have font specified inside the rml reports, you will also need to modify these one !


Version 8.0

No more needed to modify python files ! Well actually no more need to do RML reports in v8 but still possible.

You still need to install the custom font in one of the searched folder (see above).

Go to Settings > Companies > Report Configuration and hit the reload fonts button to populate the many2one (by default empty). odoo will scan all the fonts installed on your system. Selecting one will modify the company headers to use it globally.


Let me add one note: the installed should be .ttf format. .ttc will not be scanned or listed. e.g ttf-wqy-microhei which is popularly used for chinese, has the ttc extension by default. To fix it, just rename the ttc extension to ttf will do the trick~

on 12/19/14, 10:24 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 12/19/14, 5:03 AM
Seen: 4460 times
Last updated: 3/10/16, 3:54 PM