~shineit/openerp-china/pdf-font-for-any-language

« back to all changes in this revision

Viewing changes to oecn_base_fonts/oecn_base_fonts_config.py

  • Committer: Tony Gu
  • Date: 2012-01-20 04:19:35 UTC
  • Revision ID: tony@openerp.cn-20120120041935-tadi0nhd49125egi
Font with extention .ttc should also be supported

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        ff.addDirectories( set ( folders ))
52
52
 
53
53
        # get fonts name and file path
 
54
        # ff.search() may resulting error if any AFMFont resided in
 
55
        # the search path has defined width that is not an integer
 
56
        # a dirty workaround:
 
57
        # replace following code around #110 in reportlab.pdfbase.pdfmetrics
 
58
        # From:
 
59
        # width = string.atoi(r)
 
60
        # To:
 
61
        # width = int(float(r))
54
62
        ff.search()
55
63
        for familyName in ff.getFamilyNames():
56
64
            for font in ff.getFontsInFamily(familyName):
57
 
                if font.fileName[-4:].lower() == ".ttf":
 
65
                if font.fileName[-4:].lower() in (".ttf", ".ttc"):
58
66
                    res.append((font.fileName, font.name))
59
67
        return res
60
68