From ac638130b360c922df610de2e7d3713e89c60c53 Mon Sep 17 00:00:00 2001 From: Roel Nieskens Date: Thu, 3 Oct 2019 09:10:59 +0200 Subject: [PATCH] Fix rtl sequences ending with fitzpatrick modifier When sequence ends with skintone modifier, it would remain at the end. Example: Input: [128105, 127995, 8205, 129309, 8205, 128104, 127996] Output: [128104, 8205, 129309, 8205, 127995, 128105, 127996] --- add_glyphs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/add_glyphs.py b/add_glyphs.py index 5c71b61b4..3186b77bf 100644 --- a/add_glyphs.py +++ b/add_glyphs.py @@ -228,7 +228,10 @@ def get_rtl_seq(seq): rev_seq = list(seq) rev_seq.reverse() - for i in xrange(1, len(rev_seq)): + starts_with_fp = is_fitzpatrick(rev_seq[0]) + for i in range(1, len(rev_seq)): + if i == 2 and starts_with_fp: + continue if is_fitzpatrick(rev_seq[i-1]): tmp = rev_seq[i] rev_seq[i] = rev_seq[i-1]