Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-22 Thread Rua Haszard Morris
I need to support arbitrary superscript, not just squared... I should be clear: - I initially only set superscript attribute for the characters that are superscript, i.e. part of a larger string. - When this attributed string was given to an NSTextField (static non editable), the textfield

Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-22 Thread Martin Wierschin
Personally, I don't think NSSuperscriptAttributeName is particularly useful. I just adjust the baseline and font size: newFontSize = oldFontSize * 0.75, baseline for superscript += 0.4 * oldFontSize, baseline for subscript -= 0.3 * oldFontSize. I do something very similar, but instead of

NSBaselineOffsetAttributeName support in NSTextField - bug? Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-21 Thread Rua Haszard Morris
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

Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-21 Thread Andrew Farmer
On 20 Jul 08, at 21:27, 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

how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-20 Thread Rua Haszard Morris
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