From 5cf54aeddec47aea380bfa39d543b8fe373c6873 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 3 Mar 2023 17:01:12 -0700 Subject: [PATCH] [justify-demo] Guess segment properties --- src/justify.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/justify.py b/src/justify.py index b60de0886..1078965d4 100644 --- a/src/justify.py +++ b/src/justify.py @@ -246,15 +246,14 @@ Configuration = namedtuple( def makebuffer(text): buf = hb.buffer_create() - hb.buffer_set_direction(buf, hb.direction_t.RTL) - hb.buffer_set_script(buf, hb.script_t.ARABIC) - hb.buffer_set_language(buf, hb.language_from_string(b"ar")) # Strip and remove double spaces. text = " ".join(text.split()) hb.buffer_add_codepoints(buf, [ord(c) for c in text], 0, len(text)) + hb.buffer_guess_segment_properties(buf) + return buf, text