Update:

If I set the superscript attribute for the exponent, and set a negative value (any negative value), the baseline is appropriate (i.e. lines up with surrounding controls).

The strange thing is that there only seem to be 3 baseline positions supported by NSTextField; any positive value, 0, and any negative value.

Is this correct behaviour? The documentation for NSBaselineOffsetAttribute name states that:

"The baseline offset attribute is a literal distance, in pixels, by which the characters should be shifted above the baseline (for positive offsets) or below (for negative offsets)." http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#/ /apple_ref/doc/uid/TP40004903

I like the fact that I can specify a negative number and it appears to correctly account for my superscript exponent, but I'm concerned that the value may actually be used in future, and/or there is some complicated interaction between the attributes. Is there documentation on NSTextField's support for attributed strings that explains why this is happening? Or should I report this as a bug?

Can anyone shed any light on why this is happening?

thanks
Rua HM.

On Jul 21, 2008, at 4:27 PM, Rua Haszard Morris wrote:

I am using NSSuperscriptAttributeName to make part of a string displayed in an NSTextView label display as superscript (to show "to the power of 2"). I may also use a smaller font attribute to make the "2" char smaller.

My problem is that thebaseline of the text drawn in the NSTextView is moved down (presumably to accommodate the superscript 2) and the label now looks wrong as the text doesn't line up with the other edits and labels on the line in the dialog.

Is there a correct, standard way to keep the baseline fixed when using an NSAttributedString in a NSTextView used as a label?

I've tried using a multi-line NSTextView, but this makes no difference. There is the possibility of tweaking the NSBaselineAttribute, or even the position of the NSTextView, but both approaches seem hacky or overkill (i.e. I'd need to correctly determine the baseline offset by querying the font superscript offset? and converting to pixels?)

thanks
Rua HM.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/r.haszardmorris%40adinstruments.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to