lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Header pagination PR


From: Vadim Zeitlin
Subject: Re: [lmi] Header pagination PR
Date: Mon, 24 Sep 2018 00:43:15 +0200

On Sun, 23 Sep 2018 21:55:47 +0000 Greg Chicares <address@hidden> wrote:

GC> This seems to be caused by the new <header> tag, which is currently
GC> used in one MST file only.

 Yes, I've arrived to the same conclusion in the meanwhile, although via
the use of brute force (i.e. my debugger) instead of logical deduction as I
wish I had.

 The problem is that there is another wxHtmlParser lurking in the code
handling this tag and, as it uses (and has to use) the same PDF DC as the
rest of the code, just creating it changes the font on this DC.

 The following patch fixes this too:

---------------------------------- >8 --------------------------------------
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index e2d29e85d..ad854062c 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1395,6 +1395,10 @@ class standard_page : public numbered_page
                 // rendered as part of the page body.
                 page_body_cell_->Detach(cell);
 
+                // Initializing wxHtmlWinParser changes the font of the DC, so
+                // ensure that we preserve the original font.
+                wxDCFontChanger preserve_font(writer.dc(), wxFont());
+
                 // And attach it to another HTML document representing just
                 // the header contents.
                 //
---------------------------------- >8 --------------------------------------

but if the previous one was vaguely unsatisfactory, this one is downright
ugly because there should just be no need for the code here to care about
the fonts...

 I'm going to think about a better way to handle this tomorrow as I'm too
tired to have a chance of having any good ideas today, but if you'd like to
fix the problem, you could apply the patch above for now: ugly as it is, it
does allow printing sample2ipp illustrations.

 Regards,
VZ


reply via email to

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