Font control in TextView, TextStorage?
Font control in TextView, TextStorage?
- Subject: Font control in TextView, TextStorage?
- From: Charles Turner <email@hidden>
- Date: Fri, 15 Jul 2005 11:26:37 -0400
Hi all-
A newbie question, so maybe what I need is a pointer to some conceptual
documentation I haven't found yet.
(OSX 10.3.9, Xcode 1.5)
I'm working on a simple console interface for an interpreter and it
seems to be working fine, but I have some issues with font control that
I'm unclear how to solve.
I started with a Cocoa Document configuration (MyDocument.nib) but
haven't done anything with MyDocument yet. Currently my interpreter is a
delegate to:
NSWindow: windowDidBecomeMain:
(When I receive this notification, I set up the interpreter's data
structures.)
NSTextView: textView: doCommandBySelector:
(If the user types a new line, I process the last line of the
associated TextStorage object and insertText: the result.)
. . . . . .
Although I've set the NSTextView to Monaco font in IB, I keep getting
Helvetica.
(I've also noticed that IB has the annoying habit of turning spell check
back on after I've set it to off, also...)
I know that there's a lot to setting fonts in Cocoa, but here's my
question:
I started out quizzing NSTextStorage about it's font setting and put:
NSLog( @"console font: %@", [[aTextView textStorage] font]);
in NSWindow: windowDidBecomeMain: and got (null) for an answer. (I was
originally using NSApplication: applicationDidFinishLaunching, and got
the same results).
If I put the same NSLog statement in the NSTextView: textView:
doCommandBySelector: method, I'll get the font information I was looking
for.
So why am I getting (null)? Where can I put code that will quiz the
TextView/TextStorage, etc. about the fonts they use other than somewhere
that will call the code everytime a user hits enter? (I know this is
just test code, but I'm assuming that I'll have to find a place I can
set the text attributes once and then forget about it.)
As I said, any RTFM advice greatly appreciated!
Best and thanks,
Charles Turner
<email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden