# HG changeset patch # User eugeni # Date 1156716946 0 # Node ID 3a5d02f156d34aa026b4e8acd19105a5fba34595 # Parent c7057724ba8cc1c4069c704c28cc9156e1651391 Cosmetics: fix indentation after r19562. diff -r c7057724ba8c -r 3a5d02f156d3 libass/ass_render.c --- a/libass/ass_render.c Sun Aug 27 22:12:31 2006 +0000 +++ b/libass/ass_render.c Sun Aug 27 22:15:46 2006 +0000 @@ -1628,38 +1628,38 @@ MarginV = (event->MarginV) ? event->MarginV : style->MarginV; if (render_context.evt_type != EVENT_HSCROLL) { - // calculate max length of a line - max_text_width = x2scr(frame_context.track->PlayResX - MarginR) - x2scr(MarginL); + // calculate max length of a line + max_text_width = x2scr(frame_context.track->PlayResX - MarginR) - x2scr(MarginL); - // rearrange text in several lines - wrap_lines_smart(max_text_width); + // rearrange text in several lines + wrap_lines_smart(max_text_width); - // align text - 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; - glyph_info_t* first_glyph = text_info.glyphs + last_break + 1; - glyph_info_t* last_glyph = text_info.glyphs + i - 1; + // align text + 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; + 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 --; + 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) - if (halign == HALIGN_LEFT) { // left aligned, no action - } else if (halign == HALIGN_RIGHT) { // right aligned - shift = max_text_width - width; - } else if (halign == HALIGN_CENTER) { // centered - shift = (max_text_width - width) / 2; + 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) + if (halign == HALIGN_LEFT) { // left aligned, no action + } else if (halign == HALIGN_RIGHT) { // right aligned + shift = max_text_width - width; + } else if (halign == HALIGN_CENTER) { // centered + shift = (max_text_width - width) / 2; + } + for (j = last_break + 1; j < i; ++j) { + text_info.glyphs[j].pos.x += shift; + } + last_break = i - 1; } - for (j = last_break + 1; j < i; ++j) { - text_info.glyphs[j].pos.x += shift; - } - last_break = i - 1; } } - } // determing text bounding box compute_string_bbox(&text_info, &bbox);