[vlc-commits] freetype: fix FixGlyph()

Salah-Eddin Shaban git at videolan.org
Tue May 12 10:30:56 CEST 2015


vlc | branch: master | Salah-Eddin Shaban <salshaaban at gmail.com> | Tue May 12 09:15:59 2015 +0300| [537d4556263961561fdfb5b99c306ea2a7b37914] | committer: Jean-Baptiste Kempf

freetype: fix FixGlyph()

FixGlyph() expects to be called immediately after FT_Load_Glyph(), which is no longer the case.

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

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

 modules/text_renderer/text_layout.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/text_renderer/text_layout.c b/modules/text_renderer/text_layout.c
index c87a5cd..c55ae80 100644
--- a/modules/text_renderer/text_layout.c
+++ b/modules/text_renderer/text_layout.c
@@ -179,19 +179,20 @@ line_desc_t *NewLine( int i_count )
 }
 
 static void FixGlyph( FT_Glyph glyph, FT_BBox *p_bbox,
-                      FT_Face face, const FT_Vector *p_pen )
+                      FT_Pos i_x_advance, FT_Pos i_y_advance,
+                      const FT_Vector *p_pen )
 {
     FT_BitmapGlyph glyph_bmp = (FT_BitmapGlyph)glyph;
     if( p_bbox->xMin >= p_bbox->xMax )
     {
         p_bbox->xMin = FT_CEIL(p_pen->x);
-        p_bbox->xMax = FT_CEIL(p_pen->x + face->glyph->advance.x);
+        p_bbox->xMax = FT_CEIL(p_pen->x + i_x_advance);
         glyph_bmp->left = p_bbox->xMin;
     }
     if( p_bbox->yMin >= p_bbox->yMax )
     {
         p_bbox->yMax = FT_CEIL(p_pen->y);
-        p_bbox->yMin = FT_CEIL(p_pen->y + face->glyph->advance.y);
+        p_bbox->yMin = FT_CEIL(p_pen->y + i_y_advance);
         glyph_bmp->top  = p_bbox->yMax;
     }
 }
@@ -983,13 +984,16 @@ static int NewLayoutLine( filter_t *p_filter,
         }
 
         FixGlyph( p_bitmaps->p_glyph, &p_bitmaps->glyph_bbox,
-                  p_face, &pen_new );
+                  p_bitmaps->i_x_advance, p_bitmaps->i_y_advance,
+                  &pen_new );
         if( p_bitmaps->p_outline )
             FixGlyph( p_bitmaps->p_outline, &p_bitmaps->outline_bbox,
-                      p_face, &pen_new );
+                      p_bitmaps->i_x_advance, p_bitmaps->i_y_advance,
+                      &pen_new );
         if( p_bitmaps->p_shadow )
             FixGlyph( p_bitmaps->p_shadow, &p_bitmaps->shadow_bbox,
-                      p_face, &pen_shadow );
+                      p_bitmaps->i_x_advance, p_bitmaps->i_y_advance,
+                      &pen_shadow );
 
         int i_line_offset    = 0;
         int i_line_thickness = 0;



More information about the vlc-commits mailing list