0014-quartztext-fix-relative-font-size-handling.patch 1.94 KB
Newer Older
1
From 0c8633b1b61274c527c25cd8ab71d6034a3ea2be Mon Sep 17 00:00:00 2001
2 3
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Sun, 4 Aug 2013 19:50:19 +0200
4
Subject: [PATCH 14/17] quartztext: fix relative font size handling
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

---
 modules/text_renderer/quartztext.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/modules/text_renderer/quartztext.c b/modules/text_renderer/quartztext.c
index 4b25caa..eb5da4a 100644
--- a/modules/text_renderer/quartztext.c
+++ b/modules/text_renderer/quartztext.c
@@ -205,7 +205,7 @@ static int Create(vlc_object_t *p_this)
     p_sys->psz_font_name  = var_CreateGetString(p_this, "quartztext-font");
     p_sys->i_font_opacity = 255;
     p_sys->i_font_color = VLC_CLIP(var_CreateGetInteger(p_this, "quartztext-color") , 0, 0xFFFFFF);
-    p_sys->i_font_size    = GetFontSize(p_filter);
+    p_sys->i_font_size = GetFontSize(p_filter);
 
     p_filter->pf_render_text = RenderText;
     p_filter->pf_render_html = RenderHtml;
@@ -317,7 +317,7 @@ static int RenderText(filter_t *p_filter, subpicture_region_t *p_region_out,
     b_bold = b_uline = b_italic = FALSE;
     VLC_UNUSED(p_chroma_list);
 
-    p_sys->i_font_size    = GetFontSize(p_filter);
+    p_sys->i_font_size = GetFontSize(p_filter);
 
     // Sanity check
     if (!p_region_in || !p_region_out)
@@ -950,7 +950,18 @@ static offscreen_bitmap_t *Compose(int i_text_align,
 
 static int GetFontSize(filter_t *p_filter)
 {
-    return p_filter->fmt_out.video.i_height / DEFAULT_REL_FONT_SIZE;
+    int i_size = 0;
+
+    int i_ratio = var_CreateGetInteger( p_filter, "quartztext-rel-fontsize" );
+    if( i_ratio > 0 )
+        i_size = (int)p_filter->fmt_out.video.i_height / i_ratio;
+
+    if( i_size <= 0 )
+    {
+        msg_Warn( p_filter, "invalid fontsize, using 12" );
+        i_size = 12;
+    }
+    return i_size;
 }
 
 static int RenderYUVA(filter_t *p_filter, subpicture_region_t *p_region,
-- 
53
1.8.3.4 (Apple Git-47)
54