Skip to content

Commit fd9f1e9

Browse files
quink-blackZhao Zhili
authored andcommitted
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 <[email protected]> Signed-off-by: Zhao Zhili <[email protected]>
1 parent 0f600cb commit fd9f1e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libavfilter/vf_drawtext.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,13 +1452,14 @@ static int measure_text(AVFilterContext *ctx, TextMetrics *metrics)
14521452
s->tab_clusters[tab_idx++] = i;
14531453
*p = ' ';
14541454
}
1455+
size_t len = p - start;
14551456
GET_UTF8(code, *p ? *p++ : 0, code = 0xfffd; goto continue_on_failed2;);
14561457
continue_on_failed2:
14571458
if (ff_is_newline(code) || code == 0) {
14581459
TextLine *cur_line = &s->lines[line_count];
14591460
HarfbuzzData *hb = &cur_line->hb_data;
14601461
cur_line->cluster_offset = line_offset;
1461-
ret = shape_text_hb(s, hb, start, p - start);
1462+
ret = shape_text_hb(s, hb, start, len);
14621463
if (ret != 0) {
14631464
goto done;
14641465
}

0 commit comments

Comments
 (0)