<div dir="ltr"><br>To clarify this issue, here are 2 screenshots.<br><br><a href="https://docs.google.com/file/d/0B36ioujDBJZsNmZHcHdidlBfRFE/edit?pli=1">https://docs.google.com/file/d/0B36ioujDBJZsNmZHcHdidlBfRFE/edit?pli=1</a><br><a href="https://docs.google.com/file/d/0B36ioujDBJZsR29ONEpVWUtGREk/edit?pli=1">https://docs.google.com/file/d/0B36ioujDBJZsR29ONEpVWUtGREk/edit?pli=1</a><br><br><br>The first shows the current rendering of VLC, with some diacritics marked with arrows. Here diacritics are treated as separate characters and each is given its own horizontal space which is incorrect, and causes gaps to appear in the words. This makes reading the text rather difficult, especially with fast-changing subtitles.<br><br>The second shows diacritics displayed correctly over their corresponding base glyphs. So now Arabic text is handled flawlessly in VLC as far as I can see.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 6, 2015 at 1:42 PM, Salah-Eddin Shaban <span dir="ltr"><<a href="mailto:salshaaban@gmail.com" target="_blank">salshaaban@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 modules/text_renderer/freetype.c | 27 +++++++++++++++++++++++++--<br>
 1 file changed, 25 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c<br>
index 1670aa7..050ace6 100644<br>
--- a/modules/text_renderer/freetype.c<br>
+++ b/modules/text_renderer/freetype.c<br>
@@ -1361,6 +1361,10 @@ static int ProcessLines( filter_t *p_filter,<br>
             /* Render the part */<br>
             bool b_break_line = false;<br>
             int i_glyph_last = 0;<br>
+            FT_Vector advance = {<br>
+                .x = 0,<br>
+                .y = 0,<br>
+            };<br>
             while( i_part_length > 0 )<br>
             {<br>
                 const text_style_t *p_glyph_style = pp_styles[i_index];<br>
@@ -1373,6 +1377,16 @@ static int ProcessLines( filter_t *p_filter,<br>
                 if( i_glyph_index == 0 && character == 0xFEFF )<br>
                     goto next;<br>
<br>
+/* These are the most common Arabic diacritics */<br>
+#define DIACRITIC( a ) ( a >= 0x064B && a <= 0x0653 )<br>
+<br>
+                /* Diacritics should be rendered over the preceding base glyph */<br>
+                if( DIACRITIC( character ) )<br>
+                {<br>
+                    pen.x -= advance.x;<br>
+                    pen.y -= advance.y;<br>
+                }<br>
+<br>
                 /* Get kerning vector */<br>
                 FT_Vector kerning = { .x = 0, .y = 0 };<br>
                 if( FT_HAS_KERNING( p_current_face ) && i_glyph_last != 0 && i_glyph_index != 0 )<br>
@@ -1516,8 +1530,17 @@ static int ProcessLines( filter_t *p_filter,<br>
                     .i_line_thickness = i_line_thickness,<br>
                 };<br>
<br>
-                pen.x = pen_new.x + p_current_face->glyph->advance.x;<br>
-                pen.y = pen_new.y + p_current_face->glyph->advance.y;<br>
+                /* Diacritics do not determine advance values. We use        */<br>
+                /* the advance values from the last encountered base glyph,  */<br>
+                /* since multiple diacritics may follow a single base glyph. */<br>
+                if( !DIACRITIC( character ) )<br>
+                {<br>
+                    advance.x = p_current_face->glyph->advance.x;<br>
+                    advance.y = p_current_face->glyph->advance.y;<br>
+                }<br>
+<br>
+                pen.x = pen_new.x + advance.x;<br>
+                pen.y = pen_new.y + advance.y;<br>
                 line_bbox = line_bbox_new;<br>
             next:<br>
                 i_glyph_last = i_glyph_index;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div>