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

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


  • Follow-Ups:
    • Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
      • From: Andrew Farmer <email@hidden>
    • NSBaselineOffsetAttributeName support in NSTextField - bug? Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
      • From: Rua Haszard Morris <email@hidden>
  • Prev by Date: Re: Newbie CALayer Questions
  • Next by Date: ikimagebrowserview + bindings
  • Previous by thread: Re: Design question, which controller class to use
  • Next by thread: NSBaselineOffsetAttributeName support in NSTextField - bug? Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?
  • Index(es):
    • Date
    • Thread