diff options
author | Niraj Modi | 2016-05-23 12:36:42 +0000 |
---|---|---|
committer | Niraj Modi | 2016-05-23 12:36:42 +0000 |
commit | ded710fe048320769abd651856e0bb30d5b50363 (patch) | |
tree | 9bd1b361e79e4bab9e3ad4e9b8b5fcdf17182241 | |
parent | b3ac9af6293bbb4de5becd7f3d0ed5bde49f6cdd (diff) | |
download | eclipse.platform.swt-ded710fe048320769abd651856e0bb30d5b50363.tar.gz eclipse.platform.swt-ded710fe048320769abd651856e0bb30d5b50363.tar.xz eclipse.platform.swt-ded710fe048320769abd651856e0bb30d5b50363.zip |
Bug 493517 - [HiDPI][Win32][GTK] Incorrect width of tab character
Change-Id: I1b927da558eb1b55534b7b8bf23a1aea37ce410d
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java | 22 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java | 22 |
2 files changed, 24 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java index 4525cde574..99f1005640 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.swt.graphics; +import java.util.*; + import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; @@ -1632,6 +1634,10 @@ public TextStyle[] getStyles () { */ public int[] getTabs() { checkLayout(); + return DPIUtil.autoScaleDown (getTabsInPixels ()); +} + +int[] getTabsInPixels () { return tabs; } @@ -2113,7 +2119,7 @@ public void setStyle (TextStyle style, int start, int end) { /** * Sets the receiver's tab list. Each value in the tab list specifies - * the space in pixels from the origin of the text layout to the respective + * the space in points from the origin of the text layout to the respective * tab stop. The last tab stop width is repeated continuously. * * @param tabs the new tab list @@ -2125,15 +2131,11 @@ public void setStyle (TextStyle style, int start, int end) { public void setTabs(int[] tabs) { checkLayout(); if (this.tabs == null && tabs == null) return; - if (this.tabs!= null && tabs != null) { - if (this.tabs.length == tabs.length) { - int i; - for (i = 0; i <tabs.length; i++) { - if (this.tabs[i] != tabs[i]) break; - } - if (i == tabs.length) return; - } - } + setTabsInPixels (DPIUtil.autoScaleUp (tabs)); +} + +void setTabsInPixels (int[] tabs) { + if (Arrays.equals (this.tabs, tabs)) return; this.tabs = tabs; if (tabs == null) { OS.pango_layout_set_tabs(layout, device.emptyTab); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 590b49d8b3..35a95f139b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.swt.graphics; +import java.util.*; + import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gdip.*; @@ -2579,6 +2581,10 @@ public TextStyle[] getStyles () { */ public int[] getTabs () { checkLayout(); + return DPIUtil.autoScaleDown (getTabsInPixels ()); +} + +int[] getTabsInPixels () { return tabs; } @@ -3223,7 +3229,7 @@ public void setStyle (TextStyle style, int start, int end) { /** * Sets the receiver's tab list. Each value in the tab list specifies - * the space in pixels from the origin of the text layout to the respective + * the space in points from the origin of the text layout to the respective * tab stop. The last tab stop width is repeated continuously. * * @param tabs the new tab list @@ -3235,15 +3241,11 @@ public void setStyle (TextStyle style, int start, int end) { public void setTabs (int[] tabs) { checkLayout(); if (this.tabs == null && tabs == null) return; - if (this.tabs != null && tabs !=null) { - if (this.tabs.length == tabs.length) { - int i; - for (i = 0; i <tabs.length; i++) { - if (this.tabs[i] != tabs[i]) break; - } - if (i == tabs.length) return; - } - } + setTabsInPixels (DPIUtil.autoScaleUp (tabs)); +} + +void setTabsInPixels (int[] tabs) { + if (Arrays.equals (this.tabs, tabs)) return; freeRuns(); this.tabs = tabs; } |