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

2016-12-08 Thread Lou Logan
On Wed, 30 Nov 2016 09:24:52 +, Andrey Utkin wrote:

> Thanks for your comments.
> 
> It's hard for me to stress the point of the approach further.
> 
> I wonder if it becomes clearer if we use
> 
> TEXT1="one"
> TEXT2="two"
> X2=100
> 
> in discussed scripts.
> 
> Maybe a paragraph describing the flaw of naive approach should be added
> to example annotation itself? I just followed the present pattern, that
> example description is very concise.

I don't think a script is needed for this example. It can be simplified
to something like:

Horizontally align multiple separate texts. Note that the
@option{fontsize} value is included in the @option{y} offset.

drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-30 Thread Andrey Utkin
On Tue, Nov 29, 2016 at 10:19:04AM -0900, l...@lrcd.com wrote:
> On Tue, Nov 29, 2016, at 09:55 AM, Andrey Utkin wrote:
> >
> > The point is that with more naive approach to printing parts of text,
> > using just same vertical offset (code given below), it will look fine in
> > some cases (e.g. all capital letters), but case of printing part with
> > capital letter(s) and part without capitals, the parts won't be aligned.
> >
> > With the following script, you'll see the dot floating at the top of "A"
> > letter:
>
> I already realized that, but this example may be confusing to users. I
> assume the close proximity of TEXT1 and TEXT2 were to demonstrate the
> "normalized" placement of various glyph heights for multiple drawtexts,
> but users may see this and wonder why you need to print "A.", with the
> characters close together as in your example, using two drawtexts when
> you could just use one (with text='A.'). Increasing X2 may make the
> example less confusing in that regard.

Thanks for your comments.

It's hard for me to stress the point of the approach further.

I wonder if it becomes clearer if we use

TEXT1="one"
TEXT2="two"
X2=100

in discussed scripts.

Maybe a paragraph describing the flaw of naive approach should be added
to example annotation itself? I just followed the present pattern, that
example description is very concise.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-29 Thread Lou Logan
On Tue, Nov 29, 2016, at 09:55 AM, Andrey Utkin wrote:
>
> The point is that with more naive approach to printing parts of text,
> using just same vertical offset (code given below), it will look fine in
> some cases (e.g. all capital letters), but case of printing part with
> capital letter(s) and part without capitals, the parts won't be aligned.
> 
> With the following script, you'll see the dot floating at the top of "A"
> letter:

I already realized that, but this example may be confusing to users. I
assume the close proximity of TEXT1 and TEXT2 were to demonstrate the
"normalized" placement of various glyph heights for multiple drawtexts,
but users may see this and wonder why you need to print "A.", with the
characters close together as in your example, using two drawtexts when
you could just use one (with text='A.'). Increasing X2 may make the
example less confusing in that regard.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-29 Thread Andrey Utkin
On Tue, Nov 29, 2016 at 09:31:08AM -0900, l...@lrcd.com wrote:
> On Mon, Nov 28, 2016, at 07:29 AM, Andrey Utkin wrote:
> > Dimensions of canvas drawtext produces vary depending on symbols in
> > text, so add example for printing multiple texts aligned horizontally.
> 
> I don't really understand the use case. Can you explain?

The point is that with more naive approach to printing parts of text,
using just same vertical offset (code given below), it will look fine in
some cases (e.g. all capital letters), but case of printing part with
capital letter(s) and part without capitals, the parts won't be aligned.

With the following script, you'll see the dot floating at the top of "A"
letter:

#!/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,
drawtext=fontfile=$FONTFILE:text=$TEXT2:fontsize=$FONTSIZE:x=$X2:y=$Y"
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-29 Thread Lou Logan
On Mon, Nov 28, 2016, at 07:29 AM, Andrey Utkin wrote:
> Dimensions of canvas drawtext produces vary depending on symbols in
> text, so add example for printing multiple texts aligned horizontally.

I don't really understand the use case. Can you explain?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-28 Thread Andrey Utkin
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 
---
 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=ff%@{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

+@item
+Print multiple different texts on same baseline:
+@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"
+@end example
+
 @end itemize

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




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel