Opened 2 years ago

Closed 21 months ago

#9745 closed defect (invalid)

[drawtext filter]fontconfig doesn't work well

Reported by: Hellena Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: drawtext, fontconfig, font-style
Cc: Hellena Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I want to use some style for drawtext filter, such as bold/italis/underline/strikeline.
In the document of ffmpeg filter, there's the example:

Use fontconfig to set the font. Note that the colons need to be escaped.
drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'

I try this code, but it only work when I use a few value, ex:style=bold.

ffmpeg -loglevel debug -i "mul/bg1.png" \
-filter_complex "[0]drawtext=x=50:y=60:\
fontfile='YuantiSC\\:style=underline\\:size=140\\:spacing=20':\
text=FFmpeg" \
-c:a aac -r 25 -s 720:1280 -c:v libx264 \
-pix_fmt yuv420p \
-y test_blod_cut5.mp4

The version I have checked in my computer is:
ffmpeg 5.0.1,fonconfig 2.14.0

Any problem in the code?
And how can I accomplish the requirment of underline/strikeline and so on.

Change History (1)

comment:1 by Marton Balint, 21 months ago

Resolution: invalid
Status: newclosed

I am not sure if fontconfig supports underline or strikethrough variants. I believe you can only select styles for which actual font variants are available. If you can specify underline/strikethrough with fontconfig keywords, then it should work, if you can't then this is rather a fontconfig limitation.

Note: See TracTickets for help on using tickets.