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.collectionNames as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The names of the current font collections.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.convertAttributes(dic as dictionary) as dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSFontManagerMBS.convertFont(font as NSFontMBS) 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.convertFontToFace(font as NSFontMBS, face as string) as NSFontMBS
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 whose traits are matched.
face: The new typeface; a fully specified family-face name, such as Helvetica-BoldOblique or Times-Roman.
Returns a font with matching traits and the given typeface, or aFont if it can't be converted.
This method attempts to match the weight and posture of aFont as closely as possible. Italic is mapped to Oblique, for example. Weights are mapped based on an approximate numeric scale of 0 to 15.
NSFontManagerMBS.convertFontToFamily(font as NSFontMBS, family as string) as NSFontMBS
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 whose traits are matched.
family: The new font famliy; a generic font name, such as Helvetica or Times.
Returns a font with matching traits and the given family, or aFont if it can't be converted.
This method attempts to match the weight and posture of aFont as closely as possible. Italic is mapped to Oblique, for example. Weights are mapped based on an approximate numeric scale of 0 to 15.
NSFontManagerMBS.convertFontToHaveTrait(font as NSFontMBS, trait as Integer) as NSFontMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Font: The font whose traits are matched.
Trait: The new trait; may be any one of the traits described in Constants. Using NSUnboldFontMask or NSUnitalicFontMask removes the bold or italic trait, respectively.
Returns a font with matching traits including the given trait, or font if it can't be converted.
Using NSUnboldFontMask or NSUnitalicFontMask removes the bold or italic trait, respectively.
NSFontManagerMBS.convertFontToNotHaveTrait(font as NSFontMBS, trait as Integer) as NSFontMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Font: The font whose traits are matched.
trait: The mask for the traits to remove, created using the bitwiseOr operator to combine the traits described in Constants. Using NSUnboldFontMask or NSUnitalicFontMask removes the bold or italic trait, respectively.
Returns a font with matching traits minus the given traits, or font if it can't be converted.
NSFontManagerMBS.convertFontToSize(font as NSFontMBS, size as Double) as NSFontMBS
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 whose traits are matched.
size: The new font size.
Returns a font with matching traits except in the new size, or aFont if it can't be converted.
NSFontManagerMBS.convertFontTraits(traits as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
traits: The current font traits.
Returns the new traits mask value to be used by convertFont:.
This method is intended to be invoked to query the font traits while the action message (usually changeFont:) is being invoked when the current font action is either NSAddTraitFontAction or NSRemoveTraitFontAction.
Available in Mac OS X v10.5 and later.
NSFontManagerMBS.convertWeightOfFont(font as NSFontMBS, up as boolean) as NSFontMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacCocoa Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
up: If true, a heavier font is returned; if it's false, a lighter font is returned.
Font: The font whose weight is increased or decreased.
Returns a font with matching traits except for the new weight, or font if it can't be converted.
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.