NSFont Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSFont.h |
Overview
NSFont objects represent fonts to an application, providing access to characteristics of the font and assistance in laying out glyphs relative to one another. Font objects are also used to establish the current font for drawing text directly into a graphics context, using the set method.
You don’t create NSFont objects using the alloc and init methods. Instead, you use either fontWithDescriptor:size: or fontWithName:size: to look up an available font and alter its size or matrix to your needs. These methods check for an existing font object with the specified characteristics, returning it if there is one. Otherwise, they look up the font data requested and create the appropriate object. NSFont also defines a number of methods for getting standard system fonts, such as systemFontOfSize:, userFontOfSize:, and messageFontOfSize:. To request the default size for these standard fonts, pass a negative number or 0 as the font size. See “The OS X Environment” in OS X Human Interface Guidelines for more information about system fonts.
Adopted Protocols
Tasks
Creating Arbitrary Fonts
-
+ fontWithName:size: -
+ fontWithDescriptor:size: -
+ fontWithDescriptor:textTransform: -
+ fontWithName:matrix:
Creating User Fonts
Creating System Fonts
-
+ boldSystemFontOfSize: -
+ controlContentFontOfSize: -
+ labelFontOfSize: -
+ menuFontOfSize: -
+ menuBarFontOfSize: -
+ messageFontOfSize: -
+ paletteFontOfSize: -
+ systemFontOfSize: -
+ titleBarFontOfSize: -
+ toolTipsFontOfSize:
Using a Font to Draw
Getting General Font Information
-
– coveredCharacterSet -
– fontDescriptor -
– isFixedPitch -
– mostCompatibleStringEncoding -
– renderingMode
Getting Information About Glyphs
Getting Metrics Information
-
+ labelFontSize -
+ smallSystemFontSize -
+ systemFontSize -
+ systemFontSizeForControlSize: -
– advancementForGlyph: -
– ascender -
– boundingRectForFont -
– boundingRectForGlyph: -
– capHeight -
– descender -
– getAdvancements:forGlyphs:count: -
– getAdvancements:forPackedGlyphs:length: -
– getBoundingRects:forGlyphs:count: -
– italicAngle -
– leading -
– matrix -
– maximumAdvancement -
– numberOfGlyphs -
– pointSize -
– textTransform -
– underlinePosition -
– underlineThickness -
– xHeight
Getting Font Names
Setting User Fonts
Getting Corresponding Device Fonts
Deprecated Methods
-
+ preferredFontNamesDeprecated in OS X v10.4 -
+ setPreferredFontNames:Deprecated in OS X v10.4 -
+ useFont:Deprecated in OS X v10.4 -
– afmDictionaryDeprecated in OS X v10.4 -
– defaultLineHeightForFontDeprecated in OS X v10.4 -
– encodingSchemeDeprecated in OS X v10.4 -
– glyphIsEncoded:Deprecated in OS X v10.4 -
– glyphPackingDeprecated in OS X v10.4 -
– isBaseFontDeprecated in OS X v10.4 -
– positionOfGlyph:forCharacter:struckOverRect:Deprecated in OS X v10.4 -
– positionOfGlyph:precededByGlyph:isNominal:Deprecated in OS X v10.4 -
– positionOfGlyph:struckOverGlyph:metricsExist:Deprecated in OS X v10.4 -
– positionOfGlyph:struckOverRect:metricsExist:Deprecated in OS X v10.4 -
– positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:Deprecated in OS X v10.4 -
– positionsForCompositeSequence:numberOfGlyphs:pointArray:Deprecated in OS X v10.4 -
– widthOfString:Deprecated in OS X v10.4
Vertical Fonts
Class Methods
boldSystemFontOfSize:
Returns the Aqua system font used for standard interface items that are rendered in boldface type in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the boldface system font at the default size.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hcontrolContentFontOfSize:
Returns the font used for the content of controls in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
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.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hfontWithDescriptor:size:
Returns a font object for the specified font descriptor and font size.
Parameters
- fontDescriptor
A font descriptor object.
- fontSize
The size in points to which the font is scaled.
Return Value
A font object for the specified descriptor and size.
Discussion
In most cases, you can simply use fontWithName:size: to create standard scaled fonts.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hfontWithDescriptor:textTransform:
Returns a font object for the specified font descriptor and text transform.
Parameters
- fontDescriptor
The font descriptor object describing the font to return.
- textTransform
An affine transformation applied to the font.
Return Value
A font object for the specified name and transform.
Discussion
In most cases, you can simply use fontWithName:size: to create standard scaled fonts. If textTransform is non-nil, it has precedence over NSFontMatrixAttribute in fontDescriptor.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hfontWithName:matrix:
Returns a font object for the specified font name and matrix.
Parameters
- fontName
The fully specified family-face name of the font.
- fontMatrix
A transformation matrix applied to the font.
Return Value
A font object for the specified name and transformation matrix.
Discussion
The fontName is a fully specified family-face name, such as Helvetica-BoldOblique or Times-Roman (not a name as shown in the Font Panel). The fontMatrix is a standard 6-element transformation matrix as used in the PostScript language, specifically with the makefont operator. In most cases, you can simply use fontWithName:size: to create standard scaled fonts.
You can use the defined value NSFontIdentityMatrix for [1 0 0 1 0 0]. Fonts created with a matrix other than NSFontIdentityMatrix don’t automatically flip themselves in flipped views.
Availability
- Available in OS X v10.0 and later.
See Also
-
– isFlipped(NSView)
Declared In
NSFont.hfontWithName:size:
Creates a font object for the specified font name and font size.
Parameters
- fontName
The fully specified family-face name of the font.
- fontSize
The size in points to which the font is scaled.
Return Value
A font object for the specified name and size.
Discussion
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] with fontWithDescriptor:size:. 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.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hlabelFontOfSize:
Returns the font used for standard interface labels in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size. If fontSize is 0 or negative, returns the label font with the default size.
Discussion
The label font (Lucida Grande Regular 10 point) is used for the labels on toolbar buttons and to label tick marks on full-size sliders. See “The OS X Environment” in OS X Human Interface Guidelines for more information about system fonts.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hlabelFontSize
Returns the size of the standard label font.
Return Value
The label font size in points.
Discussion
The label font (Lucida Grande Regular 10 point) is used for the labels on toolbar buttons and to label tick marks on full-size sliders. See “The OS X Environment” in OS X Human Interface Guidelines for more information about system fonts.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hmenuBarFontOfSize:
Returns the font used for menu bar items, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the menu bar font with the default size.
Availability
- Available in OS X v10.3 and later.
See Also
Declared In
NSFont.hmenuFontOfSize:
Returns the font used for menu items, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the menu items font with the default size.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hmessageFontOfSize:
Returns the font used for standard interface items, such as button labels, menu items, and so on, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns this font at the default size. This method is equivalent to systemFontOfSize:.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hpaletteFontOfSize:
Returns the font used for palette window title bars, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the palette title font at the default size.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsetUserFixedPitchFont:
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.
Discussion
Specifying aFont as nil causes the default to be removed from the application domain.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsetUserFont:
Sets the font used by default for documents and other text under the user’s control to the specified font.
Discussion
Specifying aFont as nil causes the default to be removed from the application domain.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsmallSystemFontSize
Returns the size of the standard small system font.
Return Value
The small system font size in points.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsystemFontOfSize:
Returns the Aqua system font used for standard interface items, such as button labels, menu items, and so on, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the system font at the default size.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsystemFontSize
Returns the size of the standard system font.
Return Value
The standard system font size in points.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hsystemFontSizeForControlSize:
Returns the font size used for the specified control size.
Parameters
- controlSize
The control size constant.
Return Value
The font size in points for the specified control size.
Discussion
If controlSize does not correspond to a valid NSControlSize, returns the size of the standard system font.
Availability
- Available in OS X v10.3 and later.
Declared In
NSFont.htitleBarFontOfSize:
Returns the font used for window title bars, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the title bar font at the default size. This method is equivalent to boldSystemFontOfSize:.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.htoolTipsFontOfSize:
Returns the font used for tool tips labels, in the specified size.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the tool tips font at the default size.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.huserFixedPitchFontOfSize:
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.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
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.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.huserFontOfSize:
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.
Parameters
- fontSize
The size in points to which the font is scaled.
Return Value
A font object of the specified size.
Discussion
If fontSize is 0 or negative, returns the user font at the default size.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hInstance Methods
advancementForGlyph:
Returns the nominal spacing for the given glyph—the distance the current point moves after showing the glyph—accounting for the receiver’s size.
Parameters
- aGlyph
The glyph whose advancement is returned.
Return Value
The advancement spacing in points.
Discussion
This spacing is given according to the glyph’s movement direction, which is either strictly horizontal or strictly vertical.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hascender
Returns the top y-coordinate, offset from the baseline, of the receiver’s longest ascender.
Return Value
The distance of the longest ascender’s top y-coordinate from the baseline in points.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hboundingRectForFont
Returns the receiver’s bounding rectangle, scaled to the font’s size.
Discussion
The bounding rectangle is the union of the bounding rectangles of every glyph in the font.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hboundingRectForGlyph:
Returns the bounding rectangle for the specified glyph, scaled to the receiver’s size.
Discussion
Japanese fonts encoded with the scheme “EUC12-NJE-CFEncoding” do not have individual metrics or bounding boxes available for the glyphs above 127. For those glyphs, this method returns the bounding rectangle for the font instead.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hcapHeight
Returns the receiver’s cap height.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hcoveredCharacterSet
Returns an NSCharacterSet object containing all of the nominal characters renderable by the receiver, which is all of the entries mapped in the receiver’s ‘cmap’ table.
Return Value
An NSCharacterSet object containing all of the nominal characters renderable by the receiver.
Discussion
The number of glyphs supported by a given font is often larger than the number of characters contained in the character set returned by this method. This is because characters and glyphs have a many-to-many mapping, rather than a strict one-to-one correspondence. In some cases a character may be represented by multiple glyphs, such as an “é” which may be an “e” glyph combined with an acute accent glyph “´”. In other cases, a single glyph may represent multiple characters, as in the case of a ligature, or joined letter. See “Typographical Concepts” in Cocoa Text Architecture Guide for more information.
Availability
- Available in OS X v10.2 and later.
Declared In
NSFont.hdescender
Returns the bottom y coordinate, offset from the baseline, of the receiver’s longest descender.
Discussion
Thus, if the longest descender extends 2 points below the baseline, descender will return –2.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hdisplayName
Returns the name, including family and face, used to represent the font in the user interface, typically localized for the user’s language.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hfamilyName
Returns the receiver’s family name—for example, “Times” or “Helvetica.”
Discussion
This name is the one that NSFontManager uses and may differ slightly from the AFM name.
The value returned by this method is intended for an application’s internal usage and not for display. Use displayName instead.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hfontDescriptor
Returns the receiver’s font descriptor.
Return Value
A font descriptor object that describes the receiver.
Discussion
The font descriptor contains a mutable dictionary of optional attributes for creating an NSFont object. See documentation on NSFontDescriptor for more information.
Availability
- Available in OS X v10.3 and later.
Declared In
NSFont.hfontName
Returns the receiver’s full font name, as used in PostScript language code—for example, “Times-Roman” or “Helvetica-Oblique.”
Discussion
The value returned by this method is intended for an application’s internal usage and not for display. Use displayName instead.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hgetAdvancements:forGlyphs:count:
Returns an array of the advancements for the specified glyphs rendered by the receiver.
Discussion
Returns in advancements an array of the advancements for the glyphs specified by glyphs and rendered by the receiver. The glyphCount must specify the count of glyphs passed in glyphs.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hgetAdvancements:forPackedGlyphs:length:
Returns an array of the advancements for the specified packed glyphs and rendered by the receiver.
Discussion
Returns in advancements an array of the advancements for the packed glyphs specified by packedGlyphs and rendered by the receiver. The glyphCount must specify the count of glyphs passed in packedGlyphs.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hgetBoundingRects:forGlyphs:count:
Returns an array of the bounding rectangles for the specified glyphs rendered by the receiver.
Discussion
Returns in bounds an array of the bounding rectangles for the glyphs specified by glyphs and rendered by the receiver. The glyphCount must specify the count of glyphs passed in glyphs.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hglyphWithName:
Returns the named encoded glyph, or –1 if the receiver contains no such glyph.
Parameters
- glyphName
The name of the glyph.
Return Value
The named encoded glyph.
Discussion
Returns –1 if the glyph named glyphName isn’t encoded.
Glyph names in fonts do not always accurately identify the glyph. The layout manager, an instance of NSLayoutManager, finds the correspondence between characters and glyphs. See Text Layout Programming Guide and NSLayoutManager Class Reference for more information.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hisFixedPitch
Returns a Boolean value indicating whether all glyphs in the receiver have the same advancement.
Return Value
YES if all glyphs in the receiver have the same advancement; NO if any advancements differ.
Discussion
Some Japanese fonts encoded with the scheme “EUC12-NJE-CFEncoding” return that they have the same advancement, but actually encode glyphs with one of two advancements, for historical compatibility. You may need to handle such fonts specially for some applications.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hisVertical
Returns whether the font is a vertical font.
Return Value
YES if the font is a vertical font; NO otherwise.
Availability
- Available in OS X v10.7 and later.
See Also
Declared In
NSFont.hitalicAngle
Returns the receiver’s italic angle, the amount that the font is slanted in degrees counterclockwise from the vertical, as read from its AFM file. Because the slant is measured counterclockwise, English italic fonts typically return a negative value.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hleading
Returns the receiver’s leading.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hmatrix
Returns the receiver’s font matrix, a standard six-element transformation matrix as used in the PostScript language, specifically with the makefont operator.
Discussion
In most cases, with a font of fontSize, this matrix is [fontSize 0 0 fontSize 0 0].
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hmaximumAdvancement
Returns the greatest advancement of any of the receiver’s glyphs.
Discussion
This advancement is always either strictly horizontal or strictly vertical.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hmostCompatibleStringEncoding
Returns the string encoding that works best with the receiver, where there are the fewest possible unmatched characters in the string encoding and glyphs in the font.
Return Value
The string encoding that works best with the receiver.
Discussion
You can use NSString‘s dataUsingEncoding: or dataUsingEncoding:allowLossyConversion: method to convert the string to this encoding.
If this method returns NSASCIIStringEncoding, it could not determine the correct encoding and assumed that the font can render only ASCII characters.
This method works heuristically using well-known font encodings, so for nonstandard encodings it may not in fact return the optimal string encoding.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hnumberOfGlyphs
Returns the number of glyphs in the receiver.
Discussion
Glyphs are numbered starting at 0.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hpointSize
Returns the receiver’s point size, or the effective vertical point size for a font with a nonstandard matrix.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hprinterFont
Returns the scalable PostScript font corresponding to itself.
Discussion
When sent to a font object representing a scalable PostScript font, returns self. When sent to a font object representing a bitmapped screen font, returns its corresponding scalable PostScript font.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hrenderingMode
Returns the rendering mode of the receiver.
Return Value
The rendering mode of the receiver.
Discussion
For valid rendering modes, see “Constants.”
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hscreenFont
Returns the bitmapped screen font corresponding to itself.
Discussion
When sent to a font object representing a scalable PostScript font, returns a bitmapped screen font matching the receiver in typeface and matrix (or size), or nil if such a font can’t be found. When sent to a font object representing a bitmapped screen font, returns nil.
Screen fonts are for direct use with the window server only. Never use them with Application Kit objects, such as in setFont: methods. Internally, the Application Kit automatically uses the corresponding screen font for a font object as long as the view is not rotated or scaled.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hscreenFontWithRenderingMode:
Returns a bitmapped screen font, when sent to a font object representing a scalable PostScript font, with the specified rendering mode, matching the receiver in typeface and matrix (or size), or nil if such a font can’t be found.
Discussion
For valid rendering modes, see NSFontRenderingMode.
Screen fonts are for direct use with the window server only. Never use them with Application Kit objects, such as in setFont: methods. Internally, the Application Kit automatically uses the corresponding screen font for a font object as long as the view is not rotated or scaled.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hset
Sets this font as the font for the current graphics context.
Discussion
This method sets the font for the graphics system but does not affect the higher-level settings of the Cocoa text system, which are controlled by text attributes.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hsetInContext:
Sets this font as the font for the specified graphics context.
Parameters
- graphicsContext
The graphics context for which the font is set.
Discussion
This method sets the font for the graphics system but does not affect the higher-level settings of the Cocoa text system, which are controlled by text attributes.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.htextTransform
Returns the current transformation matrix for the receiver.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSFont.hunderlinePosition
Returns the baseline offset that should be used when drawing underlines with the receiver, as determined by the font’s AFM file.
Discussion
This value is usually negative, which must be considered when drawing in a flipped coordinate system.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hunderlineThickness
Returns the thickness that should be used when drawing underlines with the receiver, as determined by the font’s AFM file.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hverticalFont
Returns a vertical version of the font.
Return Value
Returns a vertical version of the receiver if such a configuration is supported, otherwise it returns the receiver.
Discussion
A vertical font applies appropriate rotation to the text matrix in setInContext:, returns vertical metrics, and enables the vertical glyph substitution feature by default.
Availability
- Available in OS X v10.7 and later.
See Also
Declared In
NSFont.hxHeight
Returns the x-height of the receiver.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFont.hConstants
NSFontRenderingMode
These constants specify the font rendering mode.
typedef enum {
NSFontDefaultRenderingMode = 0,
NSFontAntialiasedRenderingMode = 1,
NSFontIntegerAdvancementsRenderingMode = 2,
NSFontAntialiasedIntegerAdvancementsRenderingMode = 3
} NSFontRenderingMode;
Constants
NSFontDefaultRenderingModeDetermines the actual mode based on the user preference settings.
Available in OS X v10.4 and later.
Declared in
NSFont.h.NSFontAntialiasedRenderingModeSpecifies antialiased, floating-point advancements rendering mode (synonymous with printerFont).
Available in OS X v10.4 and later.
Declared in
NSFont.h.NSFontIntegerAdvancementsRenderingModeSpecifies integer advancements rendering mode.
Available in OS X v10.4 and later.
Declared in
NSFont.h.NSFontAntialiasedIntegerAdvancementsRenderingModeSpecifies antialiased, integer advancements rendering mode.
Available in OS X v10.4 and later.
Declared in
NSFont.h.
Declared In
NSFont.hPostScript Transformation Matrix
The identity matrix.
const float *NSFontIdentityMatrix;
Constants
NSFontIdentityMatrixA transformation matrix useful as a parameter to fontWithDescriptor:size:.
Available in OS X v10.0 and later.
Declared in
NSFont.h.
Declared In
NSFont.hNSMultibyteGlyphPacking
A constant for glyph packing.
typedef enum {
NSNativeShortGlyphPacking = 5
} NSMultibyteGlyphPacking;
Constants
NSNativeShortGlyphPackingThe native format for OS X.
Available in OS X v10.0 and later.
Declared in
NSFont.h.
Discussion
Cocoa stores all text data as Unicode. The text system converts Unicode into glyph IDs and places them in 1-, 2-, or 4-byte storage depending on the context. To render text, you must convert the storage into a format the text engine understands. The following constants describe the glyph packing schemes the text rendering engine can use. They are used to extract glyphs from a font for making a multibyte (or single-byte) array of glyphs for passing to an interpreter, such as the window server, which expects a big-endian multibyte stream (that is, “packed glyphs”) instead of a pure NSGlyph stream. They’re used by glyphPacking. With Quartz, the engine always expects the format to be in 2-byte short array, so NSNativeShortGlyphPacking is the only format currently in use.
Declared In
NSFont.hReserved Glyph Codes
These constants define reserved glyph codes.
enum {
NSControlGlyph = 0x00FFFFFF,
NSNullGlyph = 0x0
};
Constants
NSControlGlyphNSGlyphGeneratorgeneratesNSControlGlyphfor all characters in the Unicode General Category C* and U200B (ZERO WIDTH SPACE).Available in OS X v10.0 and later.
Declared in
NSFont.h.NSNullGlyphA null glyph.
Available in OS X v10.0 and later.
Declared in
NSFont.h.
Declared In
NSFont.hKeys to the AFM Dictionary
These constants are used as keys retrieve information from an AFM dictionary. (Deprecated. The AFM dictionary is no longer used in OS X. Use the font metrics accessor methods listed with the individual constants instead.)
NSString *NSAFMFamilyName; NSString *NSAFMFontName; NSString *NSAFMFormatVersion; NSString *NSAFMFullName; NSString *NSAFMNotice; NSString *NSAFMVersion; NSString *NSAFMWeight; NSString *NSAFMEncodingScheme; NSString *NSAFMCharacterSet; NSString *NSAFMCapHeight; NSString *NSAFMXHeight; NSString *NSAFMAscender; NSString *NSAFMDescender; NSString *NSAFMUnderlinePosition; NSString *NSAFMUnderlineThickness; NSString *NSAFMItalicAngle; NSString *NSAFMMappingScheme;
Constants
NSAFMFamilyNameFont family name key. (Deprecated. Use
familyNameinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMFontNameFont name key. (Deprecated. Use
displayNameinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMFormatVersionFormat version name key. (Deprecated. This information is not relevant to OS X.)
Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMFullNameFull font name key. (Deprecated. Use
fontNameinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMNoticeFont notice key. (Deprecated. Use Apple Type Services instead.)
Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMVersionFont version key. (Deprecated. Use Apple Type Services instead.)
Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMWeightFont weight key. (Deprecated. Use the
NSFontManagermethodweightOfFont:instead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMEncodingSchemeFont encoding scheme key. (Deprecated. Use
mostCompatibleStringEncodinginstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMCharacterSetFont character set key. (Deprecated. Use
coveredCharacterSetinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMCapHeightFont cap-height key. (Deprecated. Use
capHeightinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMXHeightFont x-height key. (Deprecated. Use
xHeightinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMAscenderFont ascender height key. (Deprecated. Use
ascenderinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMDescenderFont descender depth key. (Deprecated. Use
descenderinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMUnderlinePositionFont underline rule position key. (Deprecated. Use
underlinePositioninstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMUnderlineThicknessFont underline rule thickness key. (Deprecated. Use
underlineThicknessinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMItalicAngleFont italic angle key. (Deprecated. Use
italicAngleinstead.)Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.NSAFMMappingSchemeFont mapping scheme key. (Deprecated. This information is irrelevant to OS X.)
Available in OS X v10.0 and later.
Deprecated in OS X v10.4.
Not available to 64-bit applications.
Declared in
NSFont.h.
Declared In
NSFont.hNSGlyph
This type is used to specify glyphs in such methods as glyphWithName:.
typedef unsigned int NSGlyph;
Availability
- Available in OS X v10.0 and later.
Declared In
NSFont.hNSGlyphRelation
These constants are used for calculating the layout of stacked glyphs. (Deprecated. Context-sensitive interglyph spacing is now performed at the typesetting stage)
typedef enum _NSGlyphRelation {
NSGlyphBelow = 1,
NSGlyphAbove = 2
} NSGlyphRelation;
Constants
NSGlyphBelowThe glyph is located below the base glyph. (Deprecated. Context-sensitive interglyph spacing is now performed at the typesetting stage.)
Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.NSGlyphAboveThe glyph is located above the base glyph. (Deprecated. Context-sensitive interglyph spacing is now performed at the typesetting stage.)
Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
NSFont.hNSMultibyteGlyphPacking
Glyph packing constants are used to extract glyphs from a font for making a multibyte (or single-byte) array of glyphs for passing to an interpreter, such as the window server. With Quartz, the engine always expects the format to be in 2-byte short array, so NSNativeShortGlyphPacking is the only format currently in use. (Deprecated. Use NSNativeShortGlyphPacking instead.)
enum {
NSOneByteGlyphPacking,
NSJapaneseEUCGlyphPacking,
NSAsciiWithDoubleByteEUCGlyphPacking,
NSTwoByteGlyphPacking,
NSFourByteGlyphPacking,
}
Constants
NSOneByteGlyphPackingOne-byte storage format. (Deprecated. Use
NSNativeShortGlyphPackinginstead.)Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.NSJapaneseEUCGlyphPackingExtended Unix Code for Japanese format. (Deprecated. Use
NSNativeShortGlyphPackinginstead.)Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.NSAsciiWithDoubleByteEUCGlyphPackingTwo-byte Extended Unix Code format. (Deprecated. Use
NSNativeShortGlyphPackinginstead.)Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.NSTwoByteGlyphPackingTwo-byte storage format. (Deprecated. Use
NSNativeShortGlyphPackinginstead.)Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.NSFourByteGlyphPackingFour-byte storage format. (Deprecated. Use
NSNativeShortGlyphPackinginstead.)Available in OS X v10.0 through OS X v10.4.
Declared in
NSFont.h.
Declared In
NSFont.hNotifications
NSAntialiasThresholdChangedNotification
Availability
- Available in OS X v10.4 and later.
Declared In
NSFont.hNSFontSetChangedNotification
Availability
- Available in OS X v10.4 and later.
Declared In
NSFont.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-06-11)