@@ -2342,6 +2342,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23422342 return self .draw_mathtext (gc , x , y , s , prop , angle )
23432343
23442344 fontsize = prop .get_size_in_points ()
2345+ language = mtext .get_language () if mtext is not None else None
23452346
23462347 if mpl .rcParams ['pdf.use14corefonts' ]:
23472348 font = self ._get_font_afm (prop )
@@ -2352,7 +2353,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23522353 fonttype = mpl .rcParams ['pdf.fonttype' ]
23532354
23542355 if gc .get_url () is not None :
2355- font .set_text (s )
2356+ font .set_text (s , language = language )
23562357 width , height = font .get_width_height ()
23572358 self .file ._annotations [- 1 ][1 ].append (_get_link_annotation (
23582359 gc , x , y , width / 64 , height / 64 , angle ))
@@ -2386,7 +2387,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23862387 multibyte_glyphs = []
23872388 prev_was_multibyte = True
23882389 prev_font = font
2389- for item in _text_helpers .layout (s , font , kern_mode = Kerning .UNFITTED ):
2390+ for item in _text_helpers .layout (s , font , language = language ,
2391+ kern_mode = Kerning .UNFITTED ):
23902392 if _font_supports_glyph (fonttype , ord (item .char )):
23912393 if prev_was_multibyte or item .ft_object != prev_font :
23922394 singlebyte_chunks .append ((item .ft_object , item .x , []))
0 commit comments