bugGNUstep - Bugs: bug #54307, Wrong margins especially when...

Group
 
 

bug #54307: Wrong margins especially when printing one page

Submitter:  Yavor Doganov <yavor>
Submitted:  Fri 13 Jul 2018 03:45:26 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  FredKiefer
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 27 Jul 2018 08:15:28 AM UTC, comment #7: 

I just committed the change to remove this is empty check before the translation. This should correct the behaviour for half filled pages. There surely are a lot more printing issues in GNUstep but the ones referenced in this report should be fixed by this.

Fred Kiefer <FredKiefer>
Group Member
Tue 17 Jul 2018 07:59:10 AM UTC, comment #6: 

I also tested printing multiple pages, there is no change in the behavior with Ink and TextEdit.  I don't know how to do that with Graphos, though...

Yavor Doganov <yavor>
Tue 17 Jul 2018 06:50:52 AM UTC, comment #5: 

The check was originally introduced by Gregory Casamento on  13 Mar 2009. But I don't expect that either of them (Eric and Greg) are following our discussion here. Nor would they probably remember what they where doing back then. We may have to figure this out ourselves :-(

If your try this change, please also do some multi page tests. I am almost sure it will improve the single page case but we also need to inspect other usages.

Fred Kiefer <FredKiefer>
Group Member
Mon 16 Jul 2018 10:42:21 AM UTC, comment #4: 

The last part of the test was removed by Eric Wasylishen on 23 December 2011 (commit d374f0a) precisely because of this problem.  However, he reverted it one hour later (commit 2f0f50c) with a comment that it broke Graphos printing.

I have a CUPS server with two different printers configured.  I can confirm that with this change printing a single page works correctly for me with Ink, TextEdit and Graphos.  I don't know what Graphos breakage he had in mind back then, perhaps he will remember?  Or we can ask Riccardo to test as he is undoubtedly more familiar with Graphos.

Yavor Doganov <yavor>
Sun 15 Jul 2018 08:58:42 PM UTC, comment #3: 

I tried very hard to understand a bit more of this issue. In the end I found line 4503 in NSView.m:

  if ((location.x != 0 || location.y != 0) && NSIsEmptyRect(aRect) == YES)

This only applies the following translation when the printed rectangle is empty. If I remove the last part of the test, a single page print gets positioned correctly. The question now is, why was this restriction here in the first place and will it have any negative results on other printing scenarios?

It really would help here, if you could do some experiments on your side as well. First to confirm whether this resolves the specific issue and next on negative side effects.

Fred Kiefer <FredKiefer>
Group Member
Sat 14 Jul 2018 07:36:22 PM UTC, comment #2: 

I thought the margins are always symmetrical, but anyway, your approach is clearly better.

You are right that the NSPrintOperation change is just a dirty workaround and apparently I haven't considered all subsequences.  I hope some solution can be found.  Thanks for looking into this.

Yavor Doganov <yavor>
Sat 14 Jul 2018 05:50:48 PM UTC, comment #1: 

Hi Yavor,

thank you for this bug report and the patch. I already had some similar changes to NSPrinter implemented after the discussion on the mailing list. That should be similar to your code but tries to unify different code paths.

As for NSPageLayout clearly the conversion was missing. I didn't like the way you set the margins on both sides to the same values. So I just added the corrected computation.

I also tried to add the same logic to the NSPrintInfo code.

Now with the NSPrintOperations change I understand which case you try to fix. But the patch would break scaling and a lot of other stuff. And it does not address the real issue here, just tries to work around in one special case. I will try to experiment with the printing code a bit and see whether I can come up woth something better.

Fred Kiefer <FredKiefer>
Group Member
Fri 13 Jul 2018 03:45:26 PM UTC, original submission:  

Reported initially by Patrick Cardona in these threads:
http://lists.gnu.org/archive/html/discuss-gnustep/2018-07/msg00003.html
http://lists.gnu.org/archive/html/discuss-gnustep/2018-07/msg00005.html

There are several unrelated issues:

1. Some PPD files contain (valid) lines like the following:

*PrintQuality Draft/Draft:

This results in exception when parsing (example file at
http://lists.gnu.org/archive/html/discuss-gnustep/2018-07/msg00017.html).

2. In NSPageLayout -tableView:objectValueForTableColumn:row: the margins for the standard papers are not correctly computed.  imageRect already has the printable margins but that is not taken into account so an expression like paperSize.height - imageRect.size.height makes the topMargin twice larger than it should be.  Likewise for rightMargin.  Also, the result is actually in pts which gives funny figures; it should be converted to cm/in.

3. In NSPrintInfo -initWithDictionary: the margins should be set according to ImageableArea as the FIXME comment says.

4. When a page with short text (few lines) has to be printed, the text does not appear at the top of the page, as is expected, but is shifted way down below.  That's the most annoying item.  There are some changes by Greg in the "printing_fixes" branch which I think are related.  I haven't tested them but IMHO his approach is wrong and breaks printing of multiple pages (which appears to be working correctly right now).

The attached patch fixes all 4 issues for me although I admit I'm not sure whether it is correct.  The whole repagination logic seems way too awkward/convoluted to me and breaks reasonable WYSIWYG expectations.

Yavor Doganov <yavor>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by yavor (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-11 FredKiefer StatusReady For Test Fixed
        Open/ClosedIn Test Closed
    2018-07-27 FredKiefer StatusConfirmed Ready For Test
        Open/ClosedOpen In Test
    2018-07-17 FredKiefer Dependencies- bugs #35113 is dependent
    2018-07-17 FredKiefer Dependencies- bugs #37160 is dependent
    2018-07-14 FredKiefer StatusNone Confirmed
        Assigned toNone FredKiefer
    2018-07-13 yavor Attached File- Added 0001-Miscellaneous-printing-fixes.patch, #44553

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code