From ebdcae06cda073c3d5a902173819825157eab1ab Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Jan 2010 17:34:04 -0700 Subject: [PATCH] ... --- src/calibre/ebooks/pdf/reflow.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index bf2d921a10..42c16225d2 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -256,11 +256,16 @@ class Region(object): return len(self.columns) == 0 @property - def is_small(self): + def line_count(self): max_lines = 0 for c in self.columns: max_lines = max(max_lines, len(c)) - return max_lines > 2 + return max_lines + + + @property + def is_small(self): + return self.line_count < 3 def absorb(self, singleton): @@ -431,7 +436,7 @@ class Page(object): def coalesce_regions(self): # find contiguous sets of small regions # absorb into a neighboring region (prefer the one with number of cols - # closer to the avg number of cols in the set, if equal use large + # closer to the avg number of cols in the set, if equal use larger # region) # merge contiguous regions that can contain each other absorbed = set([])