-void Style::doJustify(const std::string &text, int &start_pos,
- unsigned int max_length,
- unsigned int modifier) const {
- size_t text_len = text.size();
- unsigned int length;
-
- do {
- length = font->measureString(std::string(text, 0, text_len)) + modifier;
- } while (length > max_length && text_len-- > 0);
-
- switch (justify) {
- case RightJustify:
- start_pos += max_length - length;
- break;
-
- case CenterJustify:
- start_pos += (max_length - length) / 2;
- break;
-
- case LeftJustify:
- default:
- break;
- }
-}
-
-