mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Merge pull request #6445 from radarhere/set_variation_by_name
This commit is contained in:
commit
31f66ea963
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -746,12 +746,14 @@ def test_variation_set_by_name(font):
|
|||
_check_text(font, "Tests/images/variation_adobe.png", 11)
|
||||
for name in ["Bold", b"Bold"]:
|
||||
font.set_variation_by_name(name)
|
||||
_check_text(font, "Tests/images/variation_adobe_name.png", 11)
|
||||
assert font.getname()[1] == "Bold"
|
||||
_check_text(font, "Tests/images/variation_adobe_name.png", 16)
|
||||
|
||||
font = ImageFont.truetype("Tests/fonts/TINY5x3GX.ttf", 36)
|
||||
_check_text(font, "Tests/images/variation_tiny.png", 40)
|
||||
for name in ["200", b"200"]:
|
||||
font.set_variation_by_name(name)
|
||||
assert font.getname()[1] == "200"
|
||||
_check_text(font, "Tests/images/variation_tiny_name.png", 40)
|
||||
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ class FreeTypeFont:
|
|||
names = self.get_variation_names()
|
||||
if not isinstance(name, bytes):
|
||||
name = name.encode()
|
||||
index = names.index(name)
|
||||
index = names.index(name) + 1
|
||||
|
||||
if index == getattr(self, "_last_variation_index", None):
|
||||
# When the same name is set twice in a row,
|
||||
|
|
Loading…
Reference in New Issue
Block a user