Commit e8ee1c23 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Freetype: Remove text_renderer.*

parent d817c978
...@@ -4,10 +4,10 @@ libtdummy_plugin_la_SOURCES = text_renderer/tdummy.c ...@@ -4,10 +4,10 @@ libtdummy_plugin_la_SOURCES = text_renderer/tdummy.c
text_LTLIBRARIES = libtdummy_plugin.la text_LTLIBRARIES = libtdummy_plugin.la
libfreetype_plugin_la_SOURCES = \ libfreetype_plugin_la_SOURCES = \
text_renderer/text_renderer.c text_renderer/text_renderer.h \
text_renderer/platform_fonts.c text_renderer/platform_fonts.h \ text_renderer/platform_fonts.c text_renderer/platform_fonts.h \
text_renderer/freetype.c text_renderer/freetype.h \ text_renderer/freetype.c text_renderer/freetype.h \
text_renderer/text_layout.c text_renderer/text_layout.h text_renderer/text_layout.c text_renderer/text_layout.h
libfreetype_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS) libfreetype_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS)
libfreetype_plugin_la_LIBADD = $(LIBM) $(FREETYPE_LIBS) libfreetype_plugin_la_LIBADD = $(LIBM) $(FREETYPE_LIBS)
if HAVE_FREETYPE if HAVE_FREETYPE
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
#include <assert.h> #include <assert.h>
#include "text_renderer.h"
#include "platform_fonts.h" #include "platform_fonts.h"
#include "freetype.h" #include "freetype.h"
#include "text_layout.h" #include "text_layout.h"
...@@ -1343,6 +1342,19 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -1343,6 +1342,19 @@ static void Destroy( vlc_object_t *p_this )
free( p_sys ); free( p_sys );
} }
bool FaceStyleEquals( const text_style_t *p_style1,
const text_style_t *p_style2 )
{
if( !p_style1 || !p_style2 )
return false;
if( p_style1 == p_style2 )
return true;
const int i_style_mask = STYLE_BOLD | STYLE_ITALIC;
return (p_style1->i_style_flags & i_style_mask) == (p_style2->i_style_flags & i_style_mask) &&
!strcmp( p_style1->psz_fontname, p_style2->psz_fontname );
}
FT_Face LoadFace( filter_t *p_filter, FT_Face LoadFace( filter_t *p_filter,
const text_style_t *p_style ) const text_style_t *p_style )
{ {
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef VLC_FREETYPE_H
#define VLC_FREETYPE_H
#include <vlc_text_style.h> /* text_style_t*/
typedef struct faces_cache_t typedef struct faces_cache_t
{ {
FT_Face *p_faces; FT_Face *p_faces;
...@@ -71,4 +76,22 @@ struct filter_sys_t ...@@ -71,4 +76,22 @@ struct filter_sys_t
#define FT_MulFix(v, s) (((v)*(s))>>16) #define FT_MulFix(v, s) (((v)*(s))>>16)
#endif #endif
#ifdef __OS2__
typedef uint16_t uni_char_t;
# define FREETYPE_TO_UCS "UCS-2LE"
#else
typedef uint32_t uni_char_t;
# if defined(WORDS_BIGENDIAN)
# define FREETYPE_TO_UCS "UCS-4BE"
# else
# define FREETYPE_TO_UCS "UCS-4LE"
# endif
#endif
FT_Face LoadFace( filter_t *p_filter, const text_style_t *p_style ); FT_Face LoadFace( filter_t *p_filter, const text_style_t *p_style );
bool FaceStyleEquals( const text_style_t *p_style1,
const text_style_t *p_style2 );
#endif
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
# include <hb-ft.h> # include <hb-ft.h>
#endif #endif
#include "text_renderer.h"
#include "text_layout.h" #include "text_layout.h"
#include "freetype.h" #include "freetype.h"
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include "freetype.h"
typedef struct typedef struct
{ {
FT_BitmapGlyph p_glyph; FT_BitmapGlyph p_glyph;
......
/*****************************************************************************
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002 - 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
* Bernie Purcell <bitmap@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* Felix Paul Kühne <fkuehne@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <vlc_common.h>
#include <vlc_variables.h>
#include <vlc_filter.h> /* filter_sys_t */
#include <vlc_xml.h> /* xml_reader */
#include <vlc_charset.h> /* ToCharset */
#include <vlc_strings.h> /* resolve_xml_special_chars */
#include "text_renderer.h"
text_style_t *CreateStyle( char *psz_fontname, int i_font_size,
uint32_t i_font_color, uint32_t i_karaoke_bg_color,
int i_style_flags )
{
text_style_t *p_style = text_style_New();
if( !p_style )
return NULL;
p_style->psz_fontname = psz_fontname ? strdup( psz_fontname ) : NULL;
p_style->i_font_size = i_font_size;
p_style->i_font_color = (i_font_color & 0x00ffffff) >> 0;
p_style->i_font_alpha = (i_font_color & 0xff000000) >> 24;
p_style->i_karaoke_background_color = (i_karaoke_bg_color & 0x00ffffff) >> 0;
p_style->i_karaoke_background_alpha = (i_karaoke_bg_color & 0xff000000) >> 24;
p_style->i_style_flags |= i_style_flags;
return p_style;
}
bool FaceStyleEquals( const text_style_t *p_style1,
const text_style_t *p_style2 )
{
if( !p_style1 || !p_style2 )
return false;
if( p_style1 == p_style2 )
return true;
const int i_style_mask = STYLE_BOLD | STYLE_ITALIC;
return (p_style1->i_style_flags & i_style_mask) == (p_style2->i_style_flags & i_style_mask) &&
!strcmp( p_style1->psz_fontname, p_style2->psz_fontname );
}
/*****************************************************************************
* text_renderer.h : fonts, text styles helpers
*****************************************************************************
* Copyright (C) 2002 - 2013 VLC authors and VideoLAN
* $Id$
*
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
* Bernie Purcell <bitmap@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* Felix Paul Kühne <fkuehne@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc_text_style.h> /* text_style_t*/
/* text_style_t functions */
text_style_t *CreateStyle( char *psz_fontname, int i_font_size,
uint32_t i_font_color, uint32_t i_karaoke_bg_color,
int i_style_flags );
#ifdef __OS2__
typedef uint16_t uni_char_t;
# define FREETYPE_TO_UCS "UCS-2LE"
#else
typedef uint32_t uni_char_t;
# if defined(WORDS_BIGENDIAN)
# define FREETYPE_TO_UCS "UCS-4BE"
# else
# define FREETYPE_TO_UCS "UCS-4LE"
# endif
#endif
bool FaceStyleEquals( const text_style_t *p_style1,
const text_style_t *p_style2 );
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment