diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2007-07-24 23:10:16 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2007-07-24 23:10:16 +0000 |
commit | 5ef3f41d3b0a34c4e5028fce0677e6b699159dc1 (patch) | |
tree | 455915f576f04a672d1c5cd26f7a23916a37e9c3 /modules | |
parent | 566ead12a237c678c67052549a451a621c0593fa (diff) | |
download | pango-5ef3f41d3b0a34c4e5028fce0677e6b699159dc1.tar.gz |
Bug 150883 – Unicode LRO defect
2007-07-24 Behdad Esfahbod <behdad@gnome.org>
Bug 150883 – Unicode LRO defect
* modules/arabic/arabic-fc.c (arabic_engine_shape):
* modules/arabic/arabic-ot.c (Get_Joining_Class),
(Arabic_Assign_Properties):
* modules/arabic/arabic-ot.h:
Correctly handle Arabic shaping in left-to-right runs.
svn path=/trunk/; revision=2378
Diffstat (limited to 'modules')
-rw-r--r-- | modules/arabic/arabic-fc.c | 5 | ||||
-rw-r--r-- | modules/arabic/arabic-ot.c | 28 | ||||
-rw-r--r-- | modules/arabic/arabic-ot.h | 3 |
3 files changed, 22 insertions, 14 deletions
diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c index c311504b..5765982b 100644 --- a/modules/arabic/arabic-fc.c +++ b/modules/arabic/arabic-fc.c @@ -95,6 +95,7 @@ arabic_engine_shape (PangoEngineShape *engine, gunichar *wcs; const char *p; int cluster = 0; + gboolean rtl = analysis->level % 2 != 0; int i; g_return_if_fail (font != NULL); @@ -108,13 +109,13 @@ arabic_engine_shape (PangoEngineShape *engine, return; buffer = pango_ot_buffer_new (fc_font); - pango_ot_buffer_set_rtl (buffer, analysis->level % 2 != 0); + pango_ot_buffer_set_rtl (buffer, rtl); pango_ot_buffer_set_zero_width_marks (buffer, TRUE); wcs = g_utf8_to_ucs4_fast (text, length, &n_chars); properties = g_new0 (gulong, n_chars); - Arabic_Assign_Properties (wcs, properties, n_chars); + Arabic_Assign_Properties (wcs, properties, n_chars, !rtl); g_free (wcs); diff --git a/modules/arabic/arabic-ot.c b/modules/arabic/arabic-ot.c index 5041bd9d..ba8e9bad 100644 --- a/modules/arabic/arabic-ot.c +++ b/modules/arabic/arabic-ot.c @@ -319,7 +319,8 @@ TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, static joining_class Get_Joining_Class (gunichar* string, int pos, int length, - int direction) + int direction, + gboolean reverse) { joining_class j; @@ -349,17 +350,22 @@ static joining_class Get_Joining_Class (gunichar* string, return none; if (!direction || j != transparent) - return j; + { + if (G_UNLIKELY (reverse)) + return j == right ? left : j == left ? right : j; + else + return j; + } } } FT_Error Arabic_Assign_Properties (gunichar *string, gulong *properties, - int length) + int length, + gboolean reverse) { joining_class previous, current, next; - int i; if (!string || !properties || length == 0) @@ -367,9 +373,9 @@ FT_Error Arabic_Assign_Properties (gunichar *string, for (i = 0; i < length; i++) { - previous = Get_Joining_Class (string, i, length, -1); - current = Get_Joining_Class (string, i, length, 0); - next = Get_Joining_Class (string, i, length, 1); + previous = Get_Joining_Class (string, i, length, -1, reverse); + current = Get_Joining_Class (string, i, length, 0, reverse); + next = Get_Joining_Class (string, i, length, 1, reverse); /* R1 */ @@ -386,7 +392,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, previous == dual ) if (current == right) { - properties[i] |= final_p; + properties[i] |= reverse ? initial_p : final_p; continue; } @@ -397,7 +403,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, next == right || next == dual ) { - properties[i] |= initial_p; + properties[i] |= reverse ? final_p : initial_p; continue; } @@ -425,7 +431,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, next == right || next == dual )) { - properties[i] |= final_p; + properties[i] |= reverse ? initial_p : final_p; continue; } @@ -439,7 +445,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, next == right || next == dual ) { - properties[i] |= initial_p; + properties[i] |= reverse ? final_p : initial_p; continue; } diff --git a/modules/arabic/arabic-ot.h b/modules/arabic/arabic-ot.h index 401279be..db9a9aa9 100644 --- a/modules/arabic/arabic-ot.h +++ b/modules/arabic/arabic-ot.h @@ -68,7 +68,8 @@ typedef enum joining_class_ joining_class; FT_Error Arabic_Assign_Properties (gunichar *string, gulong *properties, - int length); + int length, + gboolean reverse); #if 0 TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, TT_UShort max_glyphs, |