lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 271db22 14/15: Fix over eager assert in pdf_w


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 271db22 14/15: Fix over eager assert in pdf_writer_wx::output_html()
Date: Fri, 27 Jul 2018 17:23:17 -0400 (EDT)

branch: master
commit 271db223c99b5af88d6edb3bebb57cc6bdceccba
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Fix over eager assert in pdf_writer_wx::output_html()
    
    Only check for overflowing the page when rendering, not when measuring.
    
    This avoids spurious assertion failures when generating group quotes
    consisting from more than one page.
---
 pdf_writer_wx.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pdf_writer_wx.cpp b/pdf_writer_wx.cpp
index 5e6903d..4fd7c03 100644
--- a/pdf_writer_wx.cpp
+++ b/pdf_writer_wx.cpp
@@ -304,9 +304,20 @@ int pdf_writer_wx::output_html
         ,output_mode
         );
 
-    // Should have fit on this page, otherwise this is not the right overload
-    // to use -- call paginate_html() and the generic overload above instead.
-    LMI_ASSERT(height <= get_total_height() - y);
+    switch(output_mode)
+        {
+        case oe_render:
+            // When rendering, all the text should have fit on this page,
+            // otherwise this is not the right overload to use -- call
+            // paginate_html() and the generic overload above instead.
+            LMI_ASSERT(height <= get_total_height() - y);
+            break;
+        case oe_only_measure:
+            // It's fine if the output doesn't fit when measuring it, as this
+            // could be used to decide whether another page is needed or not,
+            // so don't do anything here.
+            break;
+        }
 
     return height;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]