Implement wrap_char.

This commit is contained in:
Hermann Kraus 2012-07-29 17:58:46 +02:00
parent 0f7f527af9
commit b3c5969c3e
2 changed files with 13 additions and 4 deletions

View file

@ -83,10 +83,7 @@ public:
typedef std::vector<text_line_ptr> line_vector;
typedef line_vector::const_iterator const_iterator;
text_layout(face_manager_freetype & font_manager);
inline void add_text(UnicodeString const& str, char_properties_ptr format)
{
itemizer_.add_text(str, format);
}
void add_text(UnicodeString const& str, char_properties_ptr format);
void layout(double wrap_width, unsigned text_ratio);

View file

@ -42,6 +42,18 @@ text_layout::text_layout(face_manager_freetype &font_manager)
{
}
void text_layout::add_text(const UnicodeString &str, char_properties_ptr format)
{
if (format->wrap_char)
{
UnicodeString copy = str;
copy.findAndReplace(UChar32(format->wrap_char), "\n");
itemizer_.add_text(copy, format);
} else {
itemizer_.add_text(str, format);
}
}
void text_layout::layout(double wrap_width, unsigned text_ratio)
{
text_line_ptr line = boost::make_shared<text_line>(0, itemizer_.get_text().length());