Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f618fc2

Browse filesBrowse files
committed
TST: Add test for FT2Font.set_size
1 parent 833a259 commit f618fc2
Copy full SHA for f618fc2

File tree

Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed

‎lib/matplotlib/tests/test_ft2font.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_ft2font.py
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ def test_ft2font_clear():
176176
assert font.get_bitmap_offset() == (0, 0)
177177

178178

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+
179193
def test_ft2font_charmaps():
180194
def enc(name):
181195
# We don't expose the encoding enum from FreeType, but can generate it here.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.