[FFmpeg-devel] [PATCH] doc/filters: drawtext: add example of printing texts on same baseline

Andrey Utkin andrey.utkin at pb.com
Mon Nov 28 18:29:29 EET 2016


Dimensions of canvas drawtext produces vary depending on symbols in
text, so add example for printing multiple texts aligned horizontally.

Signed-off-by: Andrey Utkin <andrey.utkin at pb.com>
---
 doc/filters.texi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index b3899b2693..c740b2671e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7134,6 +7134,22 @@ FOD=5 # fade out duration
 ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
 @end example

+ at item
+Print multiple different texts on same baseline:
+ at example
+#!/bin/sh
+FONTFILE=font.ttf
+FONTSIZE=32
+Y=10 # vertical offset of texts
+X1=10 # horizontal offset of first text
+X2=30 # horizontal offset of second text
+TEXT1="A"
+TEXT2="."
+ffplay -f lavfi -i "color=color=white,
+drawtext=fontfile=$FONTFILE:text=$TEXT1:fontsize=$FONTSIZE:x=$X1:y=$Y+$FONTSIZE-max_glyph_a,
+drawtext=fontfile=$FONTFILE:text=$TEXT2:fontsize=$FONTSIZE:x=$X2:y=$Y+$FONTSIZE-max_glyph_a"
+ at end example
+
 @end itemize

 For more information about libfreetype, check:
--
2.11.0.rc2


________________________________



More information about the ffmpeg-devel mailing list