summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-06 09:59:53 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-06 09:59:53 +0000
commitdf5bbaa735faf49ecc72eeb8891724cda0e17334 (patch)
treefcd70f90018211b605fec0538955ed7a51634429 /libass
parent3a14d1c37aa86fd08aec2b622bb76adfd1356310 (diff)
downloadmpv-df5bbaa735faf49ecc72eeb8891724cda0e17334.tar.bz2
mpv-df5bbaa735faf49ecc72eeb8891724cda0e17334.tar.xz
Text alignment should not use bounding boxes of individual glyphs.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22474 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass')
-rw-r--r--libass/ass_render.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 6f60a3245c..c240e657d6 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -1803,16 +1803,16 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
last_break = -1;
for (i = 1; i < text_info.length + 1; ++i) { // (text_info.length + 1) is the end of the last line
if ((i == text_info.length) || text_info.glyphs[i].linebreak) {
- int width, shift;
+ int width, shift = 0;
glyph_info_t* first_glyph = text_info.glyphs + last_break + 1;
glyph_info_t* last_glyph = text_info.glyphs + i - 1;
while ((last_glyph > first_glyph) && ((last_glyph->symbol == '\n') || (last_glyph->symbol == 0)))
last_glyph --;
- width = last_glyph->pos.x + last_glyph->bbox.xMax - first_glyph->pos.x - first_glyph->bbox.xMin;
- shift = - first_glyph->bbox.xMin; // now text line starts exactly at 0 (left margin)
+ width = last_glyph->pos.x + d6_to_int(last_glyph->advance.x) - first_glyph->pos.x;
if (halign == HALIGN_LEFT) { // left aligned, no action
+ shift = 0;
} else if (halign == HALIGN_RIGHT) { // right aligned
shift = max_text_width - width;
} else if (halign == HALIGN_CENTER) { // centered