[Openmcl-devel] NSFontAttributeName

Gary Byers gb at clozure.com
Mon Nov 3 04:29:02 PST 2008

It's a variable (even though it may be listed as a constant in some
documentation.)  The reader macro #& - followed by the case-sensitive
name of the foreign variable - can be used to access foreign variables:

? #&NSFontAttributeName
#<NS-MUTABLE-STRING "NSFont" (#x7FFF701D8410)>

The header file that declares it -

/System/Library/Frameworks/AppKit.framework/Headers/NSAttributedString.h -

does so 
/* Predefined character attributes for text. If the key is not in the dictionary, then use the default values as described below.
APPKIT_EXTERN NSString *NSFontAttributeName;                // NSFont, default Helvetica 12

along with declarations for other NSString variables that name character
attributes.  It's kind of strange to see something declared as a variable
(an instance of NSString) described as a constant, but it's also hard
to see how how any ObjC instance (of NSString or anything else) is a
"constant" in the same sense that a number or even a C string is.

This is a FAQ.

On Mon, 3 Nov 2008, Arthur W Cater wrote:

> I'm using the Cocoa-Application on Mac, Leopard OS, CCL  1.2-r11101M  (DarwinPPC32)
> I've tried at least #$NSFontAttributeName, #$NS-Font-Attribute-Name, #?NSFontAttributeName -
> and a few others that even I didn't think had any hope of success.
> Please help, what must I do to get at this and other attributed-string key constants?
> Arthur

More information about the Openmcl-devel mailing list