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 L. Wade http://www.garywade.com/
> On Apr 11, 2017, at 9:39 AM, Navneet Kumar <[email protected]> wrote: > > 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, [email protected] wrote: >> >> Did you try the >> >> CGContextRef ctx=(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 >> >> >>> On Apr 11, 2017, at 10:55, Navneet Kumar <[email protected]> wrote: >>> >>> 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 >>>> <[email protected]> wrote: >>>> >>>> On Apr 10, 2017, at 11:20 , Navneet Kumar <[email protected] >>>> <mailto:[email protected]>> 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. Shadow. What happens if you don’t specify the shadow? >>>> >>>> 2. Resolution. It may be that the text drawing ends up in drawing contexts >>>> with different resolution backing stores (1x vs. 2x vs. 3x). >>>> >>>> 3. Size. Does the weird effect scale with point size? If you draw the text >>>> much larger, are the results much closer to each other? >>>> >>>> 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. >>>> >>>> 5. Overlays. It’s possible that NSTextField already draws the text more >>>> than once, to give a partial outline effect that increases contrast with >>>> mid-level color backgrounds. >>>> >>>> 6. Traits. NSTextField may be opting into the trait behavior that >>>> classifies text as Body, Headline, Caption, etc. These things might cause >>>> some adjustment to the font weight. Or the accessibility features that >>>> change the font appearance. (But I’m not sure which of those is available >>>> on macOS.) >>>> >>>> >>> >>> _______________________________________________ >>> _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
