diff --git a/openerp/addons/base/res/res_font.py b/openerp/addons/base/res/res_font.py index 306a8944783..47e49bf4d39 100644 --- a/openerp/addons/base/res/res_font.py +++ b/openerp/addons/base/res/res_font.py @@ -81,6 +81,15 @@ class res_font(osv.Model): font = ttfonts.TTFontFile(font_path) _logger.debug("Found font %s at %s", font.name, font_path) found_fonts.append((font.familyName, font.name, font_path, font.styleName)) + except KeyError, ex: + if ex.args and ex.args[0] == 'head': + # Sometimes, the system can have a lot of Bitmap fonts, and + # in this case, Reportlab can't load the 'head' table from + # the structure of the TTF file (ex: NISC18030.ttf) + # In this case, we have to bypass the loading of this font! + _logger.warning("Could not register Fond %s (Old Bitmap font)", font_path) + else: + raise except ttfonts.TTFError: _logger.warning("Could not register Font %s", font_path) @@ -112,4 +121,4 @@ class res_font(osv.Model): def clear_caches(self): """Force worker to resync at next report loading by setting an empty font list""" customfonts.CustomTTFonts = [] - return super(res_font, self).clear_caches() \ No newline at end of file + return super(res_font, self).clear_caches()