Esempio n. 1
0
void text_layout::layout()
{
    unsigned num_lines = itemizer_.num_lines();
    for (unsigned i = 0; i < num_lines; ++i)
    {
        std::pair<unsigned, unsigned> line_limits = itemizer_.line(i);
        text_line line(line_limits.first, line_limits.second);
        //Break line if neccessary
        if (wrap_char_ != ' ')
        {
            break_line(line, wrap_char_, wrap_width_ * scale_factor_, text_ratio_, wrap_before_, repeat_wrap_char_);
        }
        else
        {
            break_line(line, wrap_width_ * scale_factor_, text_ratio_, wrap_before_);
        }
    }

    init_auto_alignment();

    // Find text origin.
    displacement_ = scale_factor_ * displacement_ + alignment_offset();
    if (rotate_displacement_) displacement_ = displacement_.rotate(!orientation_);
    // Find layout bounds, expanded for rotation
    rotated_box2d(bounds_, orientation_, displacement_, width_, height_);
}
Esempio n. 2
0
void text_layout::layout()
{
    unsigned num_lines = itemizer_.num_lines();
    for (unsigned i = 0; i < num_lines; ++i)
    {
        // Break line if neccessary
        if (wrap_char_ != ' ')
        {
            break_line(itemizer_.line(i));
        }
        else
        {
            break_line_icu(itemizer_.line(i));
        }
    }

    init_auto_alignment();

    // Find text origin.
    displacement_ = scale_factor_ * displacement_ + alignment_offset();
    if (rotate_displacement_) displacement_ = displacement_.rotate(!orientation_);
    // Find layout bounds, expanded for rotation
    rotated_box2d(bounds_, orientation_, displacement_, width_, height_);
}