MCPcopy Create free account
hub / github.com/creatale/node-dv / IterateAndAppendUTF8TextlineText

Method IterateAndAppendUTF8TextlineText

deps/tesseract/ccmain/resultiterator.cpp:616–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616void 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
656void ResultIterator::AppendUTF8ParagraphText(STRING *text) const {
657 ResultIterator it(*this);

Callers 2

GetUTF8TextMethod · 0.80

Calls 6

PrintScriptDirsFunction · 0.85
rowMethod · 0.45
sizeMethod · 0.45
spaceMethod · 0.45
wordMethod · 0.45
blockMethod · 0.45

Tested by

no test coverage detected