[FIX] rml2pdf : fix loading of font where mode are not strict. Now we compare always a lower and with serveral mode similar. That fix the usage of some font in report where accent and bold was ignored

bzr revid: jke@openerp.com-20140401094556-h1ybpqf989qt5h60
This commit is contained in:
Kersten Jeremy 2014-04-01 11:45:56 +02:00
parent 328ea17625
commit c65ae9f055
1 changed files with 7 additions and 4 deletions

View File

@ -283,6 +283,9 @@ class _rml_doc(object):
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
if mode:
mode = mode.lower()
if fontname not in pdfmetrics._fonts:
pdfmetrics.registerFont(TTFont(fontname, filename))
if mode == 'all':
@ -290,14 +293,14 @@ class _rml_doc(object):
addMapping(face, 0, 1, fontname) #italic
addMapping(face, 1, 0, fontname) #bold
addMapping(face, 1, 1, fontname) #italic and bold
elif (mode== 'normal') or (mode == 'regular') or (mode == 'book'):
addMapping(face, 0, 0, fontname) #normal
elif mode == 'italic':
elif mode in ['italic', 'oblique']:
addMapping(face, 0, 1, fontname) #italic
elif mode == 'bold':
addMapping(face, 1, 0, fontname) #bold
elif mode == 'bolditalic':
elif mode in ('bolditalic', 'bold italic','boldoblique', 'bold oblique'):
addMapping(face, 1, 1, fontname) #italic and bold
else:
addMapping(face, 0, 0, fontname) #normal
def _textual_image(self, node):
rc = ''