Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java15
1 files changed, 3 insertions, 12 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 e634fe2366..c2846e19b0 100644
--- 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
@@ -634,19 +634,10 @@ public boolean isDisposed () {
public boolean loadFont (String path) {
checkDevice();
if (path == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- boolean result = false;
NSString nsPath = NSString.stringWith(path);
- long fsRepresentation = nsPath.fileSystemRepresentation();
-
- if (fsRepresentation != 0) {
- byte [] fsRef = new byte [80];
- boolean [] isDirectory = new boolean[1];
- if (OS.FSPathMakeRef (fsRepresentation, fsRef, isDirectory) == OS.noErr) {
- result = OS.ATSFontActivateFromFileReference (fsRef, OS.kATSFontContextLocal, OS.kATSFontFormatUnspecified, 0, OS.kATSOptionFlagsDefault, null) == OS.noErr;
- }
- }
-
- return result;
+ NSURL nsUrl = NSURL.fileURLWithPath(nsPath);
+ if (nsUrl == null) return false;
+ return OS.CTFontManagerRegisterFontsForURL(nsUrl.id, OS.kCTFontManagerScopeProcess, 0);
}
void new_Object (Object object) {

Back to the top