def extractT1FontInfo(font): info = RInfo() src = font.font['FontInfo'] factor = font.font['FontMatrix'][0] assert factor > 0 info.unitsPerEm = int(round(1/factor, 0)) # assume something for ascender descender info.ascender = (info.unitsPerEm / 5) * 4 info.descender = info.ascender - info.unitsPerEm info.versionMajor = font.font['FontInfo']['version'] info.fullName = font.font['FontInfo']['FullName'] info.familyName = font.font['FontInfo']['FullName'].split("-")[0] info.notice = unicode(font.font['FontInfo']['Notice'], "macroman") info.italicAngle = font.font['FontInfo']['ItalicAngle'] info.uniqueID = font['UniqueID'] return info
def extractT1FontInfo(font): info = RInfo() src = font.font['FontInfo'] factor = font.font['FontMatrix'][0] assert factor > 0 info.unitsPerEm = int(round(1 / factor, 0)) # assume something for ascender descender info.ascender = (info.unitsPerEm / 5) * 4 info.descender = info.ascender - info.unitsPerEm info.versionMajor = font.font['FontInfo']['version'] info.fullName = font.font['FontInfo']['FullName'] info.familyName = font.font['FontInfo']['FullName'].split("-")[0] info.notice = unicode(font.font['FontInfo']['Notice'], "macroman") info.italicAngle = font.font['FontInfo']['ItalicAngle'] info.uniqueID = font['UniqueID'] return info