[vlc-commits] Freetype: glyph advance values can be negative

Salah-Eddin Shaban git at videolan.org
Sat Oct 13 23:59:16 CEST 2018


vlc | branch: master | Salah-Eddin Shaban <salah at videolan.org> | Thu Sep 27 18:50:06 2018 +0300| [abeeacc5873d631708360a2228f2a6d171b8ee5c] | committer: Jean-Baptiste Kempf

Freetype: glyph advance values can be negative

fixes #21242

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=abeeacc5873d631708360a2228f2a6d171b8ee5c
---

 modules/text_renderer/freetype/text_layout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index b5b42631f5..8b5adca6bc 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -66,6 +66,8 @@
 #include "text_layout.h"
 #include "platform_fonts.h"
 
+#include <stdlib.h>
+
 /* Win32 */
 #ifdef _WIN32
 # undef HAVE_FONTCONFIG
@@ -1151,7 +1153,7 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
                 p_bitmaps->i_y_advance = p_face->glyph->advance.y;
             }
 
-            unsigned i_x_advance = FT_FLOOR( p_bitmaps->i_x_advance );
+            unsigned i_x_advance = FT_FLOOR( abs( p_bitmaps->i_x_advance ) );
             if( i_x_advance > *pi_max_advance_x )
                 *pi_max_advance_x = i_x_advance;
         }



More information about the vlc-commits mailing list