Skip to content

Commit 73f5684

Browse files
authored
Merge pull request #4696 from radarhere/harfbuzz
2 parents dd4b61c + 7d1f5ba commit 73f5684

8 files changed

Lines changed: 25 additions & 28 deletions

Tests/images/variation_adobe.png

3 Bytes
Loading
-9 Bytes
Loading
7 Bytes
Loading
1.44 KB
Loading
1.41 KB
Loading
1.42 KB
Loading

Tests/test_imagefont.py

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
assert_image_equal,
1414
assert_image_similar,
1515
assert_image_similar_tofile,
16-
is_mingw,
1716
is_pypy,
1817
is_win32,
1918
skip_unless_feature,
@@ -661,7 +660,22 @@ def test_variation_get(self):
661660
{"name": b"Size", "minimum": 0, "maximum": 300, "default": 0}
662661
]
663662

664-
@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
663+
def _check_text(self, font, path, epsilon):
664+
im = Image.new("RGB", (100, 75), "white")
665+
d = ImageDraw.Draw(im)
666+
d.text((10, 10), "Text", font=font, fill="black")
667+
668+
try:
669+
with Image.open(path) as expected:
670+
assert_image_similar(im, expected, epsilon)
671+
except AssertionError:
672+
if "_adobe" in path:
673+
path = path.replace("_adobe", "_adobe_older_harfbuzz")
674+
with Image.open(path) as expected:
675+
assert_image_similar(im, expected, epsilon)
676+
else:
677+
raise
678+
665679
def test_variation_set_by_name(self):
666680
font = self.get_font()
667681

@@ -674,27 +688,18 @@ def test_variation_set_by_name(self):
674688
with pytest.raises(OSError):
675689
font.set_variation_by_name("Bold")
676690

677-
def _check_text(font, path, epsilon):
678-
im = Image.new("RGB", (100, 75), "white")
679-
d = ImageDraw.Draw(im)
680-
d.text((10, 10), "Text", font=font, fill="black")
681-
682-
with Image.open(path) as expected:
683-
assert_image_similar(im, expected, epsilon)
684-
685691
font = ImageFont.truetype("Tests/fonts/AdobeVFPrototype.ttf", 36)
686-
_check_text(font, "Tests/images/variation_adobe.png", 11)
692+
self._check_text(font, "Tests/images/variation_adobe.png", 11)
687693
for name in ["Bold", b"Bold"]:
688694
font.set_variation_by_name(name)
689-
_check_text(font, "Tests/images/variation_adobe_name.png", 11)
695+
self._check_text(font, "Tests/images/variation_adobe_name.png", 11)
690696

691697
font = ImageFont.truetype("Tests/fonts/TINY5x3GX.ttf", 36)
692-
_check_text(font, "Tests/images/variation_tiny.png", 40)
698+
self._check_text(font, "Tests/images/variation_tiny.png", 40)
693699
for name in ["200", b"200"]:
694700
font.set_variation_by_name(name)
695-
_check_text(font, "Tests/images/variation_tiny_name.png", 40)
701+
self._check_text(font, "Tests/images/variation_tiny_name.png", 40)
696702

697-
@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
698703
def test_variation_set_by_axes(self):
699704
font = self.get_font()
700705

@@ -707,21 +712,13 @@ def test_variation_set_by_axes(self):
707712
with pytest.raises(OSError):
708713
font.set_variation_by_axes([500, 50])
709714

710-
def _check_text(font, path, epsilon):
711-
im = Image.new("RGB", (100, 75), "white")
712-
d = ImageDraw.Draw(im)
713-
d.text((10, 10), "Text", font=font, fill="black")
714-
715-
with Image.open(path) as expected:
716-
assert_image_similar(im, expected, epsilon)
717-
718715
font = ImageFont.truetype("Tests/fonts/AdobeVFPrototype.ttf", 36)
719716
font.set_variation_by_axes([500, 50])
720-
_check_text(font, "Tests/images/variation_adobe_axes.png", 5.1)
717+
self._check_text(font, "Tests/images/variation_adobe_axes.png", 5.1)
721718

722719
font = ImageFont.truetype("Tests/fonts/TINY5x3GX.ttf", 36)
723720
font.set_variation_by_axes([100])
724-
_check_text(font, "Tests/images/variation_tiny_axes.png", 32.5)
721+
self._check_text(font, "Tests/images/variation_tiny_axes.png", 32.5)
725722

726723

727724
@skip_unless_feature("raqm")

winbuild/build_prepare.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ def cmd_msbuild(
251251
"libs": [r"*.lib"],
252252
},
253253
"harfbuzz": {
254-
"url": "https://github.com/harfbuzz/harfbuzz/archive/2.6.4.zip",
255-
"filename": "harfbuzz-2.6.4.zip",
256-
"dir": "harfbuzz-2.6.4",
254+
"url": "https://github.com/harfbuzz/harfbuzz/archive/2.6.7.zip",
255+
"filename": "harfbuzz-2.6.7.zip",
256+
"dir": "harfbuzz-2.6.7",
257257
"build": [
258258
cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"),
259259
cmd_nmake(target="clean"),

0 commit comments

Comments
 (0)