Re: NSLayoutManager and whitespace
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