private char[] parse(String str) {
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '\n')
                count = getCharPositionOfLine(count) + MAX_CHARS_PER_LINE;
            else if (c == '\f')
                count = getCharPositionOfPage(count) + MAX_CHARS_PER_PAGE;
            else
                count++;
        }

        char[] text = new char[count];
        // initialize
        for (int i = 0; i < text.length; i++)
            text[i] = '　';

        int position = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '\n')
                position = getCharPositionOfLine(position) + MAX_CHARS_PER_LINE;
            else if (c == '\f')
                position = getCharPositionOfPage(position) + MAX_CHARS_PER_PAGE;
            else
                text[position++] = c;
        }
        return text;
    }