diff options
author | Silenio Quarti <silenio> | 2010-04-08 19:17:00 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2010-04-08 19:17:00 +0000 |
commit | d0cfa98c33dae187ddb28fd1d4be338006975a20 (patch) | |
tree | 6cd4fe754b267cfd192ed94c04461f23decac655 /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java | |
parent | c52a498d1686cfc621ac513da35a69d8c16a84ba (diff) | |
download | eclipse.platform.swt-d0cfa98c33dae187ddb28fd1d4be338006975a20.tar.gz eclipse.platform.swt-d0cfa98c33dae187ddb28fd1d4be338006975a20.tar.xz eclipse.platform.swt-d0cfa98c33dae187ddb28fd1d4be338006975a20.zip |
Bug 290373 - [Graphics] Lines not honoring print margi
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java index e59a2a149f..12f4cc6455 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java @@ -41,8 +41,8 @@ public abstract class Device implements Drawable { /* System Font */ Font systemFont; - - int /*long*/ paragraphStyleLTR, paragraphStyleRTL; + + NSMutableParagraphStyle paragraphStyle; /* Device DPI */ Point dpi; @@ -524,24 +524,12 @@ protected void init () { COLOR_CYAN = new Color (this, 0,0xFF,0xFF); COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF); - /* Initialize LTR and RTL CTParagraphStyleRef */ - CTParagraphStyleSetting setting = new CTParagraphStyleSetting(); - setting.spec = OS.kCTParagraphStyleSpecifierBaseWritingDirection; - setting.valueSize = 1; - setting.value = OS.malloc(setting.valueSize); - OS.memmove(setting.value, new byte[] {OS.kCTWritingDirectionLeftToRight}, setting.valueSize); - int /*long*/ settingsPtr = OS.malloc(CTParagraphStyleSetting.sizeof); - OS.memmove(settingsPtr, setting, CTParagraphStyleSetting.sizeof); - paragraphStyleLTR = OS.CTParagraphStyleCreate(settingsPtr, 1); - OS.free(setting.value); - OS.free(settingsPtr); - setting.value = OS.malloc(setting.valueSize); - OS.memmove(setting.value, new byte[] {OS.kCTWritingDirectionRightToLeft}, setting.valueSize); - settingsPtr = OS.malloc(CTParagraphStyleSetting.sizeof); - OS.memmove(settingsPtr, setting, CTParagraphStyleSetting.sizeof); - paragraphStyleRTL = OS.CTParagraphStyleCreate(settingsPtr, 1); - OS.free(setting.value); - OS.free(settingsPtr); + paragraphStyle = (NSMutableParagraphStyle)new NSMutableParagraphStyle().alloc().init(); + paragraphStyle.setAlignment(OS.NSLeftTextAlignment); + paragraphStyle.setLineBreakMode(OS.NSLineBreakByClipping); + NSArray tabs = new NSArray(new NSArray().alloc().init()); + paragraphStyle.setTabStops(tabs); + tabs.release(); /* Initialize the system font slot */ boolean smallFonts = System.getProperty("org.eclipse.swt.internal.carbon.smallFonts") != null; @@ -724,10 +712,8 @@ void printErrors () { * @see #destroy */ protected void release () { - if (paragraphStyleLTR != 0) OS.CFRelease(paragraphStyleLTR); - paragraphStyleLTR = 0; - if (paragraphStyleRTL != 0) OS.CFRelease(paragraphStyleRTL); - paragraphStyleRTL = 0; + if (paragraphStyle != null) paragraphStyle.release(); + paragraphStyle = null; if (systemFont != null) systemFont.dispose(); systemFont = null; |