@@ -168,6 +168,12 @@ def test_ft2font_invalid_args(tmp_path):
168168 # kerning_factor argument.
169169 with pytest .raises (TypeError , match = 'incompatible constructor arguments' ):
170170 ft2font .FT2Font (file , _kerning_factor = 1.3 )
171+ with pytest .warns (mpl .MatplotlibDeprecationWarning ,
172+ match = 'text.kerning_factor rcParam was deprecated .+ 3.11' ):
173+ mpl .rcParams ['text.kerning_factor' ] = 0
174+ with pytest .warns (mpl .MatplotlibDeprecationWarning ,
175+ match = '_kerning_factor parameter was deprecated .+ 3.11' ):
176+ ft2font .FT2Font (file , _kerning_factor = 123 )
171177
172178
173179def test_ft2font_clear ():
@@ -188,7 +194,7 @@ def test_ft2font_clear():
188194
189195def test_ft2font_set_size ():
190196 file = fm .findfont ('DejaVu Sans' )
191- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 1 )
197+ font = ft2font .FT2Font (file , hinting_factor = 1 )
192198 font .set_size (12 , 72 )
193199 font .set_text ('ABabCDcd' )
194200 orig = font .get_width_height ()
@@ -717,7 +723,7 @@ def test_ft2font_get_sfnt_table(font_name, header):
717723def test_ft2font_get_kerning (left , right , unscaled , unfitted , default ):
718724 file = fm .findfont ('DejaVu Sans' )
719725 # With unscaled, these settings should produce exact values found in FontForge.
720- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
726+ font = ft2font .FT2Font (file , hinting_factor = 1 )
721727 font .set_size (100 , 100 )
722728 assert font .get_kerning (font .get_char_index (ord (left )),
723729 font .get_char_index (ord (right )),
@@ -756,7 +762,7 @@ def test_ft2font_get_kerning(left, right, unscaled, unfitted, default):
756762
757763def test_ft2font_set_text ():
758764 file = fm .findfont ('DejaVu Sans' )
759- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
765+ font = ft2font .FT2Font (file , hinting_factor = 1 )
760766 font .set_size (12 , 72 )
761767 xys = font .set_text ('' )
762768 np .testing .assert_array_equal (xys , np .empty ((0 , 2 )))
@@ -778,7 +784,7 @@ def test_ft2font_set_text():
778784
779785def test_ft2font_loading ():
780786 file = fm .findfont ('DejaVu Sans' )
781- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
787+ font = ft2font .FT2Font (file , hinting_factor = 1 )
782788 font .set_size (12 , 72 )
783789 for glyph in [font .load_char (ord ('M' )),
784790 font .load_glyph (font .get_char_index (ord ('M' )))]:
@@ -819,13 +825,13 @@ def test_ft2font_drawing():
819825 ])
820826 expected *= 255
821827 file = fm .findfont ('DejaVu Sans' )
822- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
828+ font = ft2font .FT2Font (file , hinting_factor = 1 )
823829 font .set_size (12 , 72 )
824830 font .set_text ('M' )
825831 font .draw_glyphs_to_bitmap (antialiased = False )
826832 image = font .get_image ()
827833 np .testing .assert_array_equal (image , expected )
828- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
834+ font = ft2font .FT2Font (file , hinting_factor = 1 )
829835 font .set_size (12 , 72 )
830836 glyph = font .load_char (ord ('M' ))
831837 image = np .zeros (expected .shape , np .uint8 )
@@ -835,7 +841,7 @@ def test_ft2font_drawing():
835841
836842def test_ft2font_get_path ():
837843 file = fm .findfont ('DejaVu Sans' )
838- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
844+ font = ft2font .FT2Font (file , hinting_factor = 1 )
839845 font .set_size (12 , 72 )
840846 vertices , codes = font .get_path ()
841847 assert vertices .shape == (0 , 2 )
0 commit comments