Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Francesco Carusi <klimklim@tiscali.it>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] proposal for a minor change in the behavior of the drawtext filter
Date: Fri, 22 Apr 2022 14:48:18 +0200
Message-ID: <ea18eb19-efcd-2018-171f-c24f4b04b540@tiscali.it> (raw)
In-Reply-To: <20220422103045.GU2829255@pb2>

[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]


On 22/04/2022 12:30, Michael Niedermayer wrote:
> On Fri, Apr 22, 2022 at 12:01:31PM +0200, Francesco Carusi wrote:
>> Hello ffmpeg team,
>>
>> I'm working on an enhanced version of the drawtext filter and would like to
>> discuss with you about a minor change in its behavior related to line
>> spacing management.
>> In the current implementation the space between two lines of text is set
>> equal to the height of the highest glyph found in the text plus the optional
>> user defined "line_spacing" parameter (which defaults to 0):
>>
>> line_height = max_glyph_h + line_spacing
>>
>> This has some drawbacks:
>> 1) the line height depends on the text
>>      See image "line_height-old.png" (the blue lines where added by me)
>>      The filter is applied three times with tree slightly different texts:
>> the line_spacing parameter was not specified,
>>      but the actual line height changes due to the different heights of the
>> glyphs
>> 2) the line height is not consistent between the same text being rendered by
>> the filter and by external tools
>>
>> The proposed change is:
>> 1) the default line height is set to the font-defined line height
>> 2) the line_spacing parameter, if specified, sets the actual line height
>> (line_height = line_spacing)
>> 3) the default value of line_spacing is set to -1 (which means: use the
>> default line height)
>>
>> The image "line_height-new.png" shows the effect of the new behavior.
>>
>> Which is the impact of the change?
>> A) users using the line_spacing parameter would see less space between lines
>> B) users not using the line_spacing parameter would see (in most cases) more
>> space between lines
>>
>> Can the impact be mitigated?
>> Well, yes, we may add a new parameter named 'line_height' and deprecate
>> 'line_spacing', in this way anyone using line_spacing explicitly would not
>> see any change in the filter behavior. I don't like this solution but it may
>> help reducing the impact of the change.
> just looking at the pngs, the old looks bad, the new looks like it has alot
> more space then reasonable.
> If i just compare this to any GUI text editor theres not that much space
> between lines and at the same time the spacing is constant.
> why can that not be achieved ?
>
> thx

Hi Michael,

the space you see is the one defined at the font level. I created the 
same images using the Arial font, which has a smaller height, please see 
the attachments. The height must also leave enough space for cases in 
which a glyph with a long descender on the upper row "meets" a glyph 
with a long ascender on the bottom row (see "line_height-new-arial2.png").

thanks

[-- Attachment #2: line_height-new-arial.png --]
[-- Type: image/png, Size: 16775 bytes --]

[-- Attachment #3: line_height-new-arial2.png --]
[-- Type: image/png, Size: 20547 bytes --]

[-- Attachment #4: line_height-old-arial.png --]
[-- Type: image/png, Size: 22756 bytes --]

[-- Attachment #5: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-04-22 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 10:01 Francesco Carusi
2022-04-22 10:30 ` Michael Niedermayer
2022-04-22 12:48   ` Francesco Carusi [this message]
2022-04-22 13:22     ` Michael Koch
2022-04-22 15:07       ` Francesco Carusi
2022-04-22 15:57         ` Michael Koch
2022-04-24 10:07 ` Nicolas George
2022-04-26 10:15   ` Francesco Carusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea18eb19-efcd-2018-171f-c24f4b04b540@tiscali.it \
    --to=klimklim@tiscali.it \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git