[vlc-devel] commit: Freetype has had support for synthetic font styling for a while now ; add in support for it to vlc. (Bernie Purcell )
git version control
git at videolan.org
Tue Jan 12 23:34:08 CET 2010
vlc | branch: master | Bernie Purcell <bitmap at videolan.org> | Tue Jan 12 13:29:16 2010 +1100| [0ced77d8fdf5bfa94a9a6ef1de271bd970375624] | committer: Jean-Baptiste Kempf
Freetype has had support for synthetic font styling for a while now; add in support for it to vlc.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ced77d8fdf5bfa94a9a6ef1de271bd970375624
---
modules/misc/freetype.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index edc9528..ca49cbc 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -45,6 +45,7 @@
#include <math.h>
#include <ft2build.h>
+#include <freetype/ftsynth.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#define FT_FLOOR(X) ((X & -64) >> 6)
@@ -1489,7 +1490,8 @@ static ft_style_t *GetStyleFromFontStack( filter_sys_t *p_sys,
}
static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
- bool b_uline, bool b_through, int i_karaoke_bgcolor,
+ bool b_uline, bool b_through, bool b_bold,
+ bool b_italic, int i_karaoke_bgcolor,
line_desc_t *p_line, uint32_t *psz_unicode,
int *pi_pen_x, int i_pen_y, int *pi_start,
FT_Vector *p_result )
@@ -1551,6 +1553,16 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
p_line->pp_glyphs[ i ] = NULL;
return VLC_EGENERIC;
}
+
+ /* Do synthetic styling now that Freetype supports it;
+ * ie. if the font we have loaded is NOT already in the
+ * style that the tags want, then switch it on; if they
+ * are then don't. */
+ if (b_bold && !( p_face->style_flags & FT_STYLE_FLAG_BOLD ))
+ FT_GlyphSlot_Embolden( p_face->glyph );
+ if (b_italic && !( p_face->style_flags & FT_STYLE_FLAG_ITALIC ))
+ FT_GlyphSlot_Oblique( p_face->glyph );
+
i_error = FT_Get_Glyph( p_face->glyph, &tmp_glyph );
if( i_error )
{
@@ -2110,6 +2122,8 @@ static int ProcessLines( filter_t *p_filter,
if( RenderTag( p_filter, p_face ? p_face : p_sys->p_face,
p_style->i_font_color, p_style->b_underline,
p_style->b_through,
+ p_style->b_bold,
+ p_style->b_italic,
p_style->i_karaoke_bg_color,
p_line, psz_unicode, &i_pen_x, i_pen_y, &i_posn,
&tmp_result ) != VLC_SUCCESS )
More information about the vlc-devel
mailing list