The following new variables can be used in the x and y expressions: font_a, font_d, top_a, bottom_d.
Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -89,6 +89,10 @@ static const char *const var_names[] = { · 88 unmodified lines | ||
| 89 | 89 | "max_glyph_d", "descent", ///< min glyph descender |
| 90 | 90 | "max_glyph_h", ///< max glyph height |
| 91 | 91 | "max_glyph_w", ///< max glyph width |
| 92 | + "font_a", ///< font-defined ascent | |
| 93 | + "font_d", ///< font-defined descent | |
| 94 | + "top_a", ///< max glyph ascender of the top line | |
| 95 | + "bottom_d", ///< max glyph descender of the bottom line | |
| 92 | 96 | "n", ///< number of frame |
| 93 | 97 | "sar", |
| 94 | 98 | "t", ///< timestamp expressed in seconds |
| @@ -136,6 +140,10 @@ enum var_name { · 41 unmodified lines | ||
| 136 | 140 | VAR_MAX_GLYPH_D, VAR_DESCENT, |
| 137 | 141 | VAR_MAX_GLYPH_H, |
| 138 | 142 | VAR_MAX_GLYPH_W, |
| 143 | + VAR_FONT_A, | |
| 144 | + VAR_FONT_D, | |
| 145 | + VAR_TOP_A, | |
| 146 | + VAR_BOTTOM_D, | |
| 139 | 147 | VAR_N, |
| 140 | 148 | VAR_SAR, |
| 141 | 149 | VAR_T, |
| @@ -1800,8 +1808,12 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame) · 1658 unmodified lines | ||
| 1800 | 1808 | s->var_values[VAR_MAX_GLYPH_W] = s->max_glyph_w; |
| 1801 | 1809 | s->var_values[VAR_MAX_GLYPH_H] = s->max_glyph_h; |
| 1802 | 1810 | s->var_values[VAR_MAX_GLYPH_A] = s->var_values[VAR_ASCENT] = POS_CEIL(metrics.max_y64, 64); |
| 1811 | + s->var_values[VAR_FONT_A] = s->face->size->metrics.ascender / 64; | |
| 1803 | 1812 | s->var_values[VAR_MAX_GLYPH_D] = s->var_values[VAR_DESCENT] = POS_CEIL(metrics.min_y64, 64); |
| 1813 | + s->var_values[VAR_FONT_D] = -s->face->size->metrics.descender / 64; | |
| 1804 | 1814 | |
| 1815 | + s->var_values[VAR_TOP_A] = POS_CEIL(metrics.offset_top64, 64); | |
| 1816 | + s->var_values[VAR_BOTTOM_D] = -POS_CEIL(metrics.offset_bottom64, 64); | |
| 1805 | 1817 | s->var_values[VAR_LINE_H] = s->var_values[VAR_LH] = metrics.line_height64 / 64.; |
| 1806 | 1818 | |
| 1807 | 1819 | if (s->text_source == AV_FRAME_DATA_DETECTION_BBOXES) { |