This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 1f9888beb0606c6121dfe5c4777d7e9caf2fbe54 Author: Jun Zhao <[email protected]> AuthorDate: Sat May 30 18:27:30 2026 +0800 Commit: Jun Zhao <[email protected]> CommitDate: Tue Jun 2 00:52:03 2026 +0000 lavfi/vf_drawtext: fix HarfBuzz shaping of Bengali / Indic scripts shape_text_hb() set HB_SCRIPT_LATIN and called hb_buffer_guess_segment_properties() on an empty buffer, so the inference was a no-op. Bengali and other Indic / USE scripts reached the default OT shaper instead of their script-specific shaper, leaving the virama visible and consonants disjointed (e.g. স্টারমার rendered as স্ টারমার). Add the UTF-8 text first, keep the existing LTR direction used by the FriBidi visual-order pipeline, then guess segment properties so the script comes from the actual Unicode contents. Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/23014 Signed-off-by: Jun Zhao <[email protected]> --- libavfilter/vf_drawtext.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index c364b221d4..737431b858 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1371,16 +1371,20 @@ static int draw_glyphs(AVFilterContext *ctx, AVFrame *frame, static int shape_text_hb(DrawTextContext *s, HarfbuzzData* hb, const char* text, int textLen) { hb->buf = hb_buffer_create(); - if(!hb_buffer_allocation_successful(hb->buf)) + if (!hb_buffer_allocation_successful(hb->buf)) goto fail; + hb_buffer_add_utf8(hb->buf, text, textLen, 0, -1); + /* Preserve the existing FriBidi visual-order pipeline and the explicit + * language while letting HarfBuzz infer only the script, so complex + * scripts (Bengali / Indic / USE) are dispatched to the correct shaper. + * Setting the language explicitly keeps shaping deterministic and avoids + * the locale-dependent, non-threadsafe first hb_language_get_default(). */ hb_buffer_set_direction(hb->buf, HB_DIRECTION_LTR); - hb_buffer_set_script(hb->buf, HB_SCRIPT_LATIN); hb_buffer_set_language(hb->buf, hb_language_from_string("en", -1)); hb_buffer_guess_segment_properties(hb->buf); hb->font = hb_ft_font_create_referenced(s->face); - if(hb->font == NULL) + if (hb->font == NULL) goto fail; - hb_buffer_add_utf8(hb->buf, text, textLen, 0, -1); hb_shape(hb->font, hb->buf, NULL, 0); hb->glyph_info = hb_buffer_get_glyph_infos(hb->buf, &hb->glyph_count); hb->glyph_pos = hb_buffer_get_glyph_positions(hb->buf, &hb->glyph_count); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
