Bug 237957

Summary: StyledTextPrintOptions should include margins
Product: [Eclipse Project] Platform Reporter: Peter Centgraf <peter>
Component: SWTAssignee: Felipe Heidrich <eclipse.felipe>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, heath.borders, PhilTroy, steve_northover
Version: 3.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 188006    

Description Peter Centgraf CLA 2008-06-20 12:06:38 EDT
StyledText.Printing includes this extremely frustrating bit of hard-coded logic, starting at line 401:

// one inch margin around text
clientArea.x = dpi.x + trim.x; 				
clientArea.y = dpi.y + trim.y;
clientArea.width -= (clientArea.x + trim.width);
clientArea.height -= (clientArea.y + trim.height);

I was very surprised to see this sort of "magic number" logic in SWT.  This should be configurable in the StyledTextPrintOptions with an intelligent default (1 inch, for backwards compatibility).  Currently, there is no way to control the margins without forking half of the swt.custom package.

Here's an example of the impact:  I was planning to use StyledText to render text for printing on a label with a total size of 1.25" x 2.25".  This bug makes it impractical.
Comment 1 Felipe Heidrich CLA 2008-06-20 17:42:19 EDT
*** Bug 188006 has been marked as a duplicate of this bug. ***
Comment 2 Eclipse Webmaster CLA 2019-09-06 15:31:43 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.