diff options
author | Grigori Goronzy <greg@blackbox> | 2009-08-12 05:07:13 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2009-08-12 05:07:13 +0200 |
commit | d30a7c6921e25d3c3430d7f3c6ea5537a167b69b (patch) | |
tree | 1af1b52c1503428e063ecf902c96f04d08afaa3e | |
parent | 405e8b48f538aceb42bbab8104d10b7a778b26e9 (diff) | |
download | libass-d30a7c6921e25d3c3430d7f3c6ea5537a167b69b.tar.bz2 libass-d30a7c6921e25d3c3430d7f3c6ea5537a167b69b.tar.xz |
Fix italic to non-italic space handling
Scan backwards in the glyph array for a glyph with some actual points
when correctin glyph spacing after italic to non-italic style changes.
This is mostly useful in case a space ends italicized text.
-rw-r--r-- | libass/ass_render.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 73481b1..f5ed87b 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -2629,13 +2629,15 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event, get_outline_glyph(render_priv, code, text_info->glyphs + text_info->length, drawing); - // Add additional space after italic to nonitalic style changes + // Add additional space after italic to non-italic style changes if (text_info->length && text_info->glyphs[text_info->length - 1].hash_key.italic && !render_priv->state.italic) { - GlyphInfo *og = &text_info->glyphs[text_info->length - 1]; - int advmax = FFMAX(0, og->bbox.xMax - og->advance.x); - pen.x += advmax; + int back = text_info->length - 1; + GlyphInfo *og = &text_info->glyphs[back]; + while (og->bbox.xMax - og->bbox.xMin == 0 && og->hash_key.italic) + og = &text_info->glyphs[--back]; + pen.x += FFMAX(0, og->bbox.xMax - og->advance.x); } text_info->glyphs[text_info->length].pos.x = pen.x; |