float font_size = style->get_font_size();
unsigned line_height = static_cast<unsigned>((font.get_ascent()-font.get_descent())*font_size);
unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
- unsigned height = line_height+(lines.size()-1)*line_spacing;
int y_offset = static_cast<int>(-font.get_descent()*font_size);
const Sides &margin = part.get_margin();
unsigned fit_height = parent.h-margin.top-margin.bottom+line_spacing-line_height;
unsigned n_lines = min<unsigned>(lines.size(), max(fit_height/line_spacing, 1U));
+ fit_height = line_height+(n_lines-1)*line_spacing;
first_row = min<unsigned>(first_row, lines.size()-n_lines);
for(unsigned i=0; i<n_lines; ++i)
Geometry rgeom;
rgeom.w = line.width;
- rgeom.h = height;
+ rgeom.h = fit_height;
rgeom.y = (n_lines-1-i)*line_spacing+y_offset;
part.get_alignment().apply(rgeom, parent, part.get_margin());