[vlc-commits] codec: substext: rebase font size px as % of video size

Francois Cartegnie git at videolan.org
Fri Jan 5 15:49:33 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan  3 17:50:14 2018 +0100| [e90bf390da0ba34410bf7f0c2bae3b889caad69c] | committer: Jean-Baptiste Kempf

codec: substext: rebase font size px as % of video size

(cherry picked from commit 77b78f491f73ef86645ce6065755eb696ce394ef)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e90bf390da0ba34410bf7f0c2bae3b889caad69c
---

 modules/codec/substext.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/codec/substext.h b/modules/codec/substext.h
index 2ece70a909..af98c2351c 100644
--- a/modules/codec/substext.h
+++ b/modules/codec/substext.h
@@ -233,12 +233,12 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
 
             if( p_segment->style )
             {
-                /* Update all segments font sizes in pixels, *** metric used by renderers *** */
-                /* We only do this when a fixed font size isn't set */
-                if( p_segment->style && p_segment->style->f_font_relsize && !p_segment->style->i_font_size )
+                /* Update all segments font sizes in video source %,
+                 * so we can handle HiDPI properly and have consistent rendering limits */
+                 if( p_segment->style->i_font_size > 0 && fmt_src->i_visible_height > 0 )
                 {
-                    p_segment->style->i_font_size = p_segment->style->f_font_relsize *
-                                                    subpic->i_original_picture_height / 100;
+                    p_segment->style->f_font_relsize = 100.0 * p_segment->style->i_font_size / fmt_src->i_visible_height;
+                    p_segment->style->i_font_size = 0;
                 }
 
                 if( p_segment->style->i_style_flags & (STYLE_BLINK_BACKGROUND|STYLE_BLINK_FOREGROUND) )



More information about the vlc-commits mailing list