diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-11-14 01:28:56 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2022-02-14 20:43:08 +0200 |
commit | 03cbb01cdf953bc4709035019e31e62dce238a4f (patch) | |
tree | 8cc927611e6920ca00c6df417d5a58e39f541aa9 | |
parent | 983df604eb33d854638122f67db1f4cb4accedf7 (diff) | |
download | libass-03cbb01cdf953bc4709035019e31e62dce238a4f.tar.bz2 libass-03cbb01cdf953bc4709035019e31e62dce238a4f.tar.xz |
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.
-rw-r--r-- | libass/ass_render.c | 8 |
1 files 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) |