Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,18 @@ public int getDepth () {
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @deprecated <p>This method returns a single global DPI value
* that does not reflect per-monitor DPI settings on modern operating systems.
* In environments with different scaling factors across monitors, it may provide
* a misleading or meaningless result, as it does not correspond to the actual DPI
* of any specific monitor.</p>
*
* <p>Note: While deprecated for general {@code Device} instances like {@code Display},
* this method may still be validly used when called on a {@code Printer} instance,
* where a single global DPI value is meaningful and expected.</p>
*/
@Deprecated
public Point getDPI () {
checkDevice ();
return getScreenDPI();
Expand Down Expand Up @@ -611,8 +622,9 @@ protected void init () {
/* Initialize the system font slot */
boolean smallFonts = System.getProperty("org.eclipse.swt.internal.carbon.smallFonts") != null;
double systemFontSize = smallFonts ? NSFont.smallSystemFontSize() : NSFont.systemFontSize();
Point dpi = this.dpi = getDPI(), screenDPI = getScreenDPI();
NSFont font = NSFont.systemFontOfSize(systemFontSize * dpi.y / screenDPI.y);
final int DOTS_PER_INCH = 72;
Point dpi = this.dpi = getDPI();
NSFont font = NSFont.systemFontOfSize(systemFontSize * dpi.y / DOTS_PER_INCH);
font.retain();
systemFont = Font.cocoa_new(this, font);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,18 @@ public int getDepth () {
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @deprecated <p>This method returns a single global DPI value
* that does not reflect per-monitor DPI settings on modern operating systems.
* In environments with different scaling factors across monitors, it may provide
* a misleading or meaningless result, as it does not correspond to the actual DPI
* of any specific monitor.</p>
*
* <p>Note: While deprecated for general {@code Device} instances like {@code Display},
* this method may still be validly used when called on a {@code Printer} instance,
* where a single global DPI value is meaningful and expected.</p>
*/
@Deprecated
public Point getDPI () {
checkDevice ();
return getScreenDPI();
Expand Down Expand Up @@ -641,6 +652,7 @@ public boolean getWarnings () {
* @see #create
*/
protected void init () {
final int DOTS_PER_INCH = 96;
if (debug) {
if (xDisplay != 0) {
/* Create the warning and error callbacks */
Expand Down Expand Up @@ -723,10 +735,9 @@ protected void init () {
}
}
defaultFont = OS.pango_font_description_copy (defaultFont);
Point dpi = getDPI(), screenDPI = getScreenDPI();
if (dpi.y != screenDPI.y) {
if (this.dpi.y != DOTS_PER_INCH) {
int size = OS.pango_font_description_get_size(defaultFont);
OS.pango_font_description_set_size(defaultFont, size * dpi.y / screenDPI.y);
OS.pango_font_description_set_size(defaultFont, size * this.dpi.y / DOTS_PER_INCH);
}
systemFont = Font.gtk_new (this, defaultFont);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,18 @@ public int getDepth () {
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @deprecated <p>This method returns a single global DPI value
* that does not reflect per-monitor DPI settings on modern operating systems.
* In environments with different scaling factors across monitors, it may provide
* a misleading or meaningless result, as it does not correspond to the actual DPI
* of any specific monitor.</p>
*
* <p>Note: While deprecated for general {@code Device} instances like {@code Display},
* this method may still be validly used when called on a {@code Printer} instance,
* where a single global DPI value is meaningful and expected.</p>
*/
@Deprecated
public Point getDPI () {
checkDevice ();
long hDC = internal_new_GC (null);
Expand Down
Loading