• 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: NSLayoutManager and whitespace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLayoutManager and whitespace


  • Subject: Re: NSLayoutManager and whitespace
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 13 Apr 2006 13:16:56 +0200

Scott,

On 13.4.2006, at 9:52, Scott Thompson wrote:

What I want to do is measure some text which will be drawn later. The problem I'm having is for lines of text with trailing whitespace. The simplest case would be a single word with a space after it i.e. "Preferences_" (the underscore character in this case represents a space)

When I measure this string with a text layout object, it returns a width of something like 67 (for a particular font etc...).

If I then come back and draw that string into a field that is 67 points wide, the string hyphenates and wraps.

In my experience, NSLayoutManager indeed ignores any number of trailing spaces, but it goes both ways: they neither are taken into account when you get the usedRectForTextContainer:, but they *also* are ignored when the text is actually laid out. Namely, therefore, there should be no wrapping/hyphenation caused by trailing spaces either.


(Which is kind of natural, for these are not two different actions, but rather just twice the very same one: Layout Manager lays out the text somehow; usedRectForTextContainer: just returns the rectangle into which the text has been placed. *If* it wrapped/hyphenated, it would return an appropriate /higher/ usedRectForTextContainer.)

Do you perhaps use a *different* service when you are "drawing the string into 67 points"? That would explain the problem.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSLayoutManager and whitespace
      • From: Scott Thompson <email@hidden>
References: 
 >NSLayoutManager and whitespace (From: Scott Thompson <email@hidden>)

  • Prev by Date: Re: Problem with NSTextView
  • Next by Date: Re: Distributed Objects - setting protocol crashing GCC 4.0
  • Previous by thread: NSLayoutManager and whitespace
  • Next by thread: Re: NSLayoutManager and whitespace
  • Index(es):
    • Date
    • Thread