From 3f95d1701159e86b75dc49c8eaa1dfc03819bc32 Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Thu, 29 Oct 2020 02:16:01 +0200 Subject: 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. --- libass/ass_shaper.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libass/ass_shaper.c') 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 -- cgit v1.2.3