@@ -883,13 +883,12 @@ def get_char_width(charcode):
883
883
# Make the "Differences" array, sort the ccodes < 255 from
884
884
# the multi-byte ccodes, and build the whole set of glyph ids
885
885
# that we need from this font.
886
- cmap = font .get_charmap ()
887
886
glyph_ids = []
888
887
differences = []
889
888
multi_byte_chars = set ()
890
889
for c in characters :
891
890
ccode = c
892
- gind = cmap . get (ccode ) or 0
891
+ gind = font . get_char_index (ccode )
893
892
glyph_ids .append (gind )
894
893
glyph_name = font .get_glyph_name (gind )
895
894
if ccode <= 255 :
@@ -999,12 +998,11 @@ def embedTTFType42(font, characters, descriptor):
999
998
# Make the 'W' (Widths) array, CidToGidMap and ToUnicode CMap
1000
999
# at the same time
1001
1000
cid_to_gid_map = ['\u0000 ' ] * 65536
1002
- cmap = font .get_charmap ()
1003
1001
widths = []
1004
1002
max_ccode = 0
1005
1003
for c in characters :
1006
1004
ccode = c
1007
- gind = cmap . get (ccode ) or 0
1005
+ gind = font . get_char_index (ccode )
1008
1006
glyph = font .load_char (ccode , flags = LOAD_NO_HINTING )
1009
1007
widths .append ((ccode , glyph .horiAdvance / 6 ))
1010
1008
if ccode < 65536 :
@@ -2011,7 +2009,6 @@ def draw_text_woven(chunks):
2011
2009
between chunks of 1-byte characters and 2-byte characters.
2012
2010
Only used for Type 3 fonts."""
2013
2011
chunks = [(a , '' .join (b )) for a , b in chunks ]
2014
- cmap = font .get_charmap ()
2015
2012
2016
2013
# Do the rotation and global translation as a single matrix
2017
2014
# concatenation up front
@@ -2041,7 +2038,7 @@ def draw_text_woven(chunks):
2041
2038
lastgind = None
2042
2039
for c in chunk :
2043
2040
ccode = ord (c )
2044
- gind = cmap . get (ccode )
2041
+ gind = font . get_char_index (ccode )
2045
2042
if gind is not None :
2046
2043
if mode == 2 and chunk_type == 2 :
2047
2044
glyph_name = font .get_glyph_name (gind )
0 commit comments