Beispiel #1
0
        //-------------------------------------------------
        //  word_wrap
        //-------------------------------------------------
        void word_wrap()
        {
            // keep track of the last line and break
            line   last_line  = m_current_line;
            UInt32 last_break = m_last_break;

            // start a new line with the same justification
            start_new_line(last_line.justify(), last_line.character(last_line.character_count() - 1).style.size);

            // find the begining of the word to wrap
            UInt32 position = last_break;

            while (position + 1 < last_line.character_count() && is_space_character(last_line.character(position).character))
            {
                position++;
            }

            // transcribe the characters
            for (UInt32 i = position; i < last_line.character_count(); i++)
            {
                var ch = last_line.character(i);
                m_current_line.add_character(ch.character, ch.style, ch.source);
            }

            // and finally, truncate the last line
            last_line.truncate(last_break);
        }