summaryrefslogtreecommitdiffstats
path: root/libass/ass_shaper.c
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2020-10-29 02:16:01 +0200
committerOleg Oshmyan <chortos@inbox.lv>2021-04-29 03:15:40 +0300
commit3f95d1701159e86b75dc49c8eaa1dfc03819bc32 (patch)
treeac2c70bb1a294b938a1c56919e00ae9fb592e58c /libass/ass_shaper.c
parent03a7c9e63bbf7e6b77631b1b291f8d95b27d890e (diff)
downloadlibass-3f95d1701159e86b75dc49c8eaa1dfc03819bc32.tar.bz2
libass-3f95d1701159e86b75dc49c8eaa1dfc03819bc32.tar.xz
Delay \fay baseline shear until last text layout step
The current code calculates the effect of \fay on advances early in retrieve_glyph, only to ignore it until reorder_text, which then partially undoes these calculations. Instead, just calculate it once, when all the necessary properties have been fully determined. The earliest point to do this would be within reorder_text, but to simplify future logic changes, delay this until all other text layout steps are done. This matches VSFilter, which applies shear after alignment. This would also have neutralized the bug that the previous commit fixed, because glyphs[0].pos.y really is always 0 until shear is applied. This also opens the door for another commit to skip glyphs that are invisible but affect layout. In addition to simplifying code and calculations, this commit fixes a bug: the current code for undoing shear assumes constant scale_x/y from the last \fay change or line break point to the next such point, producing strange, wrong positions when scale_x/y do change. This fixes https://github.com/libass/libass/issues/465.
Diffstat (limited to 'libass/ass_shaper.c')
-rw-r--r--libass/ass_shaper.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index 4665e7a..ffcb36b 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -1020,6 +1020,11 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
return shaper->cmap;
}
+FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
+{
+ return shaper->cmap;
+}
+
/**
* \brief Resolve a Windows font charset number to a suitable base
* direction. Generally, use LTR for compatibility with VSFilter. The