From 03cbb01cdf953bc4709035019e31e62dce238a4f Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Sat, 14 Nov 2020 01:28:56 +0200 Subject: Reset baseline shear for each run, like VSFilter, or whole lines Without WHOLE_TEXT_LAYOUT, follow VSFilter and reset the baseline for each run. With WHOLE_TEXT_LAYOUT, try to shear each line as a whole. There are still issues though: * \fscx0 glyphs are skipped and do not contribute any shear; * applying shear to each glyph and then scaling it together with the shear makes little sense for whole lines to begin with. --- libass/ass_render.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 6e9aef2..e2d0ef5 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -2131,12 +2131,14 @@ static void apply_baseline_shear(ASS_Renderer *render_priv) TextInfo *text_info = &render_priv->text_info; FriBidiStrIndex *cmap = ass_shaper_get_reorder_map(render_priv->shaper); int32_t shear = 0; - double last_fay = 0; + bool whole_text_layout = + render_priv->track->parser_priv->feature_flags & + FEATURE_MASK(ASS_FEATURE_WHOLE_TEXT_LAYOUT); for (int i = 0; i < text_info->length; i++) { GlyphInfo *info = text_info->glyphs + cmap[i]; - if (text_info->glyphs[i].linebreak || last_fay != info->fay) + if (text_info->glyphs[i].linebreak || + (!whole_text_layout && text_info->glyphs[i].starts_new_run)) shear = 0; - last_fay = info->fay; if (!info->scale_x || !info->scale_y) info->skip = true; if (info->skip) -- cgit v1.2.3