@@ -135,6 +135,7 @@ char* TessBaseAPI::GetHOCRText(ETEXT_DESC* monitor, int page_number) {
135
135
bool para_is_ltr = true ; // Default direction is LTR
136
136
const char * paragraph_lang = nullptr ;
137
137
bool font_info = false ;
138
+ bool hocr_boxes = false ;
138
139
GetBoolVariable (" hocr_font_info" , &font_info);
139
140
GetBoolVariable (" hocr_char_boxes" , &hocr_boxes);
140
141
@@ -267,18 +268,13 @@ char* TessBaseAPI::GetHOCRText(ETEXT_DESC* monitor, int page_number) {
267
268
if (grapheme && grapheme[0 ] != 0 ) {
268
269
if (hocr_boxes) {
269
270
res_it->BoundingBox (RIL_SYMBOL, &left, &top, &right, &bottom);
270
- hocr_str += " <span class='ocrx_cinfo' title='x_bboxes" ;
271
- hocr_str.add_str_int (" " , left);
272
- hocr_str.add_str_int (" " , top);
273
- hocr_str.add_str_int (" " , right);
274
- hocr_str.add_str_int (" " , bottom);
275
- hocr_str += " ; x_conf" ;
276
- hocr_str.add_str_int (" " , res_it->Confidence (RIL_SYMBOL));
277
- hocr_str += " '>" ;
271
+ hocr_str << " <span class='ocrx_cinfo' title='x_bboxes' "
272
+ << left << " " << top << " " << right << " " << bottom
273
+ << " ; x_conf " << res_it->Confidence (RIL_SYMBOL) << " '>" ;
278
274
}
279
275
hocr_str << HOcrEscape (grapheme.get ()).c_str ();
280
276
if (hocr_boxes) {
281
- hocr_str += " </span>" ;
277
+ hocr_str << " </span>" ;
282
278
}
283
279
}
284
280
res_it->Next (RIL_SYMBOL);
0 commit comments