how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
- Subject: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
- From: Rua Haszard Morris <email@hidden>
- Date: Mon, 21 Jul 2008 16:27:01 +1200
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 (email@hidden)
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:
This email sent to email@hidden