@@ -245,8 +245,8 @@ def _get_info(self, fontname, font_class, sym, fontsize, dpi, math=True):
245
245
if bunch is not None :
246
246
return bunch
247
247
248
- font , num , glyph_name , fontsize , slanted = \
249
- self . _get_glyph ( fontname , font_class , sym , fontsize , math )
248
+ font , num , fontsize , slanted = self . _get_glyph (
249
+ fontname , font_class , sym , fontsize , math )
250
250
251
251
font .set_size (fontsize , dpi )
252
252
glyph = font .load_char (
@@ -273,8 +273,6 @@ def _get_info(self, fontname, font_class, sym, fontsize, dpi, math=True):
273
273
fontsize = fontsize ,
274
274
postscript_name = font .postscript_name ,
275
275
metrics = metrics ,
276
- glyph_name = glyph_name ,
277
- symbol_name = glyph_name , # Backcompat alias.
278
276
num = num ,
279
277
glyph = glyph ,
280
278
offset = offset
@@ -340,7 +338,6 @@ def __init__(self, *args, **kwargs):
340
338
_slanted_symbols = set (r"\int \oint" .split ())
341
339
342
340
def _get_glyph (self , fontname , font_class , sym , fontsize , math = True ):
343
- glyph_name = None
344
341
font = None
345
342
if fontname in self .fontmap and sym in latex_to_bakoma :
346
343
basename , num = latex_to_bakoma [sym ]
@@ -351,18 +348,12 @@ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
351
348
font = self ._get_font (fontname )
352
349
if font is not None :
353
350
num = ord (sym )
354
-
355
- if font is not None :
356
- gid = font .get_char_index (num )
357
- if gid != 0 :
358
- glyph_name = font .get_glyph_name (gid )
359
-
360
- if glyph_name is None :
351
+ if font is not None and font .get_char_index (num ) != 0 :
352
+ return font , num , fontsize , slanted
353
+ else :
361
354
return self ._stix_fallback ._get_glyph (
362
355
fontname , font_class , sym , fontsize , math )
363
356
364
- return font , num , glyph_name , fontsize , slanted
365
-
366
357
# The Bakoma fonts contain many pre-sized alternatives for the
367
358
# delimiters. The AutoSizedChar class will use these alternatives
368
359
# and select the best (closest sized) glyph.
@@ -532,14 +523,11 @@ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
532
523
_log .warning ("Font {!r} does not have a glyph for {!a} "
533
524
"[U+{:x}], substituting with a dummy "
534
525
"symbol." .format (new_fontname , sym , uniindex ))
535
- fontname = 'rm'
536
- font = self ._get_font (fontname )
526
+ font = self ._get_font ('rm' )
537
527
uniindex = 0xA4 # currency char, for lack of anything better
538
- glyphindex = font .get_char_index (uniindex )
539
528
slanted = False
540
529
541
- glyph_name = font .get_glyph_name (glyphindex )
542
- return font , uniindex , glyph_name , fontsize , slanted
530
+ return font , uniindex , fontsize , slanted
543
531
544
532
def get_sized_alternatives_for_symbol (self , fontname , sym ):
545
533
if self .cm_fallback :
0 commit comments