| 614 | } |
| 615 | |
| 616 | void ResultIterator::IterateAndAppendUTF8TextlineText(STRING *text) { |
| 617 | if (Empty(RIL_WORD)) { |
| 618 | Next(RIL_WORD); |
| 619 | return; |
| 620 | } |
| 621 | if (BidiDebug(1)) { |
| 622 | GenericVectorEqEq<int> textline_order; |
| 623 | GenericVector<StrongScriptDirection> dirs; |
| 624 | CalculateTextlineOrder(current_paragraph_is_ltr_, |
| 625 | *this, &dirs, &textline_order); |
| 626 | tprintf("Strong Script dirs [%p/P=%s]: ", it_->row(), |
| 627 | current_paragraph_is_ltr_ ? "ltr" : "rtl"); |
| 628 | PrintScriptDirs(dirs); |
| 629 | tprintf("Logical textline order [%p/P=%s]: ", it_->row(), |
| 630 | current_paragraph_is_ltr_ ? "ltr" : "rtl"); |
| 631 | for (int i = 0; i < textline_order.size(); i++) { |
| 632 | tprintf("%d ", textline_order[i]); |
| 633 | } |
| 634 | tprintf("\n"); |
| 635 | } |
| 636 | |
| 637 | int words_appended = 0; |
| 638 | do { |
| 639 | int numSpaces = preserve_interword_spaces_ ? it_->word()->word->space() |
| 640 | : (words_appended > 0); |
| 641 | for (int i = 0; i < numSpaces; ++i) { |
| 642 | *text += " "; |
| 643 | } |
| 644 | AppendUTF8WordText(text); |
| 645 | words_appended++; |
| 646 | } while (Next(RIL_WORD) && !IsAtBeginningOf(RIL_TEXTLINE)); |
| 647 | if (BidiDebug(1)) { |
| 648 | tprintf("%d words printed\n", words_appended); |
| 649 | } |
| 650 | *text += line_separator_; |
| 651 | // If we just finished a paragraph, add an extra newline. |
| 652 | if (it_->block() == NULL || IsAtBeginningOf(RIL_PARA)) |
| 653 | *text += paragraph_separator_; |
| 654 | } |
| 655 | |
| 656 | void ResultIterator::AppendUTF8ParagraphText(STRING *text) const { |
| 657 | ResultIterator it(*this); |