Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFontDescriptorMBS class.

NSFontDescriptorMBS.Constructor(AttributesDic as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes and returns a new font descriptor with the specified attributes.

attributes: The attributes for the new font descriptor. If nil, the font descriptor's attribute dictionary will be empty.

NSFontDescriptorMBS.copy as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the object.

NSFontDescriptorMBS.fontAttributes as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's dictionary of attributes.

NSFontDescriptorMBS.fontDescriptorByAddingAttributes(AttributesDic as Dictionary) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor that is the same as the receiver but with the specified attributes taking precedence over the existing ones.

NSFontDescriptorMBS.fontDescriptorWithFace(newFace as string) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor that is the same as the receiver but with the specified face.

newFace: The new font face.

Returns the new font descriptor.
Available in Mac OS X v10.4 and later.

NSFontDescriptorMBS.fontDescriptorWithFamily(newFamily as string) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor whose attributes are the same as the receiver but from the specified family.

newFamily: The new font family.

Returns the new font descriptor.
Available in Mac OS X v10.4 and later.

NSFontDescriptorMBS.fontDescriptorWithMatrix(matrix as Variant) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor that is the same as the receiver but with the specified matrix.

matrix: The new font matrix. Must be a NSAffineTransformMBS object.

Returns the new font descriptor.
Available in Mac OS X v10.4 and later.

NSFontDescriptorMBS.fontDescriptorWithSize(newPointSize as Double) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor that is the same as the receiver but with the specified point size.

newPointSize: The new point size.

Returns the new font descriptor.
Available in Mac OS X v10.4 and later.

NSFontDescriptorMBS.fontDescriptorWithSymbolicTraits(SymbolicTraits as Integer) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new font descriptor that is the same as the receiver but with the specified symbolic traits taking precedence over the existing ones.
Example
// get a bold font
dim n as NSFontMBS = NSFontMBS.boldSystemFontOfSize(13)
dim f as NSFontDescriptorMBS = n.fontDescriptor
dim w as Integer = f.symbolicTraits

// find similar font without bold
f = f.fontDescriptorWithSymbolicTraits( BitwiseAnd(w, Bitwise.OnesComplement(f.NSFontBoldTrait)))

// now check it
dim d as Dictionary = f.fontAttributes
w = f.symbolicTraits

if BitwiseAnd(w, f.NSFontBoldTrait) <> 0 then
MsgBox "bold"
else
MsgBox "not bold"
end if

symbolicTraits: The new symbolic traits.

Returns the new font descriptor.
Available in Mac OS X v10.4 and later.

NSFontDescriptorMBS.matchingFontDescriptorsWithMandatoryKeys as NSFontDescriptorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns all the fonts available on the system whose specified attributes match those of the receiver.

mandatoryKeys: Optional, keys that must be identical to be matched. Can be nil.

Returns the matching font descriptors.

For example, suppose there are two versions of a given font installed that differ in the number of glyphs covered (the new version has more glyphs). If you explicitly specify NSFontNameAttribute as the only mandatory key, then a font descriptor that specifies a font name and character set by default matches both versions, since the character set attribute is not used for matching. If you specify that font name and character set keys are mandatory, the returned array contains only the font that matches both keys.

Available in Mac OS X v10.4 and later.

See also:

NSFontDescriptorMBS.matchingFontDescriptorsWithMandatoryKeys(mandatoryKeys() as string) as NSFontDescriptorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns all the fonts available on the system whose specified attributes match those of the receiver.

mandatoryKeys: Optional, keys that must be identical to be matched. Can be nil.

Returns the matching font descriptors.

For example, suppose there are two versions of a given font installed that differ in the number of glyphs covered (the new version has more glyphs). If you explicitly specify NSFontNameAttribute as the only mandatory key, then a font descriptor that specifies a font name and character set by default matches both versions, since the character set attribute is not used for matching. If you specify that font name and character set keys are mandatory, the returned array contains only the font that matches both keys.

Available in Mac OS X v10.4 and later.

See also:

NSFontDescriptorMBS.matchingFontDescriptorWithMandatoryKeys as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a normalized font descriptor whose specified attributes match those of the receiver.

mandatoryKeys: Optional, keys that must be identical to be matched. Can be nil.

Returns the matching font descriptor.
The returned font descriptor is the first element returned from matchingFontDescriptorsWithMandatoryKeys.

See also:

NSFontDescriptorMBS.matchingFontDescriptorWithMandatoryKeys(mandatoryKeys() as string) as NSFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a normalized font descriptor whose specified attributes match those of the receiver.

mandatoryKeys: Optional, keys that must be identical to be matched. Can be nil.

Returns the matching font descriptor.
The returned font descriptor is the first element returned from matchingFontDescriptorsWithMandatoryKeys.

See also:

NSFontDescriptorMBS.matrix as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the current transform matrix of the receiver.

Must be a NSAffineTransformMBS object or nil!

NSFontDescriptorMBS.pointSize as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the point size of the receiver.
Example
dim f as NSFontMBS = NSFontMBS.fontWithName("Arial", 12)
dim d as NSFontDescriptorMBS = f.fontDescriptor
MsgBox str(d.pointSize)

NSFontDescriptorMBS.postscriptName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the PostScript name of the receiver.
Example
dim f as NSFontMBS = NSFontMBS.fontWithName("Arial", 12)
dim d as NSFontDescriptorMBS = f.fontDescriptor
MsgBox d.postscriptName

NSFontDescriptorMBS.symbolicTraits as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a bit mask that describes the traits of the receiver.
Example
dim n as NSFontMBS = NSFontMBS.boldSystemFontOfSize(13)
dim f as NSFontDescriptorMBS = n.fontDescriptor
dim w as Integer = f.symbolicTraits

if BitwiseAnd(w, f.NSFontBoldTrait) <> 0 then
MsgBox "bold"
else
MsgBox "not bold"
end if

Typeface information is specified by the lower 16 bits of system trait value.

The font family class constants classify certain stylistic qualities of the font. These values correspond closely to the font class values in the OpenType OS/2 table. The class values are bundled in the upper four bits of the NSFontSymbolicTraits and can be accessed via NSFontFamilyClassMask. For more information about the specific meaning of each identifier, refer to the OpenType specification.

NSFontDescriptorMBS.variantForKey(key as string) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the font attribute specified by the given key.

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


The biggest plugin in space...