Re: current font
Re: current font
- Subject: Re: current font
- From: Douglas Davidson <email@hidden>
- Date: Mon, 4 Apr 2005 08:40:56 -0700
On Apr 3, 2005, at 12:27 PM, Roland Silver wrote: In my program, the cursor is positioned between two characters in a text view. How can I determine the current font?
You need to figure out what it is that you mean by the "current font". NSTextView uses what are called typing attributes to determine the font and other attributes for the next character typed; you can call -typingAttributes to examine these, or -setTypingAttributes: to change them, or you can listen for NSTextViewDidChangeTypingAttributesNotification to be informed when they change. Ordinarily the text view will set the typing attributes as appropriate when the selection changes, but there is no necessary connection between the attributes of the text and the typing attributes--for example, if you have a zero-length selection and pick a font from the font panel, or hit cmd-B for bold, then the typing attributes will change although nothing in the text changes. If you want to determine the attributes of a character in the text, just examine the attributes of the NSTextStorage--remember that NSTextStorage is a direct subclass of NSMutableAttributedString.
Douglas Davidson
|
_______________________________________________
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
References: | |
| >current font (From: Roland Silver <email@hidden>) |