Skip to content

Commit

Permalink
Merge pull request #3787 from radarhere/raqm
Browse files Browse the repository at this point in the history
Fixed raqm layout bug
  • Loading branch information
hugovk committed May 4, 2019
2 parents e20228a + b742d15 commit 9077a80
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Binary file added Tests/fonts/KhmerOSBattambang-Regular.ttf
Binary file not shown.
Binary file added Tests/images/test_complex_unicode_text2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Tests/test_imagefontctl.py
Expand Up @@ -54,6 +54,18 @@ def test_complex_unicode_text(self):

self.assert_image_similar(im, target_img, .5)

ttf = ImageFont.truetype("Tests/fonts/KhmerOSBattambang-Regular.ttf",
FONT_SIZE)

im = Image.new(mode='RGB', size=(300, 100))
draw = ImageDraw.Draw(im)
draw.text((0, 0), 'លោកុប្បត្តិ', font=ttf, fill=500)

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

self.assert_image_similar(im, target_img, 2.3)

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

Expand Down
3 changes: 0 additions & 3 deletions src/_imagingft.c
Expand Up @@ -755,9 +755,6 @@ font_render(FontObject* self, PyObject* args)
}

for (x = i = 0; i < count; i++) {
if (i == 0 && self->face->glyph->metrics.horiBearingX < 0)
x = -self->face->glyph->metrics.horiBearingX;

index = glyph_info[i].index;
error = FT_Load_Glyph(self->face, index, load_flags);
if (error)
Expand Down

0 comments on commit 9077a80

Please sign in to comment.