report customFonts: have debugging logs for fonts mapped.
Since this is platform-dependant, it is good to be able to debug if that algorithm worked and located our TTF fonts. bzr revid: p_christ@hol.gr-20101123151124-wk5r5fac00kpu3f4
This commit is contained in:
parent
27ae6f3522
commit
03b4e87cca
|
@ -21,6 +21,7 @@
|
|||
|
||||
from reportlab import rl_config
|
||||
import os
|
||||
import logging
|
||||
|
||||
"""This module allows the mapping of some system-available TTF fonts to
|
||||
the reportlab engine.
|
||||
|
@ -61,6 +62,7 @@ def FindCustomFonts():
|
|||
meanwhile, the server must be restarted eventually.
|
||||
"""
|
||||
dirpath = []
|
||||
log = logging.getLogger('report.fonts')
|
||||
global __foundFonts
|
||||
for dirname in rl_config.TTFSearchPath:
|
||||
abp = os.path.abspath(dirname)
|
||||
|
@ -72,7 +74,7 @@ def FindCustomFonts():
|
|||
continue
|
||||
for d in dirpath:
|
||||
if os.path.exists(os.path.join(d, fname)):
|
||||
# print "found font %s in %s" % (fname, d)
|
||||
log.debug("Found font %s in %s as %s", fname, d, name)
|
||||
__foundFonts.append(fname)
|
||||
break
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import cStringIO
|
|||
import utils
|
||||
import color
|
||||
import os
|
||||
import logging
|
||||
from lxml import etree
|
||||
import base64
|
||||
from reportlab.platypus.doctemplate import ActionFlowable
|
||||
|
@ -909,7 +910,11 @@ def parseNode(rml, localcontext = {},fout=None, images={}, path='.',title=None):
|
|||
try:
|
||||
from customfonts import SetCustomFonts
|
||||
SetCustomFonts(r)
|
||||
except ImportError:
|
||||
# means there is no custom fonts mapping in this system.
|
||||
pass
|
||||
except Exception:
|
||||
logging.getLogger('report').warning('Cannot set font mapping', exc_info=True)
|
||||
pass
|
||||
fp = cStringIO.StringIO()
|
||||
r.render(fp)
|
||||
|
|
Loading…
Reference in New Issue