trml2pdf: Fix using of custom fonts in reports

That snippet of code practically meant "don't use anything but the
standard fonts (by name) in the report". It obviously wanted to prevent the
rml2pdf engine from crashing at a non-existent font.
Well, if the report specifies a font that cannot be mapped by the system,
it should preferably raise an exception (and ask us to fix the report), not
silently ignore the font.
Case 1: the internationalized reports, where font name is used to select a
Unicode-capable font.
Case 2: l10n_ch, where the OCR-B font had to be used (perhaps legal req.)

bzr revid: p_christ@hol.gr-20101123152002-es404ul29rsohzqd
This commit is contained in:
P. Christeas 2010-11-23 17:20:02 +02:00
parent 6e893f1e9e
commit 3e3270264f
1 changed files with 0 additions and 4 deletions

View File

@ -485,11 +485,7 @@ class _rml_canvas(object):
self.canvas.drawPath(self.path, **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'}))
def setFont(self, node):
from reportlab.pdfbase import pdfmetrics
fname = node.get('name')
#TODO : other fonts should be supported
if fname not in pdfmetrics.standardFonts:
fname = self.canvas._fontname
return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
def render(self, node):