File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,20 @@ def test_ft2font_clear():
176
176
assert font .get_bitmap_offset () == (0 , 0 )
177
177
178
178
179
+ def test_ft2font_set_size ():
180
+ file = fm .findfont ('DejaVu Sans' )
181
+ # Default is 12pt @ 72 dpi.
182
+ font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 1 )
183
+ font .set_text ('ABabCDcd' )
184
+ orig = font .get_width_height ()
185
+ font .set_size (24 , 72 )
186
+ font .set_text ('ABabCDcd' )
187
+ assert font .get_width_height () == tuple (pytest .approx (2 * x , 1e-1 ) for x in orig )
188
+ font .set_size (12 , 144 )
189
+ font .set_text ('ABabCDcd' )
190
+ assert font .get_width_height () == tuple (pytest .approx (2 * x , 1e-1 ) for x in orig )
191
+
192
+
179
193
def test_ft2font_charmaps ():
180
194
def enc (name ):
181
195
# We don't expose the encoding enum from FreeType, but can generate it here.
You can’t perform that action at this time.
0 commit comments