[FFmpeg-devel] [PATCH] support set words' space
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 21 01:22:49 EEST 2017
On Thu, Jul 20, 2017 at 10:02:25AM +0800, efren yang wrote:
> vf_drawtext.c | 3 +++
> 1 file changed, 3 insertions(+)
> 369e0f0b0e08f3417e2e8206595cea4455561dae 0001-support-set-words-space.patch
> From e02dd9859dee662d2e34428541058520495655b4 Mon Sep 17 00:00:00 2001
> From: efrenyang <efren_yang at 163.com>
> Date: Wed, 19 Jul 2017 19:01:13 +0800
> Subject: [PATCH] support set words' space
>
> Signed-off-by: efrenyang <efren_yang at 163.com>
> ---
> libavfilter/vf_drawtext.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index f6151443bb..17eeb85425 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -162,6 +162,7 @@ typedef struct DrawTextContext {
> unsigned int default_fontsize; ///< default font size to use
>
> int line_spacing; ///< lines spacing in pixels
> + int word_spacing; ///< word spacing in pixels
> short int draw_box; ///< draw box around text - true or false
> int boxborderw; ///< box border width
> int use_kerning; ///< font kerning is used - true/false
> @@ -214,6 +215,7 @@ static const AVOption drawtext_options[]= {
> {"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 , FLAGS},
> {"boxborderw", "set box border width", OFFSET(boxborderw), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX , FLAGS},
> {"line_spacing", "set line spacing in pixels", OFFSET(line_spacing), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX,FLAGS},
> + { "word_spacing", "set text spacing in pixels", OFFSET(word_spacing), AV_OPT_TYPE_INT,{ .i64 = 0 }, INT_MIN, INT_MAX,FLAGS },
> {"fontsize", "set font size", OFFSET(fontsize_expr), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX , FLAGS},
> {"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS},
> {"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX, FLAGS},
> @@ -1374,6 +1376,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
> s->positions[i].y = y - glyph->bitmap_top + y_max;
> if (code == '\t') x = (x / s->tabsize + 1)*s->tabsize;
> else x += glyph->advance;
> + x += s->word_spacing;
This needs some kind of overflow check or some more restrictive
limit than INT_MAX/MIN
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170721/cf743987/attachment.sig>
More information about the ffmpeg-devel
mailing list