@@ -188,8 +188,8 @@ def test_ft2font_clear():
188
188
189
189
def test_ft2font_set_size ():
190
190
file = fm .findfont ('DejaVu Sans' )
191
- # Default is 12pt @ 72 dpi.
192
191
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 1 )
192
+ font .set_size (12 , 72 )
193
193
font .set_text ('ABabCDcd' )
194
194
orig = font .get_width_height ()
195
195
font .set_size (24 , 72 )
@@ -757,6 +757,7 @@ def test_ft2font_get_kerning(left, right, unscaled, unfitted, default):
757
757
def test_ft2font_set_text ():
758
758
file = fm .findfont ('DejaVu Sans' )
759
759
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
760
+ font .set_size (12 , 72 )
760
761
xys = font .set_text ('' )
761
762
np .testing .assert_array_equal (xys , np .empty ((0 , 2 )))
762
763
assert font .get_width_height () == (0 , 0 )
@@ -778,6 +779,7 @@ def test_ft2font_set_text():
778
779
def test_ft2font_loading ():
779
780
file = fm .findfont ('DejaVu Sans' )
780
781
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
782
+ font .set_size (12 , 72 )
781
783
for glyph in [font .load_char (ord ('M' )),
782
784
font .load_glyph (font .get_char_index (ord ('M' )))]:
783
785
assert glyph is not None
@@ -818,11 +820,13 @@ def test_ft2font_drawing():
818
820
expected *= 255
819
821
file = fm .findfont ('DejaVu Sans' )
820
822
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
823
+ font .set_size (12 , 72 )
821
824
font .set_text ('M' )
822
825
font .draw_glyphs_to_bitmap (antialiased = False )
823
826
image = font .get_image ()
824
827
np .testing .assert_array_equal (image , expected )
825
828
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
829
+ font .set_size (12 , 72 )
826
830
glyph = font .load_char (ord ('M' ))
827
831
image = np .zeros (expected .shape , np .uint8 )
828
832
font .draw_glyph_to_bitmap (image , - 1 , 1 , glyph , antialiased = False )
@@ -832,6 +836,7 @@ def test_ft2font_drawing():
832
836
def test_ft2font_get_path ():
833
837
file = fm .findfont ('DejaVu Sans' )
834
838
font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
839
+ font .set_size (12 , 72 )
835
840
vertices , codes = font .get_path ()
836
841
assert vertices .shape == (0 , 2 )
837
842
assert codes .shape == (0 , )
0 commit comments