1 /*****************************************************************************
2 * text_renderer.h : fonts, text styles helpers
3 *****************************************************************************
4 * Copyright (C) 2002 - 2013 VLC authors and VideoLAN
7 * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
8 * Gildas Bazin <gbazin@videolan.org>
9 * Bernie Purcell <bitmap@videolan.org>
10 * Jean-Baptiste Kempf <jb@videolan.org>
11 * Felix Paul Kühne <fkuehne@videolan.org>
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 2.1 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, write to the Free Software Foundation, Inc.,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
28 #include <vlc_text_style.h> /* text_style_t*/
30 /* fonts and font_stack_t functions */
31 typedef struct font_stack_t font_stack_t;
36 uint32_t i_color; /* ARGB */
37 uint32_t i_karaoke_bg_color; /* ARGB */
42 int PushFont( font_stack_t **p_font, const char *psz_name, int i_size,
43 uint32_t i_color, uint32_t i_karaoke_bg_color );
45 int PopFont( font_stack_t **p_font );
47 int PeekFont( font_stack_t **p_font, char **psz_name, int *i_size,
48 uint32_t *i_color, uint32_t *i_karaoke_bg_color );
50 int HandleFontAttributes( xml_reader_t *p_xml_reader,
51 font_stack_t **p_fonts );
53 int HandleTT(font_stack_t **p_fonts, const char *p_fontfamily );
55 /* Turn any multiple-whitespaces into single spaces */
56 void HandleWhiteSpace( char *psz_node );
58 /* text_style_t functions */
59 text_style_t *CreateStyle( char *psz_fontname, int i_font_size,
60 uint32_t i_font_color, uint32_t i_karaoke_bg_color,
63 text_style_t *GetStyleFromFontStack( filter_t *p_filter,
64 font_stack_t **p_fonts,
69 typedef uint16_t uni_char_t;
70 # define FREETYPE_TO_UCS "UCS-2LE"
72 typedef uint32_t uni_char_t;
73 # if defined(WORDS_BIGENDIAN)
74 # define FREETYPE_TO_UCS "UCS-4BE"
76 # define FREETYPE_TO_UCS "UCS-4LE"
80 unsigned SetupText( filter_t *p_filter,
81 uni_char_t *psz_text_out,
82 text_style_t **pp_styles,
84 const char *psz_text_in,
85 text_style_t *p_style,
88 bool FaceStyleEquals( const text_style_t *p_style1,
89 const text_style_t *p_style2 );
92 int ProcessNodes( filter_t *p_filter,
94 text_style_t **pp_styles,
97 xml_reader_t *p_xml_reader,
98 text_style_t *p_font_style,
99 text_style_t *p_default_style );