2009-02-08 03:27:30 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_FONT_LOAD_H
|
|
|
|
#define MPLAYER_FONT_LOAD_H
|
2002-08-28 20:52:02 +00:00
|
|
|
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_FREETYPE
|
2003-11-20 16:25:40 +00:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
2002-08-28 20:52:02 +00:00
|
|
|
#endif
|
2001-03-25 04:28:40 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char *bmp;
|
|
|
|
unsigned char *pal;
|
|
|
|
int w,h,c;
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_FREETYPE
|
2002-08-28 20:52:02 +00:00
|
|
|
int charwidth,charheight,pen,baseline,padding;
|
|
|
|
int current_count, current_alloc;
|
|
|
|
#endif
|
2001-03-25 04:28:40 +00:00
|
|
|
} raw_file;
|
|
|
|
|
2008-06-09 09:37:25 +00:00
|
|
|
typedef struct font_desc {
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_FREETYPE
|
2002-08-29 17:35:21 +00:00
|
|
|
int dynamic;
|
|
|
|
#endif
|
2001-03-25 19:10:52 +00:00
|
|
|
char *name;
|
2001-07-20 00:01:09 +00:00
|
|
|
char *fpath;
|
2001-03-25 04:28:40 +00:00
|
|
|
int spacewidth;
|
|
|
|
int charspace;
|
|
|
|
int height;
|
|
|
|
// char *fname_a;
|
|
|
|
// char *fname_b;
|
|
|
|
raw_file* pic_a[16];
|
|
|
|
raw_file* pic_b[16];
|
2001-05-06 02:26:17 +00:00
|
|
|
short font[65536];
|
2002-05-02 01:56:28 +00:00
|
|
|
int start[65536]; // short is not enough for unicode fonts
|
2001-05-06 02:26:17 +00:00
|
|
|
short width[65536];
|
2002-12-29 14:59:23 +00:00
|
|
|
int freetype;
|
2002-08-28 20:52:02 +00:00
|
|
|
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_FREETYPE
|
2002-08-28 20:52:02 +00:00
|
|
|
int face_cnt;
|
|
|
|
|
|
|
|
FT_Face faces[16];
|
|
|
|
FT_UInt glyph_index[65536];
|
|
|
|
|
|
|
|
int max_width, max_height;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int g_r;
|
|
|
|
int o_r;
|
|
|
|
int g_w;
|
|
|
|
int o_w;
|
|
|
|
int o_size;
|
|
|
|
unsigned volume;
|
|
|
|
|
|
|
|
unsigned *g;
|
|
|
|
unsigned *gt2;
|
|
|
|
unsigned *om;
|
|
|
|
unsigned char *omt;
|
|
|
|
unsigned short *tmp;
|
|
|
|
} tables;
|
|
|
|
#endif
|
|
|
|
|
2001-03-25 04:28:40 +00:00
|
|
|
} font_desc_t;
|
|
|
|
|
2002-03-24 00:32:13 +00:00
|
|
|
extern font_desc_t* vo_font;
|
2007-05-20 16:10:45 +00:00
|
|
|
extern font_desc_t* sub_font;
|
2002-03-24 00:32:13 +00:00
|
|
|
|
2002-08-28 20:52:02 +00:00
|
|
|
extern char *subtitle_font_encoding;
|
|
|
|
extern float text_font_scale_factor;
|
|
|
|
extern float osd_font_scale_factor;
|
|
|
|
extern float subtitle_font_radius;
|
|
|
|
extern float subtitle_font_thickness;
|
|
|
|
extern int subtitle_autoscale;
|
|
|
|
|
|
|
|
extern int vo_image_width;
|
|
|
|
extern int vo_image_height;
|
|
|
|
|
|
|
|
extern int force_load_font;
|
|
|
|
|
2006-02-09 14:08:03 +00:00
|
|
|
int init_freetype(void);
|
|
|
|
int done_freetype(void);
|
2002-08-28 20:52:02 +00:00
|
|
|
|
2009-01-06 16:44:47 +00:00
|
|
|
font_desc_t* read_font_desc_ft(const char* fname,int face_index,int movie_width, int movie_height, float font_scale_factor);
|
2002-08-28 20:52:02 +00:00
|
|
|
void free_font_desc(font_desc_t *desc);
|
|
|
|
|
|
|
|
void render_one_glyph(font_desc_t *desc, int c);
|
|
|
|
int kerning(font_desc_t *desc, int prevc, int c);
|
|
|
|
|
2008-01-27 15:14:02 +00:00
|
|
|
void load_font_ft(int width, int height, font_desc_t **desc, const char *name, float font_scale_factor);
|
2002-08-28 20:52:02 +00:00
|
|
|
|
2006-09-16 13:32:19 +00:00
|
|
|
void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height,
|
|
|
|
int stride, int *m2, int r, int mwidth);
|
|
|
|
|
2002-12-29 14:59:23 +00:00
|
|
|
raw_file* load_raw(char *name,int verbose);
|
2006-07-09 17:45:36 +00:00
|
|
|
font_desc_t* read_font_desc(const char* fname,float factor,int verbose);
|
2002-12-29 14:59:23 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_FONT_LOAD_H */
|