Type Method

fontWithName:size:

Creates a font object for the specified font name and font size.

Declaration

+ (NSFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize;

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 value of the fontName parameter is a fully specified family-face name, preferably the PostScript name, such as Helvetica-BoldOblique or Times-Roman. (The Font Book app displays PostScript names of fonts in the Font Info panel.)

Specifying 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.

See Also

Creating Arbitrary Fonts

+ fontWithDescriptor:size:

Returns a font object for the specified font descriptor and font size.

+ fontWithDescriptor:textTransform:

Returns a font object for the specified font descriptor and text transform.

+ fontWithName:matrix:

Returns a font object for the specified font name and matrix.