Skip to content

Commit c5ea661

Browse files
David Huggins-DainesDavid Huggins-Daines
David Huggins-Daines
authored and
David Huggins-Daines
committed
fix: reintroduce "horizontal_cell_tolerance" functionality
Narrator: it did not actually implement a horizontal cell tolerance. Signed-off-by: David Huggins-Daines <[email protected]>
1 parent f9adab1 commit c5ea661

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/v2/pdf_resources/page_cell.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,12 @@ namespace pdflib
325325

326326
if((not left_to_right) or (not other.left_to_right))
327327
{
328-
if(d0 >= delta and not overlap)
328+
// Distance is greather than word spacing, and either cells
329+
// are not overlapping, or it is clearly a new line. (FIXME:
330+
// That last part is what the very incorrectly named
331+
// `horizontal_cell_tolerance` used to do in
332+
// `contract_cells_into_lines_v1`)
333+
if(d0 >= delta and ((not overlap) or y0 - other.y0 > 1.0))
329334
{
330335
text = " " + text;
331336
}
@@ -335,7 +340,7 @@ namespace pdflib
335340
}
336341
else
337342
{
338-
if(d0 >= delta and not overlap)
343+
if(d0 >= delta and ((not overlap) or y0 - other.y0 > 1.0))
339344
{
340345
text += " ";
341346
}

0 commit comments

Comments
 (0)