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

Francois Cartegnie git at videolan.org
Wed Jan 3 19:50:56 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan  3 17:50:14 2018 +0100| [77b78f491f73ef86645ce6065755eb696ce394ef] | committer: Francois Cartegnie

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

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

 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