Allow independent scaling of vo_font and sub_font.

Patch by Guillaume LECERF (foxcore gmail com).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25879 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-01-27 15:14:02 +00:00
parent 131683f8f3
commit fbae3928cd
5 changed files with 16 additions and 16 deletions

View File

@ -384,7 +384,7 @@ extern m_obj_settings_t * vf_settings;
void guiLoadFont( void )
{
#ifdef HAVE_FREETYPE
load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name);
load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor);
#else
if ( vo_font )
{

View File

@ -206,7 +206,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
// here is the right place to get screen dimensions
if (force_load_font) {
force_load_font = 0;
load_font_ft(width,height,&vo_font,font_name);
load_font_ft(width,height,&vo_font,font_name,osd_font_scale_factor);
}
#endif
if(outfmt == IMGFMT_MPEGPES)

View File

@ -81,13 +81,13 @@ extern int force_load_font;
int init_freetype(void);
int done_freetype(void);
font_desc_t* read_font_desc_ft(const char* fname,int movie_width, int movie_height);
font_desc_t* read_font_desc_ft(const char* fname,int movie_width, int movie_height, float font_scale_factor);
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);
void load_font_ft(int width, int height, font_desc_t **desc, const char *name);
void load_font_ft(int width, int height, font_desc_t **desc, const char *name, float font_scale_factor);
void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height,
int stride, int *m2, int r, int mwidth);

View File

@ -940,7 +940,7 @@ int kerning(font_desc_t *desc, int prevc, int c)
return f266ToInt(kern.x);
}
font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_height)
font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_height, float font_scale_factor)
{
font_desc_t *desc = NULL;
@ -980,8 +980,8 @@ font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_hei
break;
}
subtitle_font_ppem = movie_size*text_font_scale_factor/100.0;
osd_font_ppem = movie_size*osd_font_scale_factor/100.0;
subtitle_font_ppem = movie_size*font_scale_factor/100.0;
osd_font_ppem = movie_size*(font_scale_factor+1)/100.0;
if (subtitle_font_ppem < 5) subtitle_font_ppem = 5;
if (osd_font_ppem < 5) osd_font_ppem = 5;
@ -1122,7 +1122,7 @@ int done_freetype(void)
return 0;
}
void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_name)
void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_name, float font_scale_factor)
{
#ifdef HAVE_FONTCONFIG
FcPattern *fc_pattern;
@ -1163,10 +1163,10 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n
}
// s doesn't need to be freed according to fontconfig docs
FcPatternGetString(fc_pattern, FC_FILE, 0, &s);
*fontp=read_font_desc_ft(s, width, height);
*fontp=read_font_desc_ft(s, width, height, font_scale_factor);
FcPatternDestroy(fc_pattern);
}
else
#endif
*fontp=read_font_desc_ft(font_name, width, height);
*fontp=read_font_desc_ft(font_name, width, height, font_scale_factor);
}

View File

@ -1090,22 +1090,22 @@ int vo_update_osd(int dxs,int dys){
if (force_load_font) {
force_load_font = 0;
load_font_ft(dxs, dys, &vo_font, font_name);
load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor);
if (sub_font_name)
load_font_ft(dxs, dys, &sub_font, sub_font_name);
load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor);
else
sub_font = vo_font;
load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor);
prev_dxs = dxs;
prev_dys = dys;
defer_counter = 0;
} else {
if (!vo_font)
load_font_ft(dxs, dys, &vo_font, font_name);
load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor);
if (!sub_font) {
if (sub_font_name)
load_font_ft(dxs, dys, &sub_font, sub_font_name);
load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor);
else
sub_font = vo_font;
load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor);
}
}
#endif