Commit 88e4e6d1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

patches: fix subtitles font size rendering for non-bitmap, non-SSA subtitles (closes #19546)

parent 8eb2508b
From de4d690e85b426fac18bf22acb498e96493b5852 Mon Sep 17 00:00:00 2001
From 6e30c889b7859c4255e59763433e05c7793c864e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net>
Date: Sun, 17 Dec 2017 18:05:40 +0100
Subject: [PATCH 15/15] libvlc: add a basic API to change freetype's color,
......@@ -9,8 +9,8 @@ Subject: [PATCH 15/15] libvlc: add a basic API to change freetype's color,
lib/libvlc.sym | 6 +++
lib/media_player.c | 6 +++
lib/video.c | 69 ++++++++++++++++++++++++++++++-
modules/text_renderer/freetype/freetype.c | 22 ++++++++--
5 files changed, 124 insertions(+), 5 deletions(-)
modules/text_renderer/freetype/freetype.c | 31 ++++++++++++--
5 files changed, 133 insertions(+), 5 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 4336df9442..20b220448b 100644
......@@ -50,10 +50,10 @@ index 4336df9442..20b220448b 100644
/** \defgroup libvlc_audio LibVLC audio controls
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 9dbf0efa4e..a08c67ae46 100644
index 7c7fea02e6..2084cc62c2 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -261,6 +261,9 @@ libvlc_video_get_spu_count
@@ -259,6 +259,9 @@ libvlc_video_get_spu_count
libvlc_video_get_spu_delay
libvlc_video_get_spu_description
libvlc_video_get_teletext
......@@ -63,7 +63,7 @@ index 9dbf0efa4e..a08c67ae46 100644
libvlc_video_get_title_description
libvlc_video_get_track
libvlc_video_get_track_count
@@ -285,6 +288,9 @@ libvlc_video_set_spu
@@ -283,6 +286,9 @@ libvlc_video_set_spu
libvlc_video_set_spu_delay
libvlc_video_set_subtitle_file
libvlc_video_set_teletext
......@@ -74,7 +74,7 @@ index 9dbf0efa4e..a08c67ae46 100644
libvlc_video_take_snapshot
libvlc_video_new_viewpoint
diff --git a/lib/media_player.c b/lib/media_player.c
index ae72bb2b95..5f167bb4ad 100644
index a9a22fee15..90d59c014a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -694,6 +694,12 @@ libvlc_media_player_new( libvlc_instance_t *instance )
......@@ -182,10 +182,10 @@ index acbba3a30f..035cc0ebf1 100644
+ return get_string( p_mi, "freetype", textrenderer_option_bynumber(option) );
+}
diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index b7e4823e38..720870e9e3 100644
index 2595ef3872..0da1be9ede 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -943,12 +943,26 @@ static inline int RenderAXYZ( filter_t *p_filter,
@@ -943,12 +943,35 @@ static inline int RenderAXYZ( filter_t *p_filter,
static void UpdateDefaultLiveStyles( filter_t *p_filter )
{
......@@ -199,7 +199,7 @@ index b7e4823e38..720870e9e3 100644
+ p_sys->p_default_style->psz_fontname = strdup( var_InheritString( p_filter, "freetype-font" ) );
- p_style->i_font_color = var_InheritInteger( p_filter, "freetype-color" );
+ p_sys->p_forced_style->f_font_relsize = 1.0 / var_InheritInteger( p_filter, "freetype-rel-fontsize" );;
+ p_sys->p_forced_style->f_font_relsize = (1.0 / var_InheritInteger( p_filter, "freetype-rel-fontsize" )) * 100;
- p_style->i_background_alpha = var_InheritInteger( p_filter, "freetype-background-opacity" );
- p_style->i_background_color = var_InheritInteger( p_filter, "freetype-background-color" );
......@@ -213,6 +213,15 @@ index b7e4823e38..720870e9e3 100644
+ p_sys->p_forced_style->i_features &= ~STYLE_HAS_FLAGS;
+ }
+ text_style_Merge( p_sys->p_default_style, p_sys->p_forced_style, true );
+
+#ifndef NDEBUG
+ msg_Dbg(p_filter, "%s: def rel font size: %f, rel font size %f, %lli; color %i, font: %s", __func__,
+ p_filter->p_sys->p_default_style->f_font_relsize,
+ p_filter->p_sys->p_forced_style->f_font_relsize,
+ var_InheritInteger( p_filter, "freetype-rel-fontsize" ),
+ p_filter->p_sys->p_default_style->i_font_color,
+ p_filter->p_sys->p_default_style->psz_fontname);
+#endif
}
static void FillDefaultStyles( filter_t *p_filter )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment