Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

NSFontDescriptorMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa MBS MacBase Plugin 12.1 Yes No No Yes, macOS only No
Function: The Cocoa class for a font descriptor.
Notes:
NSFontDescriptor objects provide a mechanism to describe a font with a dictionary of attributes. This font descriptor can be used later to create or modify an NSFont object. Mac OS X v10.4 and later provides a font matching capability, so that you can partially describe a font by creating a font descriptor with, for example, just a family name. You can then find all the available fonts on the system with a matching family name using matchingFontDescriptorsWithMandatoryKeys.

There are several ways to create a new NSFontDescriptor object. You can use the Constructor, fontDescriptorWithFontAttributes or fontDescriptorWithName. to create a font descriptor based on either your custom attributes dictionary or on a specific font's name and size. Alternatively you can use one of the fontDescriptor… instance methods (such as fontDescriptorWithFace) to create a modified version of an existing descriptor. The latter methods are useful if you have an existing descriptor and simply want to change one aspect.

All attributes in the attributes dictionary are optional.

Feedback, Comments & Corrections

Typeface Constants

Constant Value Description
NSFontBoldTrait 2 The font's typestyle is boldface.
Available in Mac OS X v10.4 and later.
NSFontCondensedTrait 64 The font's typestyle is condensed. Expanded and condensed traits are mutually exclusive.
Available in Mac OS X v10.4 and later.
NSFontExpandedTrait 32 The font's typestyle is expanded. Expanded and condensed traits are mutually exclusive.
Available in Mac OS X v10.4 and later.
NSFontItalicTrait 1 The font's typestyle is italic.
Available in Mac OS X v10.4 and later.
NSFontMonoSpaceTrait 1024 The font uses fixed-pitch glyphs if available. The font may have multiple glyph advances (many CJK glyphs contain two spaces).
Available in Mac OS X v10.4 and later.
NSFontUIOptimizedTrait 4096 The font synthesizes appropriate attributes for user interface rendering, such as control titles, if necessary.
Available in Mac OS X v10.4 and later.
NSFontVerticalTrait 2048 The font uses vertical glyph variants and metrics.
Available in Mac OS X v10.4 and later.

Font Family Class Constants

Constant Value Description
NSFontClarendonSerifsClass &h40000000 The font's style is a variation of the Oldstyle Serifs and the Transitional Serifs.
Available in Mac OS X v10.4 and later.
NSFontFreeformSerifsClass &h70000000 The font's style includes serifs, but it expresses a design freedom that does not generally fit within the other serif design classifications.
Available in Mac OS X v10.4 and later.
NSFontModernSerifsClass &h30000000 The font's style is based on the Latin printing style of the 20th century.
Available in Mac OS X v10.4 and later.
NSFontOldStyleSerifsClass &h10000000 The font's style is based on the Latin printing style of the 15th to 17th century.
Available in Mac OS X v10.4 and later.
NSFontOrnamentalsClass &h90000000 The font's style includes highly decorated or stylized character shapes such as those typically used in headlines.
Available in Mac OS X v10.4 and later.
NSFontSansSerifClass &h80000000 The font's style includes most basic letter forms (excluding Scripts and Ornamentals) that do not have serifs on the strokes.
Available in Mac OS X v10.4 and later.
NSFontScriptsClass &hA0000000 The font's style is among those typefaces designed to simulate handwriting.
Available in Mac OS X v10.4 and later.
NSFontSlabSerifsClass &h50000000 The font's style is characterized by serifs with a square transition between the strokes and the serifs (no brackets).
Available in Mac OS X v10.4 and later.
NSFontSymbolicClass &hC0000000 The font's style is generally design independent, making it suitable for special characters (icons, dingbats, technical symbols, and so on) that may be used equally well with any font.
Available in Mac OS X v10.4 and later.
NSFontTransitionalSerifsClass &h20000000 The font's style is based on the Latin printing style of the 18th to 19th century.
Available in Mac OS X v10.4 and later.
NSFontUnknownClass 0 The font has no design classification.
Available in Mac OS X v10.4 and later.

This class has no sub classes.

Some methods using this class:


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


NSFileWrapperMBS   -   NSFontManagerMBS




Links
MBS Xojo blog