mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fixed set_variation_by_name offset
This commit is contained in:
parent
2258f23781
commit
dea30e4c80
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 |
|
@ -769,12 +769,14 @@ class TestImageFont:
|
|||
self._check_text(font, "Tests/images/variation_adobe.png", 11)
|
||||
for name in ["Bold", b"Bold"]:
|
||||
font.set_variation_by_name(name)
|
||||
self._check_text(font, "Tests/images/variation_adobe_name.png", 11)
|
||||
assert font.getname()[1] == "Bold"
|
||||
self._check_text(font, "Tests/images/variation_adobe_name.png", 16)
|
||||
|
||||
font = ImageFont.truetype("Tests/fonts/TINY5x3GX.ttf", 36)
|
||||
self._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"
|
||||
self._check_text(font, "Tests/images/variation_tiny_name.png", 40)
|
||||
|
||||
def test_variation_set_by_axes(self):
|
||||
|
|
|
@ -795,7 +795,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