Bug 391678

Summary: Printing from print preview window prints light gray text
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: lnxusr
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: a.samirh78, nate, riaasm, sunwebrw
Priority: NOR Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.56

Description lnxusr 2018-03-10 20:24:24 UTC
When printing a document from the Print Preview window, the text is printed in light gray.  Immediately printing the same document without closing or reloading, prints in black as it should.

The print preview is white background with light gray text.  I'm using the Breeze Dark Schema in both Kate and the desktop.
Comment 1 riaasm 2018-07-23 09:44:29 UTC
I can confirm this behavior to a certain extent. I've also noticed that the Print Preview in Kate shows gray text on a white background. When you print it from there, I can confirm that it prints with gray text. When you print the document with the normal print dialog it's printed with black text on the white paper. 

I think this may be caused by the usage of color schema in Kate. My default color schema is set to Breeze Dark but the normal print dialog shows that this schema is overridden with the "Printing" schema (under Options > Layout). This seems correct behavior as it causes the text to be printed correctly. But it seems like this schema isn't applied in the Print Preview. When you print from the Print Preview page, the print dialog doesn't show the Layout tab containing the color schema, as in the normal print dialog.

The problem here seems to be that the print dialog from the preview is intended to print exactly as shown in the Print Preview and limits the options to ensure that. But the color schema for printing isn't applied to this preview, and there is no option to change this. 

Additionally, it seems like the Print Preview doesn't use the background color defined in the schema. This may be correct, since this background is defined as "Editor Background Colors" so they may only apply to the editor. However, the print dialog also has an option to print the background color (off by default) so it may still be able to print this background color. In this case, it may be good to show this in the print preview as well. 

Reproduction
* Configure Kate to use "Breeze Dark" as default color schema (Editor Component > Fonts & Colors). 
* Open the Print dialog (File > Print...), click on Options >> and go to the Layout tab. Make sure that the schema is set to "Printing"
* Write some text in the document and open the Print Preview
* The Print Preview shows the text in the color of the "Breeze Dark" color schema (instead of the "Printing" color schema defined for printing)
* Click the Print button from the Print Preview and click on Options >>. Confirm that there is no Layout tab containing an option for the color schema. 
* Print the document and notice that it prints the text in gray.
Comment 2 Ahmad Samir 2018-11-08 09:20:09 UTC
This would be a bug in Qt upstream, as kate uses qprintpreviewdialog.

Please file a bug upstream at https://bugreports.qt.io
Comment 3 Christoph Feck 2018-11-27 01:13:00 UTC
It would need a minimal test case to confirm the issue is in Qt. It could as well be a bug in Kate, treating colors differently on print preview and actual printing.
Comment 4 Ahmad Samir 2018-11-27 08:48:48 UTC
Fair enough, I'll see if I can reproduce it.
Comment 5 Ahmad Samir 2019-01-10 18:04:51 UTC
Thanks for the hint/nudge; turns out it's a bug in ktexteditor.


https://phabricator.kde.org/D18163
Comment 6 Dominik Haumann 2019-02-05 12:25:32 UTC
Git commit 28e59740d07070144ee677af2dcc14fd339e13cb by Dominik Haumann, on behalf of Ahmad Samir.
Committed on 05/02/2019 at 12:25.
Pushed by dhaumann into branch 'master'.

Set the color scheme to Printing for Print Preview

Summary:
Otherwise the print preview dialog somehow gets the text color from the
current default color scheme; also the user can't change the color scheme
either from the print preview dialog or the "print" dialog launched from
the preview dialog.
FIXED-IN: 5.55.0

Test Plan:
- Change the default color scheme in kate to a dark one, e.g. Breeze dark
- Open the print preview dialog, note that the text color is the one used
  in the breeze dark scheme, but the background color is still white

Apply the diff, now the print preview dialog should be using the Printing
color scheme as expected.

Reviewers: cullmann, #ktexteditor, dhaumann, mwolff

Reviewed By: #ktexteditor, dhaumann, mwolff

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D18163

M  +9    -0    src/printing/kateprinter.cpp

https://commits.kde.org/ktexteditor/28e59740d07070144ee677af2dcc14fd339e13cb
Comment 7 Ahmad Samir 2019-02-07 19:00:59 UTC
*** Bug 376270 has been marked as a duplicate of this bug. ***