@@ -392,7 +392,7 @@ Pta *SortBaseline(Pta *baseline_pts,
392392
393393 sorted_baseline_pts =
394394 ptaSort (baseline_pts, L_SORT_BY_X, L_SORT_INCREASING, NULL );
395-
395+
396396 do {
397397 ptaGetPt (sorted_baseline_pts, index, &x0, &y0);
398398 ptaGetPt (sorted_baseline_pts, index + 1 , &x1, &y1);
@@ -464,11 +464,11 @@ Pta *ClipAndSimplifyBaseline(Pta *bottom_pts, Pta *baseline_pts,
464464 int clipped_pts_count = ptaGetCount (baseline_clipped_pts);
465465
466466 if (clipped_pts_count < 2 ) {
467- // If there's only one point in baseline_clipped_pts, duplicate it
468- ptaDestroy (&baseline_clipped_pts); // Clean up the created but unused Pta
469- baseline_clipped_pts = ptaCreate (0 );
470- ptaAddPt (baseline_clipped_pts, x_min, y_min);
471- ptaAddPt (baseline_clipped_pts, x_max, y_min);
467+ // If there's only one point in baseline_clipped_pts, duplicate it
468+ ptaDestroy (&baseline_clipped_pts); // Clean up the created but unused Pta
469+ baseline_clipped_pts = ptaCreate (0 );
470+ ptaAddPt (baseline_clipped_pts, x_min, y_min);
471+ ptaAddPt (baseline_clipped_pts, x_max, y_min);
472472 }
473473
474474 return baseline_clipped_pts;
@@ -763,24 +763,24 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
763763 Pta *line_baseline_rtl_pts = ptaCreate (0 );
764764 Pta *line_baseline_ltr_pts = ptaCreate (0 );
765765 Pta *line_baseline_pts = ptaCreate (0 );
766-
766+
767767 bool POLYGONFLAG;
768768 GetBoolVariable (" page_xml_polygon" , &POLYGONFLAG);
769769 int LEVELFLAG;
770770 GetIntVariable (" page_xml_level" , &LEVELFLAG);
771-
771+
772772 if (LEVELFLAG != 0 && LEVELFLAG != 1 ) {
773- tprintf (" For now, only line level and word level are available, and the level is reset to line level.\n " );
773+ tprintf (
774+ " For now, only line level and word level are available, and the level "
775+ " is reset to line level.\n " );
774776 LEVELFLAG = 0 ;
775777 }
776778
777779 // Use "C" locale (needed for int values larger than 999).
778780 page_str.imbue (std::locale::classic ());
779- reading_order_str << " \t <Page "
780- << " imageFilename=\" " << GetInputName ();
781+ reading_order_str << " \t <Page " << " imageFilename=\" " << GetInputName ();
781782 // AppendString(api->GetInputName());
782- reading_order_str << " \" "
783- << " imageWidth=\" " << rect_width_ << " \" "
783+ reading_order_str << " \" " << " imageWidth=\" " << rect_width_ << " \" "
784784 << " imageHeight=\" " << rect_height_ << " \" >\n " ;
785785 std::size_t ro_id = std::hash<std::string>{}(GetInputName ());
786786 reading_order_str << " \t\t <ReadingOrder>\n "
@@ -826,32 +826,32 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
826826
827827 if (res_it->IsAtBeginningOf (RIL_BLOCK)) {
828828 // Add Block to reading order
829- reading_order_str << " \t\t\t\t <RegionRefIndexed "
830- << " index=\" " << rcnt << " \" "
831- << " regionRef=\" r" << rcnt << " \" />\n " ;
829+ reading_order_str << " \t\t\t\t <RegionRefIndexed " << " index=\" " << rcnt
830+ << " \" " << " regionRef=\" r" << rcnt << " \" />\n " ;
832831
833832 float deskew_angle;
834833 res_it->Orientation (&orientation_block, &writing_direction_block,
835834 &textline_order_block, &deskew_angle);
836835 block_conf = ((res_it->Confidence (RIL_BLOCK)) / 100 .);
837- page_str << " \t\t <TextRegion id=\" r" << rcnt << " \" "
838- << " custom=\" "
836+ page_str << " \t\t <TextRegion id=\" r" << rcnt << " \" " << " custom=\" "
839837 << " readingOrder {index:" << rcnt << " ;} " ;
840838 if (writing_direction_block != 0 ) {
841839 page_str << " readingDirection {"
842840 << WritingDirectionToStr (writing_direction_block) << " ;} " ;
843841 }
844842 page_str << " orientation {" << orientation_block << " ;}\" >\n " ;
845843 page_str << " \t\t\t " ;
846- if ((!POLYGONFLAG || (orientation_block != 0 && orientation_block != 2 )) && LEVELFLAG == 0 ) {
844+ if ((!POLYGONFLAG ||
845+ (orientation_block != 0 && orientation_block != 2 )) &&
846+ LEVELFLAG == 0 ) {
847847 AddBoxToPAGE (res_it, RIL_BLOCK, page_str);
848848 }
849849 }
850850
851851 // Writing direction changes at a per-word granularity
852852 // tesseract::WritingDirection writing_direction_before;
853853 tesseract::WritingDirection writing_direction;
854-
854+
855855 writing_direction = writing_direction_block;
856856 if (writing_direction_block != WRITING_DIRECTION_TOP_TO_BOTTOM) {
857857 switch (res_it->WordDirection ()) {
@@ -868,10 +868,9 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
868868
869869 bool ttb_flag = (writing_direction == WRITING_DIRECTION_TOP_TO_BOTTOM);
870870 // TODO: Rework polygon handling if line is skewed (90 or 180 degress),
871- // for now using LinePts
871+ // for now using LinePts
872872 bool skewed_flag = (orientation_block != 0 && orientation_block != 2 );
873873
874-
875874 if (res_it->IsAtBeginningOf (RIL_TEXTLINE)) {
876875 // writing_direction_before = writing_direction;
877876 line_conf = ((res_it->Confidence (RIL_TEXTLINE)) / 100 .);
@@ -882,8 +881,7 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
882881 line_str << " readingDirection=\" "
883882 << WritingDirectionToStr (writing_direction) << " \" " ;
884883 }
885- line_str << " custom=\" "
886- << " readingOrder {index:" << lcnt << " ;}\" >\n " ;
884+ line_str << " custom=\" " << " readingOrder {index:" << lcnt << " ;}\" >\n " ;
887885 // If level is linebased, get the line polygon and baseline
888886 if (LEVELFLAG == 0 && (!POLYGONFLAG || skewed_flag)) {
889887 AddPointToWordPolygon (res_it, RIL_TEXTLINE, line_top_ltr_pts,
@@ -906,8 +904,7 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
906904 word_str << " \t\t\t\t <Word id=\" r" << rcnt << " l" << lcnt << " w" << wcnt
907905 << " \" readingDirection=\" "
908906 << WritingDirectionToStr (writing_direction) << " \" "
909- << " custom=\" "
910- << " readingOrder {index:" << wcnt << " ;}\" >\n " ;
907+ << " custom=\" " << " readingOrder {index:" << wcnt << " ;}\" >\n " ;
911908 if ((!POLYGONFLAG || skewed_flag) || ttb_flag) {
912909 AddPointToWordPolygon (res_it, RIL_WORD, word_top_pts, word_bottom_pts,
913910 writing_direction);
@@ -988,26 +985,26 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
988985
989986 // Check why this combination of words is not working as expected!
990987 // Write the word contents to the line
991- /*
992- if (!last_word_in_line && writing_direction_before != writing_direction && writing_direction < 2 && writing_direction_before < 2 && res_it->WordDirection()) {
988+ #if 0
989+ if (!last_word_in_line && writing_direction_before != writing_direction &&
990+ writing_direction < 2 && writing_direction_before < 2 &&
991+ res_it->WordDirection()) {
993992 if (writing_direction_before == WRITING_DIRECTION_LEFT_TO_RIGHT) {
994- //line_content << "" << word_content.str();
995- }
996- else {
997- //line_content << "" << word_content.str();
993+ // line_content << "" << word_content.str();
994+ } else {
995+ // line_content << "" << word_content.str();
998996 }
999997 } else {
1000- //line_content << word_content.str();
998+ // line_content << word_content.str();
1001999 }
10021000 // Check if WordIsNeutral
1003- if (res_it->WordDirection()){
1001+ if (res_it->WordDirection()) {
10041002 writing_direction_before = writing_direction;
10051003 }
1006- */
1004+ # endif
10071005 word_content.str (" " );
10081006 wcnt++;
10091007
1010-
10111008 // Write line information to the output
10121009 if (last_word_in_line) {
10131010 // Combine ltr and rtl lines
0 commit comments