@@ -2345,6 +2345,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23452345 return self .draw_mathtext (gc , x , y , s , prop , angle )
23462346
23472347 fontsize = prop .get_size_in_points ()
2348+ language = mtext .get_language () if mtext is not None else None
23482349
23492350 if mpl .rcParams ['pdf.use14corefonts' ]:
23502351 font = self ._get_font_afm (prop )
@@ -2355,7 +2356,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23552356 fonttype = mpl .rcParams ['pdf.fonttype' ]
23562357
23572358 if gc .get_url () is not None :
2358- font .set_text (s )
2359+ font .set_text (s , language = language )
23592360 width , height = font .get_width_height ()
23602361 self .file ._annotations [- 1 ][1 ].append (_get_link_annotation (
23612362 gc , x , y , width / 64 , height / 64 , angle ))
@@ -2389,7 +2390,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23892390 multibyte_glyphs = []
23902391 prev_was_multibyte = True
23912392 prev_font = font
2392- for item in _text_helpers .layout (s , font , kern_mode = Kerning .UNFITTED ):
2393+ for item in _text_helpers .layout (s , font , language = language ,
2394+ kern_mode = Kerning .UNFITTED ):
23932395 if _font_supports_glyph (fonttype , ord (item .char )):
23942396 if prev_was_multibyte or item .ft_object != prev_font :
23952397 singlebyte_chunks .append ((item .ft_object , item .x , []))
0 commit comments