ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/ApplicationKit/Classes/NSFont.rtf

This is NSFont.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSFont 
pard s14 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject
fs20 
fs28 s7 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying
fi0 NSObject (NSObject)
fs20 
fs28 s8 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSFont.h
fs20 
fs28 pard s19 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 The NSFont class declares the programmatic interface to objects that correspond to fonts. NSFont is in principle an abstract class that represents fonts in general, not just PostScript fonts. In practice, at this time, NSFont objects represent PostScript fonts. Each NSFont object records a font'27s name, size, style, and matrix. When an NSFont object receives a b setb0  message, it establishes its font as the current font in the PostScript Server'27s current graphics state.
fs16 
fs28 For a given application, only one NSFont object is created for a particular PostScript font/size or font/matrix combination. That is'd0if you ask for 24-point Optima, a new font object is created for 24-point Optima if such an object doesn'27t exist already. When the NSFont class object receives a message to create a new object for a particular font, it first checks whether an object has already been created for that font. If so, the the NSFont class object returns the existing font object; otherwise, the the NSFont class object creates a new font object and returns it. 
fs16 
fs28 This sharing of NSFont objects minimizes the number of distinct font objects created. It also implies that no one object in your application can know whether it has the only reference to a particular NSFont object. Thus, NSFont objects shouldn'27t be deallocated, but should be treated like auto-released Foundation class objects.
fs16 
fs28 Where i matrixi0  is used, it refers to a PostScript-style six-element array of numbers that indicate transformations to be applied to a font. An NSFontIdentityMatrix identifies a font matrix used for fonts created by specifying a size.
fs16 
fs28 The i sizei0  of a font in the method definitions is defined in 'aapoints'ba, which in currently accepted practice, are actually PostScript units'd0a PostScript unit being defined as 1/72 of an inch, or 0.0139 of an inch. In metric equivalents, a PostScript unit is 0.3528 millimetres. PostScript 'aapoints'ba are minimally different from 'aaprinter'27s points'ba, so for all intents and purposes you can think of PostScript units and points as interchangeable.
fs16 
fs28 In general, you instantiate an NSFont object by sending one of the methods listed in 'aaCreating a Font Object'ba to the NSFont class object. The methods with b systemb0  and b user b0 in their names obtain special pre-determined fonts defined at the system level and the application level, respectively. In general, you would use the b fontWithName:size:b0  and b fontWithName:matrix:b0  methods to obtain a named font.
fs16 
fs28 A variety of methods are available for querying a font object. In particular, AFM (Adobe Font Metrics) data can be obtained by invoking b afmDictionaryb0  or b afmFileContentstab b0 .
fs16 
fs28 Methods whose descriptions state 'aaReturns'bcand matrix NSFontIdentityMatrix'ba actually return an NSFontIdentityMatrix whose first and fourth elements are multiplied by the current size of the font.
fs16 
fs28 pard s19 li100 fi0 ri1007 ql f0 b fs24 
fs28 Exceptions
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 Methods listed in 'aaCreating a Font Object'ba can all raise a NSFontUnavailableException if the requested font can'27t be constructed.
fs6 
fs28 s19 li100 fi376 fi0 f0 b fs36 
fs28 Creating a Font Object
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (NSFont *)b boldSystemFontOfSize:b0 (float)i fontSizei0 tab Returns the font object representing the bold system font
s11 li7030 fi-6553 fi-5796 tab tab of size i fontSizei0  and matrix NSFontIdentityMatrix.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSFont *)b fontWithName:b0 (NSString *)i fontNamei0  b matrix:b0 (const float *)i fontMatrix
s11 li7030 fi-6553 fi-5796 i0 tab Returns a font object for font i fontNamei0  and matrix i fontMatrixi0 .
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSFont *)b fontWithName:b0 (NSString *)i fontNamei0  b size:b0 (float)i fontSize
s11 li7030 fi-6553 fi-5796 i0 tab Returns a font object for font i fontNamei0  of size i fontSizei0 . 
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSFont *)b systemFontOfSize:b0 (float)i fontSizei0 tab Returns the font object representing the system font of size i fontSizei0  and matrix NSFontIdentityMatrix.
fi-6552 fs16 
fs28 fi-6552 + (NSFont *)b userFixedPitchFontOfSize:b0 (float)i fontSize
s11 li7030 fi-6553 fi-5796 i0 tab Returns the font object representing the application'27s fixed-pitch font of size i fontSizei0  and matrix NSFontIdentityMatrixi .
s9 li7029 fi-5794 fi-6552 i0 fs16 
fs28 fi-6552 + (NSFont *)b userFontOfSize:b0 (float)i fontSizei0 tab Returns the font object representing the application'27s standard font of size i fontSizei0  and matrix NSFontIdentityMatrix.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the Font
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (void)b setUserFixedPitchFont:b0 (NSFont *)i aFonti0 tab Sets the fixed-pitch font used by default in the application to i aFonti0 .
fi-6552 fs16 
fs28 fi-6552 + (void)b setUserFont:b0 (NSFont *)i aFonti0 tab Sets the standard font used by default in the application to i aFonti0 .
fi-6552 fs16 
fs28 fi-6552 + (void)b useFont:b0 (NSString *)i fontNamei0 tab Registers that i fontNamei0  is used in the document. This information is used by the printing machinery
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setb0 tab Makes this font the graphic state'27s current font.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Querying the Font
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSDictionary *)b afmDictionaryb0 tab Returns the font'27s AFM dictionary if the font has an AFM file. The return value can possibly be b nilb0 , so you must check to determine if a non-b nilb0  value was actually returned.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b afmFileContentstab b0 Returns the raw contents of the entire AFM file, in terms of strings, if the font has an AFM file. If the font does not have an AFM file, this method returns b nilb0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -}b  b0 (NSRect)b boundingRectForFonttab b0 Returns the bounding rectangle for the font. This is the font'27s FontBBox field scaled to the current size of the font.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b displayNameb0 tab Returns the full name of the font as displayed in the font panel. This is the localized version of the font'27s name. It is not necessarily the FullName field of the font.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b familyNameb0 tab Returns the name of the font'27s family.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b fontNameb0 tab Returns the name of the font.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b isBaseFonttab b0 Indicates whether the font is a base font, as opposed to a composite font.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (const float *)b matrixb0 tab Returns a pointer to an array of six floats representing the font'27s matrix. You should not alter the data pointed to by matrix. If you wish to change values for any reason you must make a copy of the matrix 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (float)b pointSizeb0 tab Returns the size of the font in points. 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSFont *)b printerFonttab b0 Returns the printer font for the font, if the receiving font object is a screen font. Else, this method returns b selfb0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSFont *)b screenFontb0 tab Returns the screen font for the font, if there is one. Else this method returns b selfb0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (float)b widthOfString:b0 (NSString *)i stringi0 tab Returns the width of i stringi0  in the font. Use this method with caution: it assumes that the characters in i stringi0 can all actually be rendered in the font. It uses lossy encoding methods in NSString to get the character data.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (float *)b widthsb0 tab Returns a pointer to an array representing the widths of the glyphs in the font.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Manipulating Glyphs
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSSize)b advancementForGlyph:b0 (NSGlyph)i aGlyph
s11 li7030 fi-6553 fi-5796 i0 tab Returns the horizontal and vertical advancement for i aGlyphi0 . That is, this method returns the amount by which the current point would be displaced in both i xi0  and i yi0  if the specified glyph were rendered in the current font and size. In general, the i yi0  component of the displacement for 'aaWestern'ba fonts will be zero.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -}b  b0 (NSRect)b boundingRectForGlyph:b0 (NSGlyph)i aGlyph
s11 li7030 fi-6553 fi-5796 i0 tab Returns a bounding rectangle for i aGlyphi0 , scaled to the font'27s actual size and matrix.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b glyphIsEncoded:b0 (NSGlyph)i aGlyphtab i0 Indicates whether i aGlyphi0  is encoded. That is, i aGlyphi0  is present in the encoding for the font.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSPoint)b positionOfGlyph:b0 (NSGlyph)i curGlyphtab i0 Returns i curGlyphi0 '27s position when it follows i prevGlyph.
s11 li7030 fi-6553 fi-5796 i0 b precededByGlyph:b0 (NSGlyph)i prevGlyphtab tab i0  i nominali0  is a pointer to a BOOL. If not b nilb0 , this method
b isNominal:b0 (BOOL *)i nominali0 tab tab  fills in i nominali0  with YES, to indicate that the position has been modified by kerning information, and NO to indicate that no kerning information was present.
i 
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.