Index: firmware/bidi.c =================================================================== --- firmware/bidi.c (revision 25039) +++ firmware/bidi.c (working copy) @@ -30,6 +30,7 @@ #include "arabjoin.h" #include "scroll_engine.h" #include "bidi.h" +#include "diacritic.h" /* #define _HEB_BUFFER_LENGTH (MAX_PATH + LCD_WIDTH/2 + 3 + 2 + 2) * 2 */ #define _HEB_BLOCK_TYPE_ENG 1 @@ -61,30 +62,43 @@ { bool connected = false; unsigned short * writeprt = stringprt; - + short is_diac = 0; + unsigned short * diac_ptr = 0; const arab_t * prev = 0; const arab_t * cur; const arab_t * ligature = 0; short uchar; - int i; + int i,j; for (i = 0; i <= length; i++) { cur = arab_lookup(uchar = *stringprt++); - /* Skip non-arabic chars */ + /* Skip non-arabic chars */ /* (actually this skips diacritics too as they are commented in arabjoin.c) */ if (cur == 0) { - if (prev) { + if (is_diacritic(uchar, NULL)) { /* skip diacritics without affecting the shaping algorithm (apply joining as if there is no diacritics) */ + if(!is_diac) + diac_ptr = stringprt - 1; + is_diac++; + } + else if (prev) /* non-arabic characters */ + { /* Finish the last char */ if (connected) { *writeprt++ = prev->final; connected = false; - } else + } + else *writeprt++ = prev->isolated; prev = 0; + if (is_diac) { /* write the skipped diacritics */ + for (j = 0; j < is_diac; j++) + *writeprt++ = *diac_ptr++; + is_diac = 0; + } *writeprt++ = uchar; - } else { + } + else *writeprt++ = uchar; - } continue; } @@ -129,6 +143,11 @@ } else *writeprt++ = prev->isolated; } + if (is_diac) { /* write the skipped diacritics */ + for (j = 0; j < is_diac; j++) + *writeprt++ = *diac_ptr++; + is_diac = 0; + } prev = cur; } } Index: firmware/drivers/lcd-bitmap-common.c =================================================================== --- firmware/drivers/lcd-bitmap-common.c (revision 25309) +++ firmware/drivers/lcd-bitmap-common.c (working copy) @@ -179,20 +179,18 @@ * buffer using OR, and then draw the final bitmap instead of the * chars, without touching the drawmode **/ - drawmode = current_vp->drawmode; - current_vp->drawmode = DRMODE_FG; base_ofs = (base_width - width) / 2; } - + /* Change the draw mode globally to all characters (not only + * diacritics) to overcome the problem with Arabic diacritics */ + drawmode = current_vp->drawmode; + current_vp->drawmode = DRMODE_FG; bits = font_get_bits(pf, *ucs); LCDFN(mono_bitmap_part)(bits, ofs, 0, width, x + base_ofs, y, width - ofs, pf->height); - if (is_diac) - { - current_vp->drawmode = drawmode; - } + current_vp->drawmode = drawmode; if (next_ch) {