summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--modules/arabic/arabic-fc.c5
-rw-r--r--modules/arabic/arabic-ot.c28
-rw-r--r--modules/arabic/arabic-ot.h3
4 files changed, 32 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index feb1c8d5..794b8c40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
2007-07-21 Behdad Esfahbod <behdad@gnome.org>
Part of Bug 347236 – provide pango_cairo_font_get_scaled_font
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,