@@ -2338,6 +2338,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23382338 return self .draw_mathtext (gc , x , y , s , prop , angle )
23392339
23402340 fontsize = prop .get_size_in_points ()
2341+ language = mtext .get_language () if mtext is not None else None
23412342
23422343 if mpl .rcParams ['pdf.use14corefonts' ]:
23432344 font = self ._get_font_afm (prop )
@@ -2348,7 +2349,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23482349 fonttype = mpl .rcParams ['pdf.fonttype' ]
23492350
23502351 if gc .get_url () is not None :
2351- font .set_text (s )
2352+ font .set_text (s , language = language )
23522353 width , height = font .get_width_height ()
23532354 self .file ._annotations [- 1 ][1 ].append (_get_link_annotation (
23542355 gc , x , y , width / 64 , height / 64 , angle ))
@@ -2382,7 +2383,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
23822383 multibyte_glyphs = []
23832384 prev_was_multibyte = True
23842385 prev_font = font
2385- for item in _text_helpers .layout (s , font , kern_mode = Kerning .UNFITTED ):
2386+ for item in _text_helpers .layout (s , font , language = language ,
2387+ kern_mode = Kerning .UNFITTED ):
23862388 if _font_supports_glyph (fonttype , ord (item .char )):
23872389 if prev_was_multibyte or item .ft_object != prev_font :
23882390 singlebyte_chunks .append ((item .ft_object , item .x , []))
0 commit comments