comparison libass/ass_render.c @ 20226:42140caaf210

Fix crash because of last_glyph < first_glyph, probably caused by first line only consisting of '\n'
author reimar
date Sun, 15 Oct 2006 13:03:43 +0000
parents 9b67ed06f721
children 4a804e013007
comparison
equal deleted inserted replaced
20225:bdd028a5c834 20226:42140caaf210
1722 if ((i == text_info.length) || text_info.glyphs[i].linebreak) { 1722 if ((i == text_info.length) || text_info.glyphs[i].linebreak) {
1723 int width, shift; 1723 int width, shift;
1724 glyph_info_t* first_glyph = text_info.glyphs + last_break + 1; 1724 glyph_info_t* first_glyph = text_info.glyphs + last_break + 1;
1725 glyph_info_t* last_glyph = text_info.glyphs + i - 1; 1725 glyph_info_t* last_glyph = text_info.glyphs + i - 1;
1726 1726
1727 while ((last_glyph >= first_glyph) && ((last_glyph->symbol == '\n') || (last_glyph->symbol == 0))) 1727 while ((last_glyph > first_glyph) && ((last_glyph->symbol == '\n') || (last_glyph->symbol == 0)))
1728 last_glyph --; 1728 last_glyph --;
1729 1729
1730 width = last_glyph->pos.x + last_glyph->bbox.xMax - first_glyph->pos.x - first_glyph->bbox.xMin; 1730 width = last_glyph->pos.x + last_glyph->bbox.xMax - first_glyph->pos.x - first_glyph->bbox.xMin;
1731 shift = - first_glyph->bbox.xMin; // now text line starts exactly at 0 (left margin) 1731 shift = - first_glyph->bbox.xMin; // now text line starts exactly at 0 (left margin)
1732 if (halign == HALIGN_LEFT) { // left aligned, no action 1732 if (halign == HALIGN_LEFT) { // left aligned, no action