Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

swimlikehell

macrumors member
Original poster
Aug 31, 2006
46
0
Hello.

I am trying to display some information in a floating window which has a NSTextView in it. I stream the data out using for example is << setw(40) <<string with tree columns in a line. This displays it correctly in the console but the text edges are not even when I look at them in the NSTextView. If anyone has any suggestions on how I can display correctly they would be much appreciated.

Thanks
 
I'm not entirely sure I know what you mean, but it sounds like it has something to do with font spacing. The default font on OS X is proportionally spaced i.e a thin letter like an i does not take up as much space as a large letter like M. The console uses a fixed-width character set, so that all characters take up the same amount of space.
You may therefore just need to change the typeface used in your NSTextField to a fixed-width font. You can do this by calling setFont: on your text field, which it inherits from NSControl. This could be done like this:

Code:
[myTextField setFont:[NSFont fontWithName:@"Courier" size:10.0]];

This would set the font to courier (fixed-wdith) with a size of ten.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.