Abdelrazak Younes wrote:
Mostafa Vahedi wrote:
> b) The current code in the method "Paragraph::transformChar" has
a bug,
> when the prev_char is a COMPOSE character (such as FATHA) and the
previous BASE character is a SPECIAL character (such as ALEF). In
this case the current character (such as BAA) gets the medial form
and gets connected to the previous SPECIAL character which is not
correct. The correct way to handle this situation is that, similar
to the next_char, the first previous non-COMPOSE character should be
assigned to the prev_char if exists.
>
Any progress with this, Mostafa? I don't know the transformChar code,
but it sounds like the changes you're suggesting shouldn't be too
hard...? If I can help out in any way, I'd be happy to try...
It is attached.
Hello Mostafa,
The patch looks good. Does it solves all use cases for you?
By the way, if you use svn, "svn diff" is a better way to generate a
patch. As it is, your patch cannot be applied without editing.
Here is the patch against latest svn. Dov, could you confirm that it
works fine?
Abdel.
Index: Paragraph.cpp
===================================================================
--- Paragraph.cpp (revision 18054)
+++ Paragraph.cpp (working copy)
@@ -2518,9 +2518,17 @@
if (!Encodings::is_arabic(c))
return c;
- value_type const prev_char = pos > 0 ? getChar(pos - 1) : ' ';
+ value_type prev_char = ' ';
value_type next_char = ' ';
+ for (pos_type i = pos - 1; i >= 0; --i) {
+ value_type const par_char = getChar(i);
+ if (!Encodings::isComposeChar_arabic(par_char)) {
+ prev_char = par_char;
+ break;
+ }
+ }
+
for (pos_type i = pos + 1, end = size(); i < end; ++i) {
value_type const par_char = getChar(i);
if (!Encodings::isComposeChar_arabic(par_char)) {