Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected ttb text positioning #3856

Merged
merged 3 commits into from Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions Tests/fonts/LICENSE.txt
@@ -1,7 +1,6 @@

NotoNastaliqUrdu-Regular.ttf:

(from https://github.com/googlei18n/noto-fonts)
NotoNastaliqUrdu-Regular.ttf, from https://github.com/googlei18n/noto-fonts
NotoSansJP-Thin.otf, from https://www.google.com/get/noto/help/cjk/

All Noto fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.

Expand Down
Binary file added Tests/fonts/NotoSansJP-Regular.otf
Binary file not shown.
Binary file added Tests/images/test_direction_ttb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Tests/test_imagefontctl.py
Expand Up @@ -104,6 +104,22 @@ def test_text_direction_rtl2(self):

self.assert_image_similar(im, target_img, .5)

def test_text_direction_ttb(self):
ttf = ImageFont.truetype("Tests/fonts/NotoSansJP-Regular.otf", FONT_SIZE)

im = Image.new(mode='RGB', size=(100, 300))
draw = ImageDraw.Draw(im)
try:
draw.text((0, 0), 'English あい', font=ttf, fill=500, direction='ttb')
except ValueError as ex:
if str(ex) == "libraqm 0.7 or greater required for 'ttb' direction":
self.skipTest('libraqm 0.7 or greater not available')

target = 'Tests/images/test_direction_ttb.png'
target_img = Image.open(target)

self.assert_image_similar(im, target_img, 1.15)

def test_ligature_features(self):
ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE)

Expand Down