• 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: Linearly Scaling Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linearly Scaling Text


  • Subject: Re: Linearly Scaling Text
  • From: Ajay Sabhaney <email@hidden>
  • Date: Sun, 29 May 2011 18:54:20 -0600

On 2011-05-25, at 3:41 PM, Douglas Davidson wrote:

>
> On May 25, 2011, at 2:37 PM, Ajay Sabhaney wrote:
>
>> - Instead of trying to scale text linearly, use a transformation to scale the NSTextView and image representation appropriately.  While this is easy to do with an image, I am having some issues scaling an NSTextView.  I've tried subclassing NSTextView, then in the drawRect method, I apply an affine transformation, then call the super's drawRect.  This almost works, except the caret acts as if no transformation was applied - it's size and position are unchanged even though the text is not.  I've also tried using the NSView method scaleUnitSquareToSize: - however this produces fuzzy text.
>
> Try taking a look at the source code for TextEdit--it's available as sample code, and it gives an example of scaling for NSTextViews.

Thanks for the pointer Douglas, I had a look at TextEdit and tried to use the same approach - however, it results in the same issues as using the scaleUnitSquareToSize approach where there are some "weird" drawing artifacts in which seemingly random rectangular portions of the text view are not drawn properly.

I have a suspicion that the reason for this has something to do with the fact that the NSTextView instance is being added as a subview of a layer-hosting view. I recognize that this is generally not recommended, however, our application uses a Core Animation layer hierarchy to handle animation and interaction with hundreds of layers at any given time. Without the use of a layer hierarchy, much of our application would not be possible.  View-backed layers would be too heavy for our application.  At the same time, however, layer hosting makes text editing very difficult._______________________________________________

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: Linearly Scaling Text
      • From: Kyle Sluder <email@hidden>
References: 
 >Linearly Scaling Text (From: Ajay Sabhaney <email@hidden>)
 >Re: Linearly Scaling Text (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Linearly Scaling Text
  • Next by Date: Re: Cocoa-preferred licensing key style?
  • Previous by thread: Re: Linearly Scaling Text
  • Next by thread: Re: Linearly Scaling Text
  • Index(es):
    • Date
    • Thread