[FIX] report, rlm2pdf: added support of Sun-ExtA font and the possibility to define a default value for font parameters in parastyles. We can now use <paraStyle name='Normal fontName='xxxx'/> in company header, for example, if we want to define font xxxx to be used by default in each rml reports (if not overwritten in a further paraStyle)

bzr revid: qdp-launchpad@openerp.com-20130527162051-3e7ztox54vyc8xxc
This commit is contained in:
Quentin (OpenERP) 2013-05-27 18:20:51 +02:00
parent cb21eb3506
commit 968aa44bdf
2 changed files with 9 additions and 4 deletions

View File

@ -57,7 +57,9 @@ CustomTTFonts = [ ('Helvetica',"DejaVu Sans", "DejaVuSans.ttf", 'normal'),
('Courier',"FreeMono", "FreeMono.ttf", 'normal'),
('Courier',"FreeMono Bold", "FreeMonoBold.ttf", 'bold'),
('Courier',"FreeMono Oblique", "FreeMonoOblique.ttf", 'italic'),
('Courier',"FreeMono BoldOblique", "FreeMonoBoldOblique.ttf", 'bolditalic'),]
('Courier',"FreeMono BoldOblique", "FreeMonoBoldOblique.ttf", 'bolditalic'),
('Sun-ExtA',"Sun-ExtA", "sun-exta.ttf", 'normal'),
]
TTFSearchPath_Linux = [

View File

@ -160,9 +160,11 @@ class _rml_styles(object,):
for style in node.findall('paraStyle'):
sname = style.get('name')
self.styles[sname] = self._para_style_update(style)
self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname])
if sname in self.default_style:
for key, value in self.styles[sname].items():
setattr(self.default_style[sname], key, value)
else:
self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname])
for variable in node.findall('initialize'):
for name in variable.findall('name'):
self.names[ name.get('id')] = name.get('value')
@ -269,6 +271,7 @@ class _rml_doc(object):
from reportlab.pdfbase.ttfonts import TTFont
for node in els:
for font in node.findall('registerFont'):
name = font.get('fontName').encode('ascii')
fname = font.get('fontFile').encode('ascii')