Hi guys,
Has anybody had any succes adding a custom font to a QWeb report?
My initial idea was to add a CSS file that references the font file but that doesn't seem to work. In my module I've made static/src/css and added a file mylayout.css. In this file I've added the following:
@font-face { font-family: cool_font; src: url('nexa.otf'); } h1 { font-family:cool_font; color:blue; text-align:center; }
I've added the CSS file to my __openerp__.py:
# any module necessary for this one to work correctly 'depends': ['sale','project','product'], 'css':'static/src/css/usentric.css', 'data': [ # 'security/ir.model.access.csv', 'linker_report.xml', 'views/report_saleorder_expand.xml', 'templates.xml', #This creates the default items in the model sale.order.printorder, so we don't ever have to create it manually. 'defaultdata.xml', 'security/ir.model.access.csv', ], # only loaded in demonstration mode 'demo': [ 'demo.xml', ],
But doing so did not change anything to my report. Neither the font is used and neither is the color applied. So then I decided to give it a try with inline css (style). My code:
<h1 style="font-family:cool_font; src:url('nexa.otf');">This is to test my custom font.</h1>
But this doesn't work either. I've added the .otf file on the same level as the XML report file. I'm 100% sure the code works because I've tested this in a basic HTML page and the font is rendered.
So, what am I missing / doing wrong and has anybody got this working?
Thanks,
Yenthe
@Yenthe, Can you please answer this query of mine. Thanks. https://www.odoo.com/forum/help-1/question/odoo9c-how-to-add-custom-fonts-to-qweb-reports-104960