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
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
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
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
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