@@ -44,13 +44,6 @@ def __init__(self):
44
44
45
45
self ._texmanager = None
46
46
47
- self ._adobe_standard_encoding = None
48
-
49
- def _get_adobe_standard_encoding (self ):
50
- enc_name = dviread .find_tex_file ('8a.enc' )
51
- enc = dviread .Encoding (enc_name )
52
- return {c : i for i , c in enumerate (enc .encoding )}
53
-
54
47
def _get_font (self , prop ):
55
48
"""
56
49
find a ttf font.
@@ -299,14 +292,12 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
299
292
# codes are modstly borrowed from pdf backend.
300
293
301
294
texmanager = self .get_texmanager ()
295
+ use_glyph = False
302
296
303
297
if self .tex_font_map is None :
304
298
self .tex_font_map = dviread .PsfontsMap (
305
299
dviread .find_tex_file ('pdftex.map' ))
306
300
307
- if self ._adobe_standard_encoding is None :
308
- self ._adobe_standard_encoding = self ._get_adobe_standard_encoding ()
309
-
310
301
fontsize = prop .get_size_in_points ()
311
302
if hasattr (texmanager , "get_dvi" ):
312
303
dvifilelike = texmanager .get_dvi (s , self .FONT_SCALE )
@@ -358,11 +349,21 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
358
349
warnings .warn ("No supported encoding in font (%s)." %
359
350
font_bunch .filename )
360
351
352
+ # Character is a glyph and needs to be mapped to corresponding index
361
353
if charmap_name == "ADOBE_STANDARD" and font_bunch .encoding :
354
+ use_glyph = True
362
355
enc0 = dviread .Encoding (font_bunch .encoding )
363
- enc = {i : self ._adobe_standard_encoding .get (c , None )
364
- for i , c in enumerate (enc0 .encoding )}
356
+
357
+ # Make a list of each glyph by splitting the encoding
358
+ enc0_list = []
359
+ for e in enc0 .encoding :
360
+ enc0_list += e .split ("/" )
361
+
362
+ # Encoding provided by the font file mapping names to index
363
+ enc = {i : font .get_name_index (c ) or None
364
+ for i , c in enumerate (enc0_list )}
365
365
else :
366
+ use_glyph = False
366
367
enc = {}
367
368
self ._ps_fontd [dvifont .texname ] = font , enc
368
369
@@ -382,7 +383,10 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
382
383
charcode = glyph
383
384
384
385
if charcode is not None :
385
- glyph0 = font .load_char (charcode , flags = ft2font_flag )
386
+ if use_glyph :
387
+ glyph0 = font .load_glyph (charcode , flags = ft2font_flag )
388
+ else :
389
+ glyph0 = font .load_char (charcode , flags = ft2font_flag )
386
390
else :
387
391
warnings .warn ("The glyph (%d) of font (%s) cannot be "
388
392
"converted with the encoding. Glyph may "
0 commit comments