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

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
wtf? :confused:

the window on the left is from IB, which clearly shows nice, anti-aliased text. the window on the right is the running build with choppy text... what's up with that? previously i had placed the text inside an NSWindow and it looked fine, but ever since i started placing my text on views it all changed.

any thoughts?
 

Attachments

  • Picture 1.png
    Picture 1.png
    26.8 KB · Views: 397

BravoBug

macrumors newbie
Dec 8, 2008
26
0
Oregon, USA
wtf? :confused:

the window on the left is from IB, which clearly shows nice, anti-aliased text. the window on the right is the running build with choppy text... what's up with that? previously i had placed the text inside an NSWindow and it looked fine, but ever since i started placing my text on views it all changed.

any thoughts?

I remember running into this problem before, although I can't remember how I solved it. You may want to consider just drawing your strings into the view itself with the drawAtPoint or drawInRect methods:

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSString_AppKitAdditions/Reference/Reference.html
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
text seems to automatically anti-alias inside a normal NSView... the difference with these views is that they are added and replaced subviews of a window using core animation... i'm sure that has something to do with it, but i'm still very surprised that the text is not anti-aliasing automatically, and i have no idea how to fix it.

however, i don't have much hope. i used Apple's own "Basic Cocoa Animations" app to learn how to do this, and i notice even in their own example the text has aliasing (look at Medium View): http://developer.apple.com/samplecode/BasicCocoaAnimations/index.html

:(

[edit] humm... just looking at other apps, i see they use this method (at least i think it's this method) to switch thru views, and their text is fine...
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
Subpixel AA is disabled in CoreAnimation layers. Did you by any chance set "wants layer" on the view?

yes i have this:

Code:
[[self contentView] setWantsLayer:YES];

are you suggesting that if i set this to NO then the text will anti-alias? isn't this line of code required for this method to work?

[EDIT] i changed all references to "setWantsLayer:NO" just to see what would happen. the text was no longer aliased and the animated resizing of the window frame from view to view still worked, but it no longer faded in and out of the views, which kinda ruins the nice effect and therefore doesn't really work for me :eek:
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
i changed all references to "setWantsLayer:NO" just to see what would happen. the text was no longer aliased and the animated resizing of the window frame from view to view still worked, but it no longer faded in and out of the views, which kinda ruins the nice effect and therefore doesn't really work for me :eek:
Right, you can either have antialiased text, or Core Animation, not both. (Apparently, I don't have personal experience in this but I've seen this topic come up a number of times). I think Apple's going to have to solve that, because it's a major inhibitor.
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
Right, you can either have antialiased text, or Core Animation, not both. (Apparently, I don't have personal experience in this but I've seen this topic come up a number of times). I think Apple's going to have to solve that, because it's a major inhibitor.

humm... that kinda sucks, and is pretty surprising... i guess i could use images of text instead? unless images in core animation layers are also choppy?
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
humm... that kinda sucks, and is pretty surprising... i guess i could use images of text instead? unless images in core animation layers are also choppy?
Yeah, I think using images is OK. What you could maybe do is draw your text into an image, so you have pre-rendered antialiasing. It's a bit of a PITA, but it might work.
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
Solved!

i got it! and it's somewhat of an very simple fix.

all i had to do was select the text in IB, click "Draws Background" in Attributes, and choose the color named "windowBackgroundColor" from Colors > Color Palettes > Palette: Developer...

the downside to this is that it only works on text fields, so the text accompanying Checkbox buttons needs to be replaced by a separate string, and Push Buttons with key equivalent set to "Return" for the continuos pulse still don't pulse correctly.

Actually, there is a bug that i found with core animation views besides aliased text. if a view has checkbox buttons with an pulsating push button (set to key equivalent "Return"), the checkboxes and their text will appear and disappear randomly when the view changes... i mean, it's a bug, but who uses pulsating push buttons anymore? what is it, 2001? :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.