File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
org.eclipse.draw2d.examples/sandbox/swt/bugs
org.eclipse.gef/src/org/eclipse/gef/internal/ui/rulers Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 15
15
import org .eclipse .swt .graphics .Font ;
16
16
import org .eclipse .swt .graphics .GC ;
17
17
import org .eclipse .swt .printing .Printer ;
18
- import org .eclipse .swt .widgets .Display ;
19
18
20
19
import org .eclipse .draw2d .PrinterGraphics ;
21
20
import org .eclipse .draw2d .SWTGraphics ;
22
21
23
22
public class Bug81467 {
24
23
25
24
public static void main (String [] args ) {
25
+ final float DOTS_PER_INCH = 96.0f ;
26
26
Font font = new Font (null , "Helvetica" , 12 , 0 ); //$NON-NLS-1$
27
27
Printer printer = new Printer ();
28
28
printer .startJob ("bugzilla 81467" ); //$NON-NLS-1$
@@ -31,7 +31,7 @@ public static void main(String[] args) {
31
31
SWTGraphics graphics = new SWTGraphics (gc );
32
32
PrinterGraphics printGraphics = new PrinterGraphics (graphics , printer );
33
33
34
- printGraphics .scale (( double ) printer .getDPI ().x / Display . getDefault (). getDPI (). x );
34
+ printGraphics .scale (printer .getDPI ().x / DOTS_PER_INCH );
35
35
printGraphics .setFont (font );
36
36
printGraphics .drawString ("Hello world" , 50 , 50 ); //$NON-NLS-1$
37
37
printGraphics .dispose ();
Original file line number Diff line number Diff line change 13
13
package org .eclipse .gef .internal .ui .rulers ;
14
14
15
15
import org .eclipse .swt .SWT ;
16
- import org .eclipse .swt .widgets .Display ;
17
16
18
17
import org .eclipse .draw2d .ColorConstants ;
19
18
import org .eclipse .draw2d .Figure ;
@@ -52,6 +51,7 @@ public class RulerFigure extends Figure {
52
51
* paintFigure(Graphics) method.
53
52
*/
54
53
private static final int BORDER_WIDTH = 3 ;
54
+ private static final float DOTS_PER_INCH = 96.0f ;
55
55
56
56
private boolean horizontal ;
57
57
private int unit ;
@@ -78,7 +78,7 @@ protected double getDPU() {
78
78
case RulerProvider .UNIT_PIXELS -> dpu = 1.0 ;
79
79
case RulerProvider .UNIT_CUSTOM -> dpu = rulerProvider .getCustomRulerDPU ();
80
80
default -> {
81
- dpu = transposer . t ( new Dimension ( Display . getCurrent (). getDPI ())). height ;
81
+ dpu = DOTS_PER_INCH ;
82
82
if (getUnit () == RulerProvider .UNIT_CENTIMETERS ) {
83
83
dpu = dpu / 2.54 ;
84
84
}
You can’t perform that action at this time.
0 commit comments