27 |
27 |
28 def run(): |
28 def run(): |
29 |
29 |
30 buf = [] |
30 buf = [] |
31 buf.append('widthsByUnichar = {}') |
31 buf.append('widthsByUnichar = {}') |
32 for (fontName, (language, encName)) in list(defaultUnicodeEncodings.items()): |
32 for fontName, (language, encName) in defaultUnicodeEncodings.items(): |
33 print('handling %s : %s : %s' % (fontName, language, encName)) |
33 print('handling %s : %s : %s' % (fontName, language, encName)) |
34 |
34 |
35 #this does just about all of it for us, as all the info |
35 #this does just about all of it for us, as all the info |
36 #we need is present. |
36 #we need is present. |
37 font = UnicodeCIDFont(fontName) |
37 font = UnicodeCIDFont(fontName) |
38 |
38 |
39 widthsByCID = font.face._explicitWidths |
39 widthsByCID = font.face._explicitWidths |
40 cmap = font.encoding._cmap |
40 cmap = font.encoding._cmap |
41 nonStandardWidthsByUnichar = {} |
41 nonStandardWidthsByUnichar = {} |
42 for (codePoint, cid) in list(cmap.items()): |
42 for codePoint, cid in cmap.items(): |
43 width = widthsByCID.get(cid, 1000) |
43 width = widthsByCID.get(cid, 1000) |
44 if width != 1000: |
44 if width != 1000: |
45 nonStandardWidthsByUnichar[chr(codePoint)] = width |
45 nonStandardWidthsByUnichar[chr(codePoint)] = width |
46 |
46 |
47 |
47 |