Custom text container weirdness
Custom text container weirdness
- Subject: Custom text container weirdness
- From: Brian Webster <email@hidden>
- Date: Thu, 18 Apr 2002 10:06:37 -0500
I've created a subclass of NSTextContainer that divides each
line of text into a series of evenly spaced chunks. So for
instance, if the chunk size is 4 characters and it's display the
string "abcdefghijkl", this will be displayed as:
abcd efgh ijkl
It does this by calculating the width necessary to hold four
characters (it handles monospaced fonts only) and returning that
rect for the line fragment, along with a remaining rect that
does not include the spacing between the chunks, so that the
next chunk will start at the right spot.
However, I'm having weird problems where certain characters
cause other characters to be moved to the next chunk, when in
fact they should fit perfectly fine in the chunk they're
supposed to be in. The set of characters that causes this, as
far as I can tell, is )]}?;:.,! (we'll call these the problem
characters)
So here's what happens: if any of these characters is (supposed
to be) positioned as the first character in a given chunk, it
will take a number of preceding characters with it from the
preceding chunk. It will take any number of characters that
belong to the problem set above, plus one more character,
regardless of what it is (unless that extra character won't fit
in the next chunk, in which case it just takes as many problem
characters as it can).
Some examples:
Should be |Comes out:
----------------------------------------------------
abcd efgh |abcd efgh
abcd .efg |abc d.ef g
ab.; .efg |a b.;. efg
ab.. .b.. .. |a b... b ....
I'm thinking that this somehow has to do with breaking by word,
or something like that. I tried setting a paragraph style with
different line break modes, but none of them had any effect on
this behavior. Is there something I'm missing here?
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.