Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFontMBS class.

NSFontMBS.boldSystemFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the Aqua system font used for standard interface items that are rendered in boldface type in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.boldSystemFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande-Bold 12.00 pt. P [] (0x1c082c0) fobj=0x1c09d30, spc=3.96"

If fontSize is 0 or negative, returns the boldface system font at the default size.

Some examples using this method:

NSFontMBS.controlContentFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for the content of controls in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.controlContentFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x16017750) fobj=0x160175c0, spc=3.80"

For example, in a table, the user's input uses the control content font, and the table's header uses another font. If fontSize is 0 or negative, returns the control content font at the default size.

NSFontMBS.fontWithDescriptor(fontDescriptor as NSFontDescriptorMBS, fontSize as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a font object for the specified font descriptor and font size.

fontDescriptor: A font descriptor object.
fontSize: The size in points to which the font is scaled.

Returns a font object for the specified descriptor and size.

In most cases, you can simply use fontWithName to create standard scaled fonts.
Available in Mac OS X v10.4 and later.

See also:

NSFontMBS.fontWithDescriptor(fontDescriptor as NSFontDescriptorMBS, TextTransform as Variant) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a font object for the specified font descriptor and text transform.

fontDescriptor: The font descriptor object describing the font to return.
textTransform: An affine transformation applied to the font. Must be a NSAffineTransformMBS object or nil!

Returns a font object for the specified name and transform.

In most cases, you can simply use fontWithName to create standard scaled fonts. If textTransform is non-nil, it has precedence over NSFontMatrixAttribute in fontDescriptor.

Available in Mac OS X v10.4 and later.

See also:

NSFontMBS.fontWithName(fontName as string, fontSize as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a font object for the specified font name and font size.
Example
dim n as NSFontMBS = NSFontMBS.fontWithName("Monaco", 12)

MsgBox n.description
// shows: "Monaco 12.00 pt. P [] (0x1805020) fobj=0x168114b0, spc=7.20"

The fontName is a fully specified family-face name, such as Helvetica-BoldOblique or Times-Roman. The fontSize is equivalent to using a font matrix of [fontSize 0 0 fontSize 0 0] . If you use a fontSize of 0.0, this method uses the default User Font size.

Fonts created with this method automatically flip themselves in flipped views. This method is the preferred means for creating fonts.

Some examples using this method:

NSFontMBS.labelFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the Aqua font used for standard interface labels in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.labelFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x1829350) fobj=0x18293f0, spc=3.80"

If fontSize is 0 or negative, returns the label font with the default size.

NSFontMBS.labelFontSize as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the size of the standard label font.
Example
MsgBox str(NSFontMBS.labelFontSize) // shows 10

NSFontMBS.menuBarFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for menu bar items, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.menuBarFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x17e00c00) fobj=0x17e00ca0, spc=3.80"

If fontSize is 0 or negative, returns the menu bar font with the default size.
Available in Mac OS X v10.3 and later.

NSFontMBS.menuFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for menu items, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.menuFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x1da6d80) fobj=0x1da6e20, spc=3.80"

If fontSize is 0 or negative, returns the menu items font with the default size.

NSFontMBS.messageFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for standard interface items, such as button labels, menu items, and so on, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.messageFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x1c11520) fobj=0x1c11790, spc=3.80"

If fontSize is 0 or negative, returns this font at the default size. This method is equivalent to systemFontOfSize().

NSFontMBS.monospacedDigitSystemFontOfSize(fontSize as double, weight as double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 22.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a version of the standard system font that contains monospaced digit glyphs.

fontSize: The desired font size specified in points. If you specify 0.0 or a negative number for this parameter, the method returns the system font at the default size.
weight: The desired weight of font lines, specified as one of the constants in NSFontWeight.

Returns a font object containing the system font with monospace digits at the specified size and weight.

The font returned by this method has monospaced digit glyphs. Glyphs for other characters and symbols may be wider or narrower than the monospaced characters. To ensure the font uses fixed spacing for all characters, apply the NSFontFixedAdvanceAttribute attribute to the any strings you render.

NSFontMBS.monospacedSystemFontOfSize(fontSize as double, weight as double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 22.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a monospace version of the system font with the specified size and weight.

fontSize: The desired font size specified in points. If you specify 0.0 or a negative number for this parameter, the method returns the system font at the default size.
weight: The desired weight of font lines, specified as one of the constants in NSFontWeight.

Returns a font object containing a monospace version of the system font at the specified size and weight.

Use the returned font for interface items that require monospaced glyphs. The returned font includes monospaced glyphs for the Latin characters and the symbols commonly found in source code. Glyphs for other symbols are usually wider or narrower than the monospaced characters. To ensure the font uses fixed spacing for all characters, apply the NSFontFixedAdvanceAttribute attribute to the any strings you render.

NSFontMBS.paletteFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for palette window title bars, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.paletteFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x18800c00) fobj=0x18800ca0, spc=3.80"

If fontSize is 0 or negative, returns the palette title font at the default size.

NSFontMBS.setUserFixedPitchFont(font as NSFontMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the font used by default for documents and other text under the user's control, when that font should be fixed-pitch, to the specified font.

Specifying font as nil causes the default to be removed from the application domain.

NSFontMBS.setUserFont(font as NSFontMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the font used by default for documents and other text under the user's control to the specified font.

Specifying font as nil causes the default to be removed from the application domain.

NSFontMBS.smallSystemFontSize as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the size of the standard small system font.
Example
MsgBox str(NSFontMBS.smallSystemFontSize) // shows 11

NSFontMBS.systemFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the Aqua system font used for standard interface items, such as button labels, menu items, and so on, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.systemFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x17e009d0) fobj=0x17e00ca0, spc=3.80"

If fontSize is 0 or negative, returns the system font at the default size.

Some examples using this method:

NSFontMBS.systemFontSize as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the size of the standard system font.
Example
MsgBox str(NSFontMBS.systemFontSize) // shows 13

Some examples using this method:

NSFontMBS.systemFontSizeForControlSize(controlSize as Integer) as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font size used for the specified control size.
Example
MsgBox str(NSFontMBS.systemFontSizeForControlSize(0)) // 13
MsgBox str(NSFontMBS.systemFontSizeForControlSize(1)) // 11

If controlSize does not correspond to a valid NSControlSize, returns the size of the standard system font.
Available in Mac OS X v10.3 and later.

NSFontMBS.titleBarFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for window title bars, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.titleBarFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x1a31b20) fobj=0x1a31bc0, spc=3.80"

If fontSize is 0 or negative, returns the title bar font at the default size. This method is equivalent to boldSystemFontOfSize.

NSFontMBS.toolTipsFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used for tool tips labels, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.toolTipsFontOfSize(12)

MsgBox n.description
// shows: "LucidaGrande 12.00 pt. P [] (0x1828db0) fobj=0x1828e50, spc=3.80"

If fontSize is 0 or negative, returns the tool tips font at the default size.

NSFontMBS.userFixedPitchFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used by default for documents and other text under the user's control (that is, text whose font the user can normally change), when that font should be fixed-pitch, in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.userFixedPitchFontOfSize(12)

MsgBox n.description
// shows: "Monaco 12.00 pt. P [] (0x1ad13a0) fobj=0x1ac2bd0, spc=7.20"

If fontSize is 0 or negative, returns the fixed-pitch font at the default size.

The system does not guarantee that all the glyphs in a fixed-pitch font are the same width. For example, certain Japanese fonts are dual-pitch, and other fonts may have nonspacing marks that can affect the display of other glyphs.

NSFontMBS.userFontOfSize(size as Double) as NSFontMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the font used by default for documents and other text under the user's control (that is, text whose font the user can normally change), in the specified size.
Example
dim n as NSFontMBS = NSFontMBS.userFontOfSize(12)

MsgBox n.description
// shows: "Helvetica 12.00 pt. P [] (0x19019b0) fobj=0x181fd00, spc=3.33"

If fontSize is 0 or negative, returns the user font at the default size.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...