@@ -188,8 +188,8 @@ def test_ft2font_clear():
188188
189189def test_ft2font_set_size ():
190190 file = fm .findfont ('DejaVu Sans' )
191- # Default is 12pt @ 72 dpi.
192191 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 1 )
192+ font .set_size (12 , 72 )
193193 font .set_text ('ABabCDcd' )
194194 orig = font .get_width_height ()
195195 font .set_size (24 , 72 )
@@ -757,6 +757,7 @@ def test_ft2font_get_kerning(left, right, unscaled, unfitted, default):
757757def test_ft2font_set_text ():
758758 file = fm .findfont ('DejaVu Sans' )
759759 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
760+ font .set_size (12 , 72 )
760761 xys = font .set_text ('' )
761762 np .testing .assert_array_equal (xys , np .empty ((0 , 2 )))
762763 assert font .get_width_height () == (0 , 0 )
@@ -778,6 +779,7 @@ def test_ft2font_set_text():
778779def test_ft2font_loading ():
779780 file = fm .findfont ('DejaVu Sans' )
780781 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
782+ font .set_size (12 , 72 )
781783 for glyph in [font .load_char (ord ('M' )),
782784 font .load_glyph (font .get_char_index (ord ('M' )))]:
783785 assert glyph is not None
@@ -818,11 +820,13 @@ def test_ft2font_drawing():
818820 expected *= 255
819821 file = fm .findfont ('DejaVu Sans' )
820822 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
823+ font .set_size (12 , 72 )
821824 font .set_text ('M' )
822825 font .draw_glyphs_to_bitmap (antialiased = False )
823826 image = font .get_image ()
824827 np .testing .assert_array_equal (image , expected )
825828 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
829+ font .set_size (12 , 72 )
826830 glyph = font .load_char (ord ('M' ))
827831 image = np .zeros (expected .shape , np .uint8 )
828832 font .draw_glyph_to_bitmap (image , - 1 , 1 , glyph , antialiased = False )
@@ -832,6 +836,7 @@ def test_ft2font_drawing():
832836def test_ft2font_get_path ():
833837 file = fm .findfont ('DejaVu Sans' )
834838 font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
839+ font .set_size (12 , 72 )
835840 vertices , codes = font .get_path ()
836841 assert vertices .shape == (0 , 2 )
837842 assert codes .shape == (0 , )
0 commit comments