1
0

avfilter/vf_drawtext: improve glyph shaping and positioning

- text is now shaped using libharfbuz
- glyphs position is now accurate to 1/4 pixel in both directions
- the default line height is now the one defined in the font

Adds libharfbuzz dependency.
This commit is contained in:
yethie 2023-05-26 12:11:41 +02:00 committed by Paul B Mahol
parent ba00ed33e5
commit 1eeb59a209
3 changed files with 595 additions and 283 deletions

5
configure vendored
View File

@ -236,6 +236,7 @@ External library support:
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
--enable-libfreetype enable libfreetype, needed for drawtext filter [no]
--enable-libfribidi enable libfribidi, improves drawtext filter [no]
--enable-libharfbuzz enable libharfbuzz, needed for drawtext filter [no]
--enable-libglslang enable GLSL->SPIRV compilation via libglslang [no]
--enable-libgme enable Game Music Emu via libgme [no]
--enable-libgsm enable GSM de/encoding via libgsm [no]
@ -1859,6 +1860,7 @@ EXTERNAL_LIBRARY_LIST="
libfontconfig
libfreetype
libfribidi
libharfbuzz
libglslang
libgme
libgsm
@ -3726,7 +3728,7 @@ dilation_opencl_filter_deps="opencl"
dnn_classify_filter_select="dnn"
dnn_detect_filter_select="dnn"
dnn_processing_filter_select="dnn"
drawtext_filter_deps="libfreetype"
drawtext_filter_deps="libfreetype libharfbuzz"
drawtext_filter_suggest="libfontconfig libfribidi"
elbg_filter_deps="avcodec"
eq_filter_deps="gpl"
@ -6693,6 +6695,7 @@ enabled fontconfig && enable libfontconfig
enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||

View File

@ -12344,7 +12344,7 @@ Draw a text string or text from a specified file on top of a video, using the
libfreetype library.
To enable compilation of this filter, you need to configure FFmpeg with
@code{--enable-libfreetype}.
@code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
To enable default font fallback and the @var{font} option you need to
configure FFmpeg with @code{--enable-libfontconfig}.
To enable the @var{text_shaping} option, you need to configure FFmpeg with
@ -12372,8 +12372,7 @@ option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,
The default value of @var{boxcolor} is "white".
@item line_spacing
Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
The default value of @var{line_spacing} is 0.
Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
@item borderw
Set the width of the border to be drawn around the text using @var{bordercolor}.
@ -12873,6 +12872,9 @@ For more information about fontconfig, check:
For more information about libfribidi, check:
@url{http://fribidi.org/}.
For more information about libharfbuzz, check:
@url{https://github.com/harfbuzz/harfbuzz}.
@section edgedetect
Detect and draw edges. The filter uses the Canny Edge Detection algorithm.

File diff suppressed because it is too large Load Diff