mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
float casts within fabs() - partial patch from issue 304
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@374 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
428b1bb543
commit
8cd185d49f
@ -710,25 +710,25 @@ char* TessBaseAPI::GetUTF8Text() {
|
||||
static bool IsParagraphBreak(TBOX bbox_cur, TBOX bbox_prev,
|
||||
int right, int line_height) {
|
||||
// Check if the distance between lines is larger than the normal leading,
|
||||
if (fabs(bbox_cur.bottom() - bbox_prev.bottom()) > line_height * 2)
|
||||
if (fabs((float)(bbox_cur.bottom() - bbox_prev.bottom())) > line_height * 2)
|
||||
return true;
|
||||
|
||||
// Check if the distance between left bounds of the two lines is nearly the
|
||||
// same as between their right bounds (if so, then both lines probably belong
|
||||
// to the same paragraph, maybe a centered one).
|
||||
if (fabs((bbox_cur.left() - bbox_prev.left()) -
|
||||
(bbox_prev.right() - bbox_cur.right())) < line_height)
|
||||
if (fabs((float)((bbox_cur.left() - bbox_prev.left()) -
|
||||
(bbox_prev.right() - bbox_cur.right()))) < line_height)
|
||||
return false;
|
||||
|
||||
// Check if there is a paragraph indent at this line (either -ve or +ve).
|
||||
if (fabs(bbox_cur.left() - bbox_prev.left()) > line_height)
|
||||
if (fabs((float)(bbox_cur.left() - bbox_prev.left())) > line_height)
|
||||
return true;
|
||||
|
||||
// Check if both current and previous line don't reach the right bound of the
|
||||
// block, but the distance is different. This will cause all lines in a verse
|
||||
// to be treated as separate paragraphs, but most probably will not split
|
||||
// block-quotes to separate lines (at least if the text is justified).
|
||||
if (fabs(bbox_cur.right() - bbox_prev.right()) > line_height &&
|
||||
if (fabs((float)(bbox_cur.right() - bbox_prev.right())) > line_height &&
|
||||
right - bbox_cur.right() > line_height &&
|
||||
right - bbox_prev.right() > line_height)
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user