diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-25 22:32:21 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-27 01:24:26 +0200 |
commit | 52cc7a0b34b6b4d63e43e68aafb2ec30463d2604 (patch) | |
tree | 7b9389abe6e8f5fefff93e42f22ba10e9cf444ae /libass/ass_render.h | |
parent | 3df44a54416161a44ae620e4466bd823f5e97718 (diff) | |
download | libass-52cc7a0b34b6b4d63e43e68aafb2ec30463d2604.tar.bz2 libass-52cc7a0b34b6b4d63e43e68aafb2ec30463d2604.tar.xz |
Fix \kf fill positioning
Our effect_timing is currently used as a coordinate relative to a weird origin:
take each glyph's center within the run, apply 3D transforms, pick the leftmost
one, and round it down a little. This makes no sense and is the result of an
unrelated code change. But if I recall correctly, \kf positioning was already
incorrect before that last change (but in a different manner).
To fix this and hopefully to prevent this kind of error from occurring again,
convert effect_timing to absolute screen coordinate.
Start the fill at the glyph run's leftmost post-transform control point.
This matches VSFilter and allows karaoke to work in vertical text (unlike,
for example, starting the fill at the first glyph's pre-transform origin).
Fixes https://github.com/libass/libass/issues/216.
Fixes https://github.com/libass/libass/issues/357.
Diffstat (limited to 'libass/ass_render.h')
-rw-r--r-- | libass/ass_render.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libass/ass_render.h b/libass/ass_render.h index eb4124e..9796841 100644 --- a/libass/ass_render.h +++ b/libass/ass_render.h @@ -99,9 +99,14 @@ typedef struct { FilterDesc filter; uint32_t c[4]; // colors Effect effect_type; - int effect_timing; // time duration of current karaoke word - // after process_karaoke_effects: distance in pixels from the glyph origin. + + // during render_and_combine_glyphs: distance in pixels from the karaoke origin. + // after render_and_combine_glyphs: screen coordinate in pixels. // part of the glyph to the left of it is displayed in a different color. + int effect_timing; + + // karaoke origin: screen coordinate of leftmost post-transform control point x in subpixels + int32_t leftmost_x; size_t bitmap_count, max_bitmap_count; BitmapRef *bitmaps; @@ -142,7 +147,7 @@ typedef struct glyph_info { ASS_Vector cluster_advance; Effect effect_type; int effect_timing; // time duration of current karaoke word - // after process_karaoke_effects: distance in pixels from the glyph origin. + // after process_karaoke_effects: distance in pixels from the karaoke origin. // part of the glyph to the left of it is displayed in a different color. int effect_skip_timing; // delay after the end of last karaoke word int asc, desc; // font max ascender and descender |