FS-9740 #resolve [Improve font scaling on banners]

This commit is contained in:
Anthony Minessale 2016-11-15 11:37:16 -06:00
parent b4e8be56e6
commit 1b268de5e2
1 changed files with 5 additions and 6 deletions

View File

@ -855,11 +855,11 @@ void conference_video_layer_set_banner(conference_member_t *member, mcu_layer_t
} }
} }
if (layer->screen_h < layer->screen_w) { if (!text) text = "N/A";
font_size = (uint16_t)((double)(font_scale / 100.0f) * layer->screen_h); font_size = (uint16_t)((double)(font_scale / 100.0f) * (layer->screen_w - (strlen(text) * 10)));
} else {
font_size = (uint16_t)((double)(font_scale / 100.0f) * layer->screen_w); if (font_size <= 5) font_size = 5;
} if (font_size >= 24) font_size = 24;
switch_color_set_rgb(&fgcolor, fg); switch_color_set_rgb(&fgcolor, fg);
switch_color_set_rgb(&bgcolor, bg); switch_color_set_rgb(&bgcolor, bg);
@ -884,7 +884,6 @@ void conference_video_layer_set_banner(conference_member_t *member, mcu_layer_t
//switch_img_free(&layer->logo_img); //switch_img_free(&layer->logo_img);
//switch_img_free(&layer->logo_text_img); //switch_img_free(&layer->logo_text_img);
layer->banner_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, layer->screen_w, font_size * 2, 1); layer->banner_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, layer->screen_w, font_size * 2, 1);
conference_video_reset_image(layer->banner_img, &bgcolor); conference_video_reset_image(layer->banner_img, &bgcolor);
switch_img_txt_handle_render(layer->txthandle, layer->banner_img, font_size / 2, font_size / 2, text, NULL, fg, bg, 0, 0); switch_img_txt_handle_render(layer->txthandle, layer->banner_img, font_size / 2, font_size / 2, text, NULL, fg, bg, 0, 0);