lmi
[Top][All Lists]
Advanced

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

[lmi] Regression in group-quote PDF


From: Greg Chicares
Subject: [lmi] Regression in group-quote PDF
Date: Fri, 7 Aug 2020 17:19:25 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

To reproduce:

  File | New | Census
  Census | Edit case defaults
  "Names" tab: set corporation name to "XYZ"
  OK
  "Apply all changes"...answer "Yes"
  Census | Print group premium quote to PDF

Group quotes have a "banner" on which we draw some text, in
  file:     group_quote_pdf_gen_wx.cpp
  function: group_quote_pdf_generator_wx::output_image_header()
The relevant code is:

    pdf_writer.output_image(banner_image, "banner", scale, 0, pos_y);
    ...
    wxDCTextColorChanger set_white_text(pdf_dc, *wxBLACK);
    ...
    pdf_dc.DrawLabel(...)

Formerly, the text was drawn in white, superimposed on the
underlying banner--as though a new graphic overlay had been
added, with white text on a transparent background, so that
the color of the banner came through except for the white
superimposed text.

Now, since our recent wxWidgets and wxPdfDoc upgrade, it
looks like the text block's background color has changed
from transparent to white. White text on a white background
is of course not visible, but if we use the mouse to
highlight the area that contains the text, we can see that
the text is still present.

With this experimental patch:

---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 1cde4709..fccff7a2 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -887,6 +887,7 @@ void group_quote_pdf_generator_wx::output_image_header
     auto& pdf_dc = pdf_writer.dc();
 
     wxDCFontChanger set_bigger_font(pdf_dc, pdf_dc.GetFont().Scaled(1.5));
+    pdf_dc.SetTextBackground(wxTransparentColour);
     wxDCTextColorChanger set_white_text(pdf_dc, *wxWHITE);
 
     // Don't use html::text::from() here: instead, call
--->8--->8--->8--->8--->8--->8--->8--->8--->8--->8--->8---

everything seems to look okay. But that's probably not in
good taste: the wxDC_X_Changer classes, AIUI, are RAII
objects so that their effects are localized, but my call
to SetTextBackground() would seem to have a global effect,
which might be undesirable elsewhere. I don't find any
wxDCTextBackgroundColorChanger class (I guess it wouldn't
be useful enough to justify its existence).



reply via email to

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