1 /*******************************************************************************
2 * Copyright (c) 2000, 2019 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15
16 public class NSFont extends NSObject {
17
NSFont()18 public NSFont() {
19 super();
20 }
21
NSFont(long id)22 public NSFont(long id) {
23 super(id);
24 }
25
NSFont(id id)26 public NSFont(id id) {
27 super(id);
28 }
29
ascender()30 public double ascender() {
31 return OS.objc_msgSend_fpret(this.id, OS.sel_ascender);
32 }
33
boldSystemFontOfSize(double fontSize)34 public static NSFont boldSystemFontOfSize(double fontSize) {
35 long result = OS.objc_msgSend(OS.class_NSFont, OS.sel_boldSystemFontOfSize_, fontSize);
36 return result != 0 ? new NSFont(result) : null;
37 }
38
descender()39 public double descender() {
40 return OS.objc_msgSend_fpret(this.id, OS.sel_descender);
41 }
42
displayName()43 public NSString displayName() {
44 long result = OS.objc_msgSend(this.id, OS.sel_displayName);
45 return result != 0 ? new NSString(result) : null;
46 }
47
familyName()48 public NSString familyName() {
49 long result = OS.objc_msgSend(this.id, OS.sel_familyName);
50 return result != 0 ? new NSString(result) : null;
51 }
52
fontName()53 public NSString fontName() {
54 long result = OS.objc_msgSend(this.id, OS.sel_fontName);
55 return result != 0 ? new NSString(result) : null;
56 }
57
fontWithName(NSString fontName, double fontSize)58 public static NSFont fontWithName(NSString fontName, double fontSize) {
59 long result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithName_size_, fontName != null ? fontName.id : 0, fontSize);
60 return result != 0 ? new NSFont(result) : null;
61 }
62
leading()63 public double leading() {
64 return OS.objc_msgSend_fpret(this.id, OS.sel_leading);
65 }
66
menuBarFontOfSize(double fontSize)67 public static NSFont menuBarFontOfSize(double fontSize) {
68 long result = OS.objc_msgSend(OS.class_NSFont, OS.sel_menuBarFontOfSize_, fontSize);
69 return result != 0 ? new NSFont(result) : null;
70 }
71
pointSize()72 public double pointSize() {
73 return OS.objc_msgSend_fpret(this.id, OS.sel_pointSize);
74 }
75
smallSystemFontSize()76 public static double smallSystemFontSize() {
77 return OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_smallSystemFontSize);
78 }
79
systemFontOfSize(double fontSize)80 public static NSFont systemFontOfSize(double fontSize) {
81 long result = OS.objc_msgSend(OS.class_NSFont, OS.sel_systemFontOfSize_, fontSize);
82 return result != 0 ? new NSFont(result) : null;
83 }
84
systemFontSize()85 public static double systemFontSize() {
86 return OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSize);
87 }
88
systemFontSizeForControlSize(long controlSize)89 public static double systemFontSizeForControlSize(long controlSize) {
90 return OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSizeForControlSize_, controlSize);
91 }
92
93 }
94