This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit d0922699966c6055869532244b38cad391f8298f Author: Jun Zhao <[email protected]> AuthorDate: Sun May 10 20:17:55 2026 +0800 Commit: Jun Zhao <[email protected]> CommitDate: Tue Jun 2 00:52:03 2026 +0000 lavfi/vf_drawtext: log inferred shaping properties at verbose Log the script and direction picked by HarfBuzz, plus codepoint and glyph counts, so the shaper choice can be verified. Differing codepoint and glyph counts indicate reordering / ligation / decomposition. Codepoints are sampled before hb_shape(), which flips the buffer content type to GLYPHS. Signed-off-by: Jun Zhao <[email protected]> --- libavfilter/vf_drawtext.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 737431b858..2ccb03600e 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1368,8 +1368,11 @@ static int draw_glyphs(AVFilterContext *ctx, AVFrame *frame, } // Shapes a line of text using libharfbuzz -static int shape_text_hb(DrawTextContext *s, HarfbuzzData* hb, const char* text, int textLen) +static int shape_text_hb(AVFilterContext *ctx, DrawTextContext *s, + HarfbuzzData *hb, const char *text, int textLen) { + unsigned codepoints; + hb->buf = hb_buffer_create(); if (!hb_buffer_allocation_successful(hb->buf)) goto fail; @@ -1382,6 +1385,9 @@ static int shape_text_hb(DrawTextContext *s, HarfbuzzData* hb, const char* text, hb_buffer_set_direction(hb->buf, HB_DIRECTION_LTR); hb_buffer_set_language(hb->buf, hb_language_from_string("en", -1)); hb_buffer_guess_segment_properties(hb->buf); + /* Sample the buffer length here, before hb_shape() flips the buffer's + * content type from UNICODE to GLYPHS. */ + codepoints = hb_buffer_get_length(hb->buf); hb->font = hb_ft_font_create_referenced(s->face); if (hb->font == NULL) goto fail; @@ -1389,6 +1395,17 @@ static int shape_text_hb(DrawTextContext *s, HarfbuzzData* hb, const char* text, 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); + if (av_log_get_level() >= AV_LOG_VERBOSE) { + char script_tag[5] = { 0 }; + hb_script_t script = hb_buffer_get_script(hb->buf); + hb_direction_t dir = hb_buffer_get_direction(hb->buf); + hb_tag_to_string(hb_script_to_iso15924_tag(script), script_tag); + av_log(ctx, AV_LOG_VERBOSE, + "shape: script=%s direction=%s codepoints=%u glyphs=%u\n", + script_tag, hb_direction_to_string(dir), + codepoints, hb->glyph_count); + } + return 0; fail: hb_buffer_destroy(hb->buf); @@ -1441,7 +1458,7 @@ continue_on_failed: // Evaluate the width of the space character if needed to replace tabs if (s->tab_count > 0 && !s->blank_advance64) { HarfbuzzData hb_data; - ret = shape_text_hb(s, &hb_data, " ", 1); + ret = shape_text_hb(ctx, s, &hb_data, " ", 1); if(ret != 0) { goto done; } @@ -1479,7 +1496,7 @@ continue_on_failed2: 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, len); + ret = shape_text_hb(ctx, s, hb, start, len); if (ret != 0) { goto done; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
