From fcc5866881a80c59c0b57e400a2f171b5e0924c9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Aug 2008 18:02:39 -0700 Subject: [PATCH] Fix rendering of LRF files from TOR --- src/calibre/gui2/lrf_renderer/document.py | 1 + src/calibre/gui2/lrf_renderer/text.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/lrf_renderer/document.py b/src/calibre/gui2/lrf_renderer/document.py index 5bc72b3630..031b19f6f4 100644 --- a/src/calibre/gui2/lrf_renderer/document.py +++ b/src/calibre/gui2/lrf_renderer/document.py @@ -108,6 +108,7 @@ class _Canvas(QGraphicsRectItem): line = block.peek() y += block.bs.topskip block_consumed = False + line.height = min(line.height, self.max_y-y) # LRF files from TOR have Plot elements with their height set to 800 while y + line.height <= self.max_y: block.commit() if isinstance(line, QGraphicsItem): diff --git a/src/calibre/gui2/lrf_renderer/text.py b/src/calibre/gui2/lrf_renderer/text.py index cc0da9e5ad..4db7d505d7 100644 --- a/src/calibre/gui2/lrf_renderer/text.py +++ b/src/calibre/gui2/lrf_renderer/text.py @@ -450,7 +450,7 @@ class Line(QGraphicsItem): if self.current_link is not None: self.end_link() - # We justify is line is small and it doesn't have links in it + # We justify if line is small and it doesn't have links in it # If it has links, justification would cause the boundingrect of the link to # be too small if self.current_width >= 0.85 * self.line_length and len(self.links) == 0: