diff --git a/api/baseapi.cpp b/api/baseapi.cpp index 0c37bfcfe..58800cc2b 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -1584,6 +1584,10 @@ char* TessBaseAPI::GetHOCRText(struct ETEXT_DESC* monitor, int page_number) { } hocr_str += "'>"; + bool last_word_in_line = res_it->IsAtFinalElement(RIL_TEXTLINE, RIL_WORD); + bool last_word_in_para = res_it->IsAtFinalElement(RIL_PARA, RIL_WORD); + bool last_word_in_block = res_it->IsAtFinalElement(RIL_BLOCK, RIL_WORD); + if (bold) hocr_str += ""; if (italic) hocr_str += ""; @@ -1614,9 +1618,6 @@ char* TessBaseAPI::GetHOCRText(struct ETEXT_DESC* monitor, int page_number) { if (bold) hocr_str += ""; hocr_str += " "; - bool last_word_in_line = res_it->IsAtFinalElement(RIL_TEXTLINE, RIL_WORD); - bool last_word_in_para = res_it->IsAtFinalElement(RIL_PARA, RIL_WORD); - bool last_word_in_block = res_it->IsAtFinalElement(RIL_BLOCK, RIL_WORD); wcnt++; // Close any ending block/paragraph/textline. if (last_word_in_line) {