diff --git a/Tests/fonts/LICENSE.txt b/Tests/fonts/LICENSE.txt index 0e0baaabb..726d5d797 100644 --- a/Tests/fonts/LICENSE.txt +++ b/Tests/fonts/LICENSE.txt @@ -1,5 +1,5 @@ -NotoNastaliqUrdu-Regular.ttf, from https://github.com/googlei18n/noto-fonts +NotoNastaliqUrdu-Regular.ttf and NotoSansSymbols-Regular.ttf, from https://github.com/googlei18n/noto-fonts NotoSansJP-Thin.otf, from https://www.google.com/get/noto/help/cjk/ AdobeVFPrototype.ttf, from https://github.com/adobe-fonts/adobe-variable-font-prototype TINY5x3GX.ttf, from http://velvetyne.fr/fonts/tiny diff --git a/Tests/fonts/NotoSansSymbols-Regular.ttf b/Tests/fonts/NotoSansSymbols-Regular.ttf new file mode 100644 index 000000000..92accef72 Binary files /dev/null and b/Tests/fonts/NotoSansSymbols-Regular.ttf differ diff --git a/Tests/images/unicode_extended.png b/Tests/images/unicode_extended.png new file mode 100644 index 000000000..c0ffad3c6 Binary files /dev/null and b/Tests/images/unicode_extended.png differ diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 3388c2055..3e63a9e2b 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -459,6 +459,18 @@ class TestImageFont(PillowTestCase): with self.assertRaises(UnicodeEncodeError): font.getsize(u"’") + @unittest.skipIf(sys.platform.startswith('win32') and sys.version.startswith('2'), + "requires Python 3.x on Windows") + def test_unicode_render(self): + # issue #3777 + text = u"A\u278A\U0001F12B" + ttf = ImageFont.truetype("Tests/fonts/NotoSansSymbols-Regular.ttf", + FONT_SIZE, layout_engine=self.LAYOUT_ENGINE) + img = Image.new("RGB", (100, 60)) + d = ImageDraw.Draw(img) + d.text((10, 10), text, font=ttf) + self.assert_image_similar_tofile(img, "Tests/images/unicode_extended.png", self.metrics['textsize']) + def _test_fake_loading_font(self, path_to_fake, fontname): # Make a copy of FreeTypeFont so we can patch the original free_type_font = copy.deepcopy(ImageFont.FreeTypeFont)