Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Webb2016-10-14 04:08:13 +0000
committerLakshmi Shanmugam2017-01-20 09:54:54 +0000
commit47b959189d2b46210153eb2c3b433e8ad3989ef4 (patch)
tree92de917f2c6b013666fcb817a1ea17379cf1e275 /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org
parent68193a3e28cdebd6553725f78bccfd59798d5a69 (diff)
downloadeclipse.platform.swt-47b959189d2b46210153eb2c3b433e8ad3989ef4.tar.gz
eclipse.platform.swt-47b959189d2b46210153eb2c3b433e8ad3989ef4.tar.xz
eclipse.platform.swt-47b959189d2b46210153eb2c3b433e8ad3989ef4.zip
Bug 481144 - [Cocoa] Text lowered badly on Widgets in Preference and
Properties Update Font init method to directly use the system font when possible. Prior to this commit OSX 10.11 and higher (systems that use the San Francisco font) can render with unusual spacing. The root cause seems to be that the system font has an unusual baseline when a system font is manipulated or obtained by name. Specifically: - Calling `NSFont.systemFontOfSize` will return a font that renders correctly. - Calling `NSFont.boldSystemFontOfSize` will return a font that renders correctly. - Calling `NSFont.systemFontOfSize` followed by `NSFontManager .convertFont` will return a font that renders too low. - Calling `NSFont.fontWithName(".SF NS Text")` will return a font that sometimes renders too low (things seem to consistently go wrong when it's called after a `convertFont` call). The `Font.init` now attempts to deduce if the font requested is actually a system font and use direct system font handles. This update also seems to fix issue 486734. Change-Id:Ic613f72b911822385dfb9f0b32f82d8a5d895c77 Signed-off-by: pwebb@pivotal.io Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFont.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java3
3 files changed, 15 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 290c4a5091..8f5b003431 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -1317,6 +1317,10 @@
<method selector="ascender" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
+ <method class_method="true" selector="boldSystemFontOfSize:" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </method>
<method class_method="true" selector="controlContentFontOfSize:" swt_gen="true">
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
@@ -4965,10 +4969,12 @@
<enum name="NSTouchPhaseMoved" swt_gen="true"></enum>
<enum name="NSTouchPhaseStationary" swt_gen="true"></enum>
<enum name="NSTouchPhaseTouching" swt_gen="true"></enum>
+ <enum name="NSUnboldFontMask" swt_gen="true"></enum>
<enum name="NSUnderlineStyleDouble" swt_gen="true"></enum>
<enum name="NSUnderlineStyleNone" swt_gen="true"></enum>
<enum name="NSUnderlineStyleSingle" swt_gen="true"></enum>
<enum name="NSUnderlineStyleThick" swt_gen="true"></enum>
+ <enum name="NSUnitalicFontMask" swt_gen="true"></enum>
<enum name="NSUtilityWindowMask" swt_gen="true"></enum>
<enum name="NSViewHeightSizable" swt_gen="true"></enum>
<enum name="NSViewMaxXMargin" swt_gen="true"></enum>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFont.java
index 086664e40f..c2dfb1ccfc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFont.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFont.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,11 @@ public double /*float*/ ascender() {
return (double /*float*/)OS.objc_msgSend_fpret(this.id, OS.sel_ascender);
}
+public static NSFont boldSystemFontOfSize(double /*float*/ fontSize) {
+ long /*int*/ result = OS.objc_msgSend(OS.class_NSFont, OS.sel_boldSystemFontOfSize_, fontSize);
+ return result != 0 ? new NSFont(result) : null;
+}
+
public static NSFont controlContentFontOfSize(double /*float*/ fontSize) {
long /*int*/ result = OS.objc_msgSend(OS.class_NSFont, OS.sel_controlContentFontOfSize_, fontSize);
return result != 0 ? new NSFont(result) : null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index ff722d7bb2..db445ecd02 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -1065,6 +1065,7 @@ public static final long /*int*/ sel_bitsPerPixel = sel_registerName("bitsPerPix
public static final long /*int*/ sel_bitsPerSample = sel_registerName("bitsPerSample");
public static final long /*int*/ sel_blackColor = sel_registerName("blackColor");
public static final long /*int*/ sel_blueComponent = sel_registerName("blueComponent");
+public static final long /*int*/ sel_boldSystemFontOfSize_ = sel_registerName("boldSystemFontOfSize:");
public static final long /*int*/ sel_boolValue = sel_registerName("boolValue");
public static final long /*int*/ sel_borderWidth = sel_registerName("borderWidth");
public static final long /*int*/ sel_boundingRectForGlyphRange_inTextContainer_ = sel_registerName("boundingRectForGlyphRange:inTextContainer:");
@@ -2534,10 +2535,12 @@ public static final int NSTouchPhaseEnded = 8;
public static final int NSTouchPhaseMoved = 2;
public static final int NSTouchPhaseStationary = 4;
public static final int NSTouchPhaseTouching = 7;
+public static final int NSUnboldFontMask = 4;
public static final int NSUnderlineStyleDouble = 9;
public static final int NSUnderlineStyleNone = 0;
public static final int NSUnderlineStyleSingle = 1;
public static final int NSUnderlineStyleThick = 2;
+public static final int NSUnitalicFontMask = 16777216;
public static final int NSUtilityWindowMask = 16;
public static final int NSViewHeightSizable = 16;
public static final int NSViewMaxXMargin = 4;

Back to the top