- GL::push_matrix();
- GL::translate(rgeom.x, rgeom.y, 0);
- GL::scale_uniform(font_size);
+ if(newline==string::npos)
+ break;
+ start = newline+1;
+ }
+}
+
+template<typename T, void (Text::*func)(unsigned, const Geometry &, T &) const>
+void Text::process_lines(const Part &part, const Geometry &parent, unsigned first_row, T &data) const
+{
+ if(!style)
+ return;
+
+ const GL::Font *font = style->get_font();
+ float font_size = font->get_default_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 n_lines = min(lines.size(), max((parent.h-margin.top-margin.bottom)/line_spacing, 1U));
+ first_row = min(first_row, lines.size()-n_lines);