Skip to content

Commit

Permalink
add test for python-pillow#3777
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Apr 8, 2019
1 parent 0017ea5 commit 418eb77
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Tests/fonts/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

NotoNastaliqUrdu-Regular.ttf:
NotoNastaliqUrdu-Regular.ttf, NotoSansSymbols-Regular.ttf:

(from https://github.com/googlei18n/noto-fonts)

Expand Down
Binary file added Tests/fonts/NotoSansSymbols-Regular.ttf
Binary file not shown.
Binary file added Tests/images/unicode_extended.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Tests/test_imagefont.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ def test_unicode_pilfont(self):
with self.assertRaises(UnicodeEncodeError):
font.getsize(u"’")

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_equal_tofile(img, "Tests/images/unicode_extended.png")

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)
Expand Down

0 comments on commit 418eb77

Please sign in to comment.