Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSFontManagerMBS class.
NSFontManagerMBS.addCollection(collectionName as String, Options as Integer = 0) as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
collectionName: The collection to add.
Options: Pass NSFontCollectionApplicationOnlyMask to make the collection available only to the application.
Return true if the font collection was successfully added; otherwise, false.
NSFontManagerMBS.addFontDescriptorsToCollection(descriptors() as NSFontDescriptorMBS, collectionName as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
descriptors: The font descriptors to add.
collectionName: The font collection to which descriptors are added.
NSFontManagerMBS.availableFontFamilies as string()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
These fonts are in various system font directories.
Some examples using this method:
NSFontManagerMBS.availableFontNamesMatchingFontDescriptor(descriptor as NSFontDescriptorMBS) as String()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.availableFontNamesWithTraits(traits as Integer) as string()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
traits: The font traits for which to return font names. You specify the desired traits by combining the font trait mask values described in Constants using the bitwiseor operator.
Returns the names of the corresponding fonts.
These fonts are in various system font directories.
If fontTraitMask is 0, this method returns all fonts that are neither italic nor bold. This result is the same one you'd get if fontTraitMask were NSUnitalicFontMask | NSUnboldFontMask.
NSFontManagerMBS.availableFonts as string()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
These fonts are in various system font directories.
Some examples using this method:
NSFontManagerMBS.availableMembersOfFontFamily(FontFamily as string) as Variant()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
family: The name of a font family, like one that availableFontFamilies returns.
Returns the available members of family.
Each entry of the returned variant array is another variant array with four members, as follows:
| 0. | The PostScript font name, as a string. |
| 1. | The part of the font name used in the font panel that's not the font name, as a string. This value is not localized—for example, "Roman", "Italic", or "Bold". |
| 2. | The font's weight, as a double. |
| 3. | The font's traits, as a double. |
The members of the family are arranged in the font panel order (narrowest to widest, lightest to boldest, plain to italic).
Some examples using this method:
NSFontManagerMBS.Enabled as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
True if the font conversion system's user interface items (the Font panel and Font menu items) are enabled; false if they're not.
(Read and Write computed property)
NSFontManagerMBS.fontDescriptorsInCollection(collectionName as String) as NSFontDescriptorMBS()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.fontHasTraits(fontName as string, Traits as Integer) as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
typeface: The name of the font.
fontTraitMask: The font traits to test, specified by combining the font trait mask values described in Constants using the bitwiseOR operation.
Returns true if the font named typeface has all the traits specified in fontTraitMask; false if it doesn't.
Using NSUnboldFontMask returns true if the font is not bold, false otherwise. Using NSUnitalicFontMask returns true if the font is not italic, false otherwise.
NSFontManagerMBS.isMultiple as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns true if the last font selection recorded has multiple fonts; false if it's a single font.
NSFontManagerMBS.orderFrontFontPanel
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 16.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.orderFrontStylesPanel
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 16.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.removeCollection(collectionName as String) as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Returns true on success and false on failure.
NSFontManagerMBS.removeFontDescriptorFromCollection(descriptor as NSFontDescriptorMBS, collectionName as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 17.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
descriptor: The font descriptor to remove.
collection: The font collection from which to remove the descriptor.
NSFontManagerMBS.selectedFont as NSFontMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.setSelectedAttributes(dic as dictionary, isMultiple as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
dic: The new attributes.
isMultiple: If true, informs the panel that multiple fonts or attributes are enclosed within the selection.
This method is used primarily by NSTextView.
Available in Mac OS X v10.3 and later.
NSFontManagerMBS.setSelectedFont(font as NSFontMBS, isMultiple as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
font: The font to set as selected.
isMultiple: If true, the Font panel indicates that more than one font is contained in the selection; if false, it does not.
An object that manipulates fonts should invoke this method whenever it becomes first responder and whenever its selection changes. It shouldn't invoke this method in the process of handling a changeFont message, as this causes the font manager to lose the information necessary to effect the change. After all fonts have been converted, the font manager itself records the new selected font.
NSFontManagerMBS.traitsOfFont(font as NSFontMBS) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Font: The font whose traits are returned.
Returns the font traits, returned as a mask created by combining values listed in Constants with the bitwiseOR operation.
NSFontManagerMBS.weightOfFont(font as NSFontMBS) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacCocoa Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Font: The font whose weight is returned.
A rough numeric measure the weight of the given font, where 0 indicates the lightest possible weight, 5 indicates a normal or book weight, and 9 or more indicates a bold or heavier weight.
The items on this page are in the following plugins: MBS MacCocoa Plugin.