Instance Method

convertFont:toFace:

Returns a font whose traits are as similar as possible to those of the given font except for the typeface, which is changed to the given typeface.

Declaration

- (NSFont *)convertFont:(NSFont *)fontObj toFace:(NSString *)typeface;

Parameters

aFont

The font whose traits are matched.

typeface

The new typeface; a fully specified family-face name, such as Helvetica-BoldOblique or Times-Roman.

Return Value

A font with matching traits and the given typeface, or aFont if it can’t be converted.

Discussion

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.

See Also

Converting Fonts Manually

- convertFont:toFamily:

Returns a font whose traits are as similar as possible to those of the given font except for the font family, which is changed to the given family.

- convertFont:toHaveTrait:

Returns a new version of the font object containing a single additional trait.

- convertFont:toNotHaveTrait:

Returns a new version of a font object without the specified traits.

- convertFont:toSize:

Returns a font object whose traits are the same as those of the given font, except for the size, which is changed to the given size.

- convertWeight:ofFont:

Returns a font object whose weight is greater or lesser than that of the given font.

currentFontAction

The current font conversion action.

- convertFontTraits:

Converts font traits to a new traits mask value.