@@ -168,6 +168,12 @@ def test_ft2font_invalid_args(tmp_path):
168
168
# kerning_factor argument.
169
169
with pytest .raises (TypeError , match = 'incompatible constructor arguments' ):
170
170
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 )
171
177
172
178
173
179
def test_ft2font_clear ():
@@ -188,7 +194,7 @@ def test_ft2font_clear():
188
194
189
195
def test_ft2font_set_size ():
190
196
file = fm .findfont ('DejaVu Sans' )
191
- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 1 )
197
+ font = ft2font .FT2Font (file , hinting_factor = 1 )
192
198
font .set_size (12 , 72 )
193
199
font .set_text ('ABabCDcd' )
194
200
orig = font .get_width_height ()
@@ -717,7 +723,7 @@ def test_ft2font_get_sfnt_table(font_name, header):
717
723
def test_ft2font_get_kerning (left , right , unscaled , unfitted , default ):
718
724
file = fm .findfont ('DejaVu Sans' )
719
725
# 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 )
721
727
font .set_size (100 , 100 )
722
728
assert font .get_kerning (font .get_char_index (ord (left )),
723
729
font .get_char_index (ord (right )),
@@ -756,7 +762,7 @@ def test_ft2font_get_kerning(left, right, unscaled, unfitted, default):
756
762
757
763
def test_ft2font_set_text ():
758
764
file = fm .findfont ('DejaVu Sans' )
759
- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
765
+ font = ft2font .FT2Font (file , hinting_factor = 1 )
760
766
font .set_size (12 , 72 )
761
767
xys = font .set_text ('' )
762
768
np .testing .assert_array_equal (xys , np .empty ((0 , 2 )))
@@ -778,7 +784,7 @@ def test_ft2font_set_text():
778
784
779
785
def test_ft2font_loading ():
780
786
file = fm .findfont ('DejaVu Sans' )
781
- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
787
+ font = ft2font .FT2Font (file , hinting_factor = 1 )
782
788
font .set_size (12 , 72 )
783
789
for glyph in [font .load_char (ord ('M' )),
784
790
font .load_glyph (font .get_char_index (ord ('M' )))]:
@@ -819,13 +825,13 @@ def test_ft2font_drawing():
819
825
])
820
826
expected *= 255
821
827
file = fm .findfont ('DejaVu Sans' )
822
- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
828
+ font = ft2font .FT2Font (file , hinting_factor = 1 )
823
829
font .set_size (12 , 72 )
824
830
font .set_text ('M' )
825
831
font .draw_glyphs_to_bitmap (antialiased = False )
826
832
image = font .get_image ()
827
833
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 )
829
835
font .set_size (12 , 72 )
830
836
glyph = font .load_char (ord ('M' ))
831
837
image = np .zeros (expected .shape , np .uint8 )
@@ -835,7 +841,7 @@ def test_ft2font_drawing():
835
841
836
842
def test_ft2font_get_path ():
837
843
file = fm .findfont ('DejaVu Sans' )
838
- font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
844
+ font = ft2font .FT2Font (file , hinting_factor = 1 )
839
845
font .set_size (12 , 72 )
840
846
vertices , codes = font .get_path ()
841
847
assert vertices .shape == (0 , 2 )
0 commit comments