Ticket #340: MPlayer-1.0pre7-subfont-ratio.diff

File MPlayer-1.0pre7-subfont-ratio.diff, 3.0 KB (added by nicolas.george@…, 21 years ago)

adds the -subfont-ratio option

  • cfg-common.h

    diff -ru MPlayer-1.0pre7-orig/cfg-common.h MPlayer-1.0pre7/cfg-common.h
    old new  
    278278        {"subfont-blur", &subtitle_font_radius, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
    279279        {"subfont-outline", &subtitle_font_thickness, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
    280280        {"subfont-autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
     281        {"subfont-ratio", &subtitle_font_ratio, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL },
    281282#endif
    282283#ifdef HAVE_FONTCONFIG
    283284        {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 0, 1, NULL},
  • libvo/font_load.h

    diff -ru MPlayer-1.0pre7-orig/libvo/font_load.h MPlayer-1.0pre7/libvo/font_load.h
    old new  
    7070extern float osd_font_scale_factor;
    7171extern float subtitle_font_radius;
    7272extern float subtitle_font_thickness;
     73extern float subtitle_font_ratio;
    7374extern int subtitle_autoscale;
    7475
    7576extern int vo_image_width;
  • libvo/font_load_ft.c

    diff -ru MPlayer-1.0pre7-orig/libvo/font_load_ft.c MPlayer-1.0pre7/libvo/font_load_ft.c
    old new  
    4545float osd_font_scale_factor = 6.0;
    4646float subtitle_font_radius = 2.0;
    4747float subtitle_font_thickness = 2.0;
     48float subtitle_font_ratio = 1.0;
    4849// 0 = no autoscale
    4950// 1 = video height
    5051// 2 = video width
     
    123124    int         width, height;
    124125    unsigned char *bbuffer;
    125126    int i, uni_charmap = 1;
     127    float xppem = ppem, yppem = ppem * subtitle_font_ratio;
    126128   
    127129    error = FT_Select_Charmap(face, ft_encoding_unicode);
    128130//    fprintf(stderr, "select unicode charmap: %d\n", error);
     
    136138
    137139    /* set size */
    138140    if (FT_IS_SCALABLE(face)) {
    139         error = FT_Set_Char_Size(face, 0, floatTof266(ppem), 0, 0);
     141        error = FT_Set_Char_Size(face, floatTof266(xppem), floatTof266(yppem), 0, 0);
    140142        if (error) WARNING("FT_Set_Char_Size failed.");
    141143    } else {
    142144        int j = 0;
     
    190192//    fprintf(stderr, "font height: %lf\n", (double)(face->bbox.yMax-face->bbox.yMin)/(double)face->units_per_EM*ppem);
    191193//    fprintf(stderr, "font width: %lf\n", (double)(face->bbox.xMax-face->bbox.xMin)/(double)face->units_per_EM*ppem);
    192194
    193     ymax = (double)(face->bbox.yMax)/(double)face->units_per_EM*ppem+1;
    194     ymin = (double)(face->bbox.yMin)/(double)face->units_per_EM*ppem-1;
     195    ymax = (double)(face->bbox.yMax)/(double)face->units_per_EM*yppem+1;
     196    ymin = (double)(face->bbox.yMin)/(double)face->units_per_EM*yppem-1;
    195197   
    196     width = ppem*(face->bbox.xMax-face->bbox.xMin)/face->units_per_EM+3+2*padding;
     198    width = xppem*(face->bbox.xMax-face->bbox.xMin)/face->units_per_EM+3+2*padding;
    197199    if (desc->max_width < width) desc->max_width = width;
    198200    width = ALIGN(width);
    199201    desc->pic_b[pic_idx]->charwidth = width;