[justify-demo] Guess segment properties

This commit is contained in:
Behdad Esfahbod 2023-03-03 17:01:12 -07:00
parent 5c334b9686
commit 5cf54aedde
1 changed files with 2 additions and 3 deletions

View File

@ -246,15 +246,14 @@ Configuration = namedtuple(
def makebuffer(text): def makebuffer(text):
buf = hb.buffer_create() 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. # Strip and remove double spaces.
text = " ".join(text.split()) text = " ".join(text.split())
hb.buffer_add_codepoints(buf, [ord(c) for c in text], 0, len(text)) hb.buffer_add_codepoints(buf, [ord(c) for c in text], 0, len(text))
hb.buffer_guess_segment_properties(buf)
return buf, text return buf, text