• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
  • From: Ross Carter <email@hidden>
  • Date: Tue, 22 Jul 2008 12:43:53 -0400

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


I assume you've seen this, from http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#/ /apple_ref/doc/uid/TP40004903

"The superscript attribute indicates an abstract level for both super- and subscripts. The user of the attributed string can interpret this as desired, adjusting the baseline by the same or a different amount for each level, changing the font size, or both."

Are you perhaps setting a baseline attribute _and_ a superscript attribute? It sounds like the Cocoa text system is adjusting the baseline according to its notion of superscripts and ignoring your baseline attribute value.

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.

If the only thing you need to draw is a superscript 2, I like Andrew's solution.

Ross
_______________________________________________

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


  • Follow-Ups:
    • Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
      • From: Martin Wierschin <email@hidden>
    • Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
      • From: Rua Haszard Morris <email@hidden>
References: 
 >how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ? (From: Rua Haszard Morris <email@hidden>)
 >Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ? (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Exception thrown when calling NSConnection connectionWithReceivePort:sendPort:
  • Next by Date: Re: Newbie CALayer Questions
  • Previous by thread: Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
  • Next by thread: Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
  • Index(es):
    • Date
    • Thread