avfilter/vf_drawtext: fix newline rendered as .notdef glyph

GET_UTF8 advances the pointer past the newline byte before the
newline check, so shape_text_hb receives text that includes the
newline character. Since HarfBuzz does not treat U+000A as
default-ignorable, it gets shaped into a .notdef glyph.

Fixes #21565

Reported-by: scriptituk <info@scriptit.uk>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit fd9f1e9c52)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Zhao Zhili 2026-03-23 20:10:12 +08:00 committed by Michael Niedermayer
parent 6444eb4b57
commit 864d4bf2da
No known key found for this signature in database
GPG key ID: B18E8928B3948D64

View file

@ -1451,13 +1451,14 @@ continue_on_failed:
s->tab_clusters[tab_idx++] = i;
*p = ' ';
}
size_t len = p - start;
GET_UTF8(code, *p ? *p++ : 0, code = 0xfffd; goto continue_on_failed2;);
continue_on_failed2:
if (ff_is_newline(code) || code == 0) {
TextLine *cur_line = &s->lines[line_count];
HarfbuzzData *hb = &cur_line->hb_data;
cur_line->cluster_offset = line_offset;
ret = shape_text_hb(s, hb, start, p - start);
ret = shape_text_hb(s, hb, start, len);
if (ret != 0) {
goto done;
}