Skip to content

Commit 38fac62

Browse files
committed
Format new code with clang-format
Signed-off-by: Stefan Weil <[email protected]>
1 parent 5de2a21 commit 38fac62

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/api/wordstrboxrenderer.cpp

+25-24
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
namespace tesseract {
2424

2525
/**
26-
* Create a UTF8 box file with WordStr strings from the internal data structures.
27-
* page_number is a 0-base page index that will appear in the box file.
28-
* Returned string must be freed with the delete [] operator.
26+
* Create a UTF8 box file with WordStr strings from the internal data
27+
* structures. page_number is a 0-base page index that will appear in the box
28+
* file. Returned string must be freed with the delete [] operator.
2929
*/
3030

3131
char* TessBaseAPI::GetWordStrBoxText(int page_number) {
@@ -44,31 +44,32 @@ char* TessBaseAPI::GetWordStrBoxText(int page_number) {
4444
continue;
4545
}
4646

47-
if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
48-
if (!first_line) {
47+
if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
48+
if (!first_line) {
4949
wordstr_box_str.add_str_int("\n\t ", right + 1);
5050
wordstr_box_str.add_str_int(" ", image_height_ - bottom);
5151
wordstr_box_str.add_str_int(" ", right + 5);
5252
wordstr_box_str.add_str_int(" ", image_height_ - top);
5353
wordstr_box_str.add_str_int(" ", page_num); // row for tab for EOL
5454
wordstr_box_str += "\n";
55-
} else {
55+
} else {
5656
first_line = false;
57+
}
58+
// Use bounding box for whole line for WordStr
59+
res_it->BoundingBox(RIL_TEXTLINE, &left, &top, &right, &bottom);
60+
wordstr_box_str.add_str_int("WordStr ", left);
61+
wordstr_box_str.add_str_int(" ", image_height_ - bottom);
62+
wordstr_box_str.add_str_int(" ", right);
63+
wordstr_box_str.add_str_int(" ", image_height_ - top);
64+
wordstr_box_str.add_str_int(" ", page_num); // word
65+
wordstr_box_str += " #";
5766
}
58-
// Use bounding box for whole line for WordStr
59-
res_it->BoundingBox(RIL_TEXTLINE, &left, &top, &right, &bottom);
60-
wordstr_box_str.add_str_int("WordStr ", left);
61-
wordstr_box_str.add_str_int(" ", image_height_ - bottom);
62-
wordstr_box_str.add_str_int(" ", right);
63-
wordstr_box_str.add_str_int(" ", image_height_ - top);
64-
wordstr_box_str.add_str_int(" ", page_num); // word
65-
wordstr_box_str += " #";
66-
}
67-
do { wordstr_box_str +=
68-
std::unique_ptr<const char[]>(res_it->GetUTF8Text(RIL_WORD)).get();
69-
wordstr_box_str += " ";
70-
res_it->Next(RIL_WORD);
71-
} while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
67+
do {
68+
wordstr_box_str +=
69+
std::unique_ptr<const char[]>(res_it->GetUTF8Text(RIL_WORD)).get();
70+
wordstr_box_str += " ";
71+
res_it->Next(RIL_WORD);
72+
} while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
7273
}
7374
wordstr_box_str.add_str_int("\n\t ", right + 1);
7475
wordstr_box_str.add_str_int(" ", image_height_ - bottom);
@@ -85,12 +86,12 @@ char* TessBaseAPI::GetWordStrBoxText(int page_number) {
8586
/**********************************************************************
8687
* WordStrBox Renderer interface implementation
8788
**********************************************************************/
88-
TessWordStrBoxRenderer::TessWordStrBoxRenderer(const char *outputbase)
89-
: TessResultRenderer(outputbase, "box") {
90-
}
89+
TessWordStrBoxRenderer::TessWordStrBoxRenderer(const char* outputbase)
90+
: TessResultRenderer(outputbase, "box") {}
9191

9292
bool TessWordStrBoxRenderer::AddImageHandler(TessBaseAPI* api) {
93-
const std::unique_ptr<const char[]> wordstrbox(api->GetWordStrBoxText(imagenum()));
93+
const std::unique_ptr<const char[]> wordstrbox(
94+
api->GetWordStrBoxText(imagenum()));
9495
if (wordstrbox == nullptr) return false;
9596

9697
AppendString(wordstrbox.get());

0 commit comments

Comments
 (0)