[vlc-commits] [Git][videolan/vlc][3.0.x] freetype: avoid very large fonts in portrait mode

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Mar 1 13:26:12 UTC 2025



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
aed678eb by Steve Lhomme at 2025-02-28T13:38:56+01:00
freetype: avoid very large fonts in portrait mode

Either when the video is in portrait mode or when the subtitles
are shown in the black bars and the video area is in portrait mode,
the text can become very large just because we apply a percentage base on
the output height.

We switch mode when the height becomes bigger than the width
so there's a continuity in the ratio when growing/shrinking the
video in one direction or the other.

(cherry picked from commit e25ec4e25be1f2620ec031d2ef7bf5a09809235d)

- - - - -


1 changed file:

- modules/text_renderer/freetype/platform_fonts.c


Changes:

=====================================
modules/text_renderer/freetype/platform_fonts.c
=====================================
@@ -464,7 +464,11 @@ int ConvertToLiveSize( filter_t *p_filter, const text_style_t *p_style )
     }
     else if ( p_style->f_font_relsize )
     {
-        i_font_size = (int) p_filter->fmt_out.video.i_height * p_style->f_font_relsize / 100;
+        unsigned area_height = p_filter->fmt_out.video.i_height;
+        if (p_filter->fmt_out.video.i_height > p_filter->fmt_out.video.i_width )
+            // portrait mode leads to very large text
+            area_height = p_filter->fmt_out.video.i_width;
+        i_font_size = (int) area_height * p_style->f_font_relsize / 100;
     }
 
     if( p_sys->i_scale != 100 )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/aed678ebbb47b88de66ce343515b6aadc3ae5c10

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/aed678ebbb47b88de66ce343515b6aadc3ae5c10
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list