@@ -883,13 +883,12 @@ def get_char_width(charcode):
883883 # Make the "Differences" array, sort the ccodes < 255 from
884884 # the multi-byte ccodes, and build the whole set of glyph ids
885885 # that we need from this font.
886- cmap = font .get_charmap ()
887886 glyph_ids = []
888887 differences = []
889888 multi_byte_chars = set ()
890889 for c in characters :
891890 ccode = c
892- gind = cmap . get (ccode ) or 0
891+ gind = font . get_char_index (ccode )
893892 glyph_ids .append (gind )
894893 glyph_name = font .get_glyph_name (gind )
895894 if ccode <= 255 :
@@ -999,12 +998,11 @@ def embedTTFType42(font, characters, descriptor):
999998 # Make the 'W' (Widths) array, CidToGidMap and ToUnicode CMap
1000999 # at the same time
10011000 cid_to_gid_map = ['\u0000 ' ] * 65536
1002- cmap = font .get_charmap ()
10031001 widths = []
10041002 max_ccode = 0
10051003 for c in characters :
10061004 ccode = c
1007- gind = cmap . get (ccode ) or 0
1005+ gind = font . get_char_index (ccode )
10081006 glyph = font .load_char (ccode , flags = LOAD_NO_HINTING )
10091007 widths .append ((ccode , glyph .horiAdvance / 6 ))
10101008 if ccode < 65536 :
@@ -2010,7 +2008,6 @@ def draw_text_woven(chunks):
20102008 between chunks of 1-byte characters and 2-byte characters.
20112009 Only used for Type 3 fonts."""
20122010 chunks = [(a , '' .join (b )) for a , b in chunks ]
2013- cmap = font .get_charmap ()
20142011
20152012 # Do the rotation and global translation as a single matrix
20162013 # concatenation up front
@@ -2040,7 +2037,7 @@ def draw_text_woven(chunks):
20402037 lastgind = None
20412038 for c in chunk :
20422039 ccode = ord (c )
2043- gind = cmap . get (ccode )
2040+ gind = font . get_char_index (ccode )
20442041 if gind is not None :
20452042 if mode == 2 and chunk_type == 2 :
20462043 glyph_name = font .get_glyph_name (gind )
0 commit comments