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

Salah-Eddin Shaban git at videolan.org
Sun Oct 14 00:00:47 CEST 2018


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

Freetype: glyph advance values can be negative

fixes #21242

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit abeeacc5873d631708360a2228f2a6d171b8ee5c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 d030b4b47c..3aba1b820b 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
@@ -1065,7 +1067,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