Re: Disabling newline characters
Re: Disabling newline characters
- Subject: Re: Disabling newline characters
- From: "Ujwal S. Sathyam" <email@hidden>
- Date: Sun, 15 Jun 2003 14:12:47 -0700
Okay, I've got an NSTypesetter hacked together in such a way that each character gets displayed by a glyph that's different from what would normally be displayed. I'm displaying a glyph for all characters (even control characters) and want them to be in a steady stream of glyphs.
The thing is, when a \n character gets in there, it displays the glyph I want for that character, but then it causes the cursor to jump to the next line as usual. How can I disable this, so that hitting a carriage return or pasting in some text that has a newline character would simply cause the glyph to be displayed where the \n is without breaking the line?
It's not trivial, but if you have a custom typesetter, you can explicitly set the lineFragmentRect in the NSLayoutManager for the range of glyphs. The lineFragment rect determines the position in the NSTextContainer where the text will be displayed. See:
- (void)setTextContainer:(NSTextContainer *)aTextContainer forGlyphRange:(NSRange)glyphRange
- (void)setLineFragmentRect:(NSRect)fragmentRect forGlyphRange:(NSRange)glyphRange usedRect:(NSRect)usedRect
- (void)setLocation:(NSPoint)aPoint forStartOfGlyphRange:(NSRange)glyphRange
under the NSLayoutManager API. The three are usually used together.
Ujwal
_______________________________________________
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.