Drawing text "with NSText"
Drawing text "with NSText"
- Subject: Drawing text "with NSText"
- From: "Alastair J.Houghton" <email@hidden>
- Date: Sun, 31 Aug 2003 18:23:16 +0100
In a number of places, both in the documentation and in Cocoa
Programming, we are told to use NSText in preference to NSString and
NSAttributedString's drawInRect:[withAttributes:] methods. There is
also a claim somewhere that all of the Cocoa UI elements use a shared
instance of NSText (the field editor, I think) to render their labels
(even the window title bar, apparently). Having looked at the text
system, though, I can't see how they could use NSText to do what is
claimed.
From what I can see, it would make sense to use an NSTextStorage, an
NSTextLayoutManager and an NSTextContainer to render text... perhaps
this is what the documentation means?
I suppose it could be that Cocoa uses the NSTextStorage and
NSTextContainer associated with the field editor, but that would mean
the field editor had to be an NSTextView (otherwise there doesn't
appear to be a way to get at the text storage and container objects).
Yet NSWindow's -fieldEditor:forObject: returns an NSText. (Yes, I know
that NSTextView is a subclass of NSText, but isn't it a bit
presumptuous to make the assumption that it will always be an
NSTextView?)
So, how does Cocoa draw text using an NSText instance?
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.