Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-12 Thread Navneet Kumar
Hi, Thanks for the valuable insights. Wishes, Navneet > On 12-Apr-2017, at 12:42 AM, Quincey Morris > wrote: > > On Apr 11, 2017, at 08:32 , Navneet Kumar > wrote: >> >>> 4. Anti-aliasing. There is some

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Quincey Morris
On Apr 11, 2017, at 08:32 , Navneet Kumar wrote: > >> 4. Anti-aliasing. There is some behind the scenes magic when drawing text, >> that determines whether it knows the background color and therefore whether >> it anti-aliases using the background color. >> > Tried

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Jens Alfke
> On Apr 11, 2017, at 9:49 AM, Gary L. Wade > wrote: > > If you need lightweight drawing, you could use an NSTextFieldCell, which > should give you some predictability. I don't recall the details, but there > are a number of things that NSTextField does (and

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Gary L. Wade
If you need lightweight drawing, you could use an NSTextFieldCell, which should give you some predictability. I don't recall the details, but there are a number of things that NSTextField does (and NSTextView) that aren't done with "raw" drawing (borders, margins, font resizing, etc.) -- Gary

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Navneet Kumar
Yes, I tried inside drawRect:, both YES and NO. The effect was still there. Thanks, Navneet Sent from my iPhone > On 11-Apr-2017, at 9:31 PM, gerti-cocoa...@bitart.com wrote: > > Did you try the > >CGContextRefctx=(CGContextRef)[[NSGraphicsContext > currentContext]graphicsPort]; >

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread gerti-cocoadev
Did you try the CGContextRefctx=(CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; CGContextSetShouldSmoothFonts(ctx,YES); stuff inside the -drawRect: method? That is where it needs to be. Try both YES and NO. Should be a visible difference. Gerd >

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Navneet Kumar
Hi, Here is another image with a character in each case zoomed in using ColorMeter. http://i66.tinypic.com/2w5m795.jpg Wishes, Navneet > On 11-Apr-2017, at 2:00 AM, Quincey Morris > wrote: > > On Apr 10, 2017, at 11:20 , Navneet Kumar

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Navneet Kumar
Hi, The image with bigger (21.0 points) Arial font is uploaded here: http://i65.tinypic.com/118g0fl.jpg The effect is clearly visible. The window is of a new small project made to show/resolve this issue only. I can send this small (around 50KB) project via email if you want. Please look at my

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Quincey Morris
On Apr 10, 2017, at 11:20 , Navneet Kumar wrote: > > Actually I’m using text fields for simplicity at a lot of places. And > drawInRect: at some places, in order to vertically centre the multi-line text > more conveniently. Here are some possibilities to consider: 1.

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Navneet Kumar
Hi, Checked. Both the fonts (text field’s as well as descAttribs) are same with same “spc” values, at run time. Tried with “Arial Bold”, but same result: text field rendering looks bolder and darker. As Rob suggested, if its a more deeper thing like “updateLayer vs not” case, what can be

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Jens Alfke
That's weird. I think you'll need to do some detective work. - Break at runtime and check what the value of textField.font actually is. - Try using a different font and see if it makes any difference. —Jens ___ Cocoa-dev mailing list

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Rob Petrovec
updateLayer vs not? By implementing drawRect: it automagically disables updateLayer for that view so the drawing mechanics are different under the hood. NSTextField may be using updateLayer while your manual implementation is not resulting in a different rendering of the text. Also try

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Navneet Kumar
Yes, the text field seems to draw bold font, but I have set the same bold font in drawInRect: as well. Here’s the code snippet. ——— For text field: bgColor = [[NSColor orangeColor] blendedColorWithFraction:0.25 ofColor:[NSColor yellowColor]]; [bgColor retain];

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Jens Alfke
> On Apr 10, 2017, at 7:41 AM, Navneet Kumar wrote: > > The image URL to a sample image: http://i63.tinypic.com/xbe0bc.jpg > > The top text is using a text field and bottom text is using drawInRect:. What are the exact text attributes? It

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread gerti-cocoadev
This may or may net help: CGContextRefctx=(CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; CGContextSetShouldSmoothFonts(ctx,YES); Gerd > On Apr 10, 2017, at 09:41, Navneet Kumar wrote: > > Hi, > > There is visible difference in

Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Navneet Kumar
Hi, There is visible difference in text when setting the same string, same font, same text colour to a text field. And when the same is done via NSString drawInRect method having same attributes for text. The image URL to a sample image: http://i63.tinypic.com/xbe0bc.jpg The top text is using