History

avfilter/vf_drawtext: fix text width measurement

yethie committed 3 years ago

Commit aeff5bc1 parent da784b81 file · +11 −3Browse files

Unified · Split

libavfilter/vf_drawtext.c+11−3
@@ -1757,9 +1757,17 @@ continue_on_failed2: · 1756 unmodified lines
1757 first_min_x64 = FFMIN(glyph->bbox.xMin, first_min_x64);1757 first_min_x64 = FFMIN(glyph->bbox.xMin, first_min_x64);
1758 }1758 }
1759 if (t == hb->glyph_count - 1) {1759 if (t == hb->glyph_count - 1) {
1760 w64 += glyph->bbox.xMax;1760 // The following code measures the width of the line up to the last
1761 last_max_x64 = FFMAX(glyph->bbox.xMax, last_max_x64);1761 // character's horizontal advance
1762 cur_line->offset_right64 = glyph->bbox.xMax;1762 int last_char_width = hb->glyph_pos[t].x_advance;
1763
1764 // The following code measures the width of the line up to the rightmost
1765 // visible pixel of the last character
1766 // int last_char_width = glyph->bbox.xMax;
1767
1768 w64 += last_char_width;
1769 last_max_x64 = FFMAX(last_char_width, last_max_x64);
1770 cur_line->offset_right64 = last_char_width;
1763 } else {1771 } else {
1764 if (is_tab) {1772 if (is_tab) {
1765 int size = s->blank_advance64 * s->tabsize;1773 int size = s->blank_advance64 * s->tabsize;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t