nslayoutmanager

Stop text from wrapping with NSLayoutManager

Given any arbitrary, one-line string, my goal is to render it into a bitmap representation. However, I have no means of finding out its dimensions beforehand, so I am reduced to getting the glyph range's bounding rect and resizing my canvas if it's not large enough. Unfortunately, if the canvas is not wide enough for the string, but ta...

How to create skype like message window?

Hi all, I am just trying to design skype like message window , for this I have taken the NSDrawer element. It contains : a table view on left, menu items on top, text field on right bottom and text view at central portion on right side. Using text view I can play with string being displayed but I cannot draw the line between messages or...

How to paint background of specific range of text in NSTextView

Hi, This is not a specific bug, its more about not knowing how to do something. I've an NSTextView and I need to paint the background of specific ranges of text when the user clicks on a specific part of the text view. I've tried this but I just get erratic behaviour in the sense that sometimes text loses the foreground color or the ba...

Attempting to Apply NSMutableParagraphStyle to new NSRange Failing

All, I'm tweaking an NSTextView to basically support insertion of boiler plate text and indenting. I'm running into a problem where the indenting of boiler plate text is applied to non-boiler plate text after I remove the boiler plate indenting style from the edited range (i remove the style when the user hits enter). Here's where thi...

Generate a Custom PDF layout from an NSTextView?

Problem: Users need a pdf document generated in a set font and size and a fixed number of lines per page (each line numbered). Users are entering text into a standard NSTextView. If I just choose File->Print, the default layout will render as much text as will fit onto the page, more than just 25 lines. I understand that I can use an...

How to properly determine width of an attributed string

What I want to do: layout text using NSLayoutManager and set its NSTextContainer to the width of the widest string (glyph-wise) in an array of strings. What my problem is: The methods for determining the total 'glyph-width' seem to be incorrect because when I render the text it wraps. I did an experiment using a 32 character string wit...

Cocoa: NSTextStorageDelegate has out-of-date NSLayoutManager?

I'm working with a NSTextView and have a delegate set for its -textStorage property. Upon receipt of -textStorageDidProcessEditing: I need to apply attributes to portions of the text. My attributes are being applied, but they are always applied to the text before I made the edit, even though I'm invoking NSLayoutManager's methods not f...