[MPlayer-cvslog] r25879 - in trunk: gui/interface.c libmenu/vf_menu.c libvo/font_load.h libvo/font_load_ft.c libvo/sub.c

reimar subversion at mplayerhq.hu
Sun Jan 27 16:14:03 CET 2008


Author: reimar
Date: Sun Jan 27 16:14:02 2008
New Revision: 25879

Log:
Allow independent scaling of vo_font and sub_font.
Patch by Guillaume LECERF (foxcore gmail com).


Modified:
   trunk/gui/interface.c
   trunk/libmenu/vf_menu.c
   trunk/libvo/font_load.h
   trunk/libvo/font_load_ft.c
   trunk/libvo/sub.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	(original)
+++ trunk/gui/interface.c	Sun Jan 27 16:14:02 2008
@@ -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 )
   {

Modified: trunk/libmenu/vf_menu.c
==============================================================================
--- trunk/libmenu/vf_menu.c	(original)
+++ trunk/libmenu/vf_menu.c	Sun Jan 27 16:14:02 2008
@@ -206,7 +206,7 @@ static int config(struct vf_instance_s* 
   // 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)

Modified: trunk/libvo/font_load.h
==============================================================================
--- trunk/libvo/font_load.h	(original)
+++ trunk/libvo/font_load.h	Sun Jan 27 16:14:02 2008
@@ -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);

Modified: trunk/libvo/font_load_ft.c
==============================================================================
--- trunk/libvo/font_load_ft.c	(original)
+++ trunk/libvo/font_load_ft.c	Sun Jan 27 16:14:02 2008
@@ -940,7 +940,7 @@ int kerning(font_desc_t *desc, int prevc
     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 cha
 	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,
 	}
 	// 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);
 }

Modified: trunk/libvo/sub.c
==============================================================================
--- trunk/libvo/sub.c	(original)
+++ trunk/libvo/sub.c	Sun Jan 27 16:14:02 2008
@@ -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



More information about the MPlayer-cvslog mailing list