Closed vojto closed 11 years ago
This is something I've looked at in the past too, but you may want to check up on what TUINSView
is doing. It's also layer-hosting TUIView
s with their layers added as sublayers to its layer.
Try the CATextLayer
example with a transparent NSView
and see what happens first.
Here are a few things that I tried:
It seems that adding a sublayer, and drawing text manually in it using NSAttributedString is ugly too. On the other hand, adding CATextLayer into TUIView hierarchy looks nice.
What platform are you on? (10.6,7,8?)
None of those examples have subpixel antialiasing – you can tell because the text color is all straight black, not multicolored (which is how SPAA works).
What seems to be happening here is that CATextLayer
is smart enough to disable SPAA, because it knows it can't do it correctly. The resulting text is antialiased "normally." The others are trying to do SPAA with a transparent background, with disastrous results.
^ This. Though apparently, in 10.8, NSText*
views can enable SPAA as long as there is one such compatible (opaque) superview in the view hierarchy. Odd.
Yeah, it's 10.8.
Well, I don't think there's any bug here, sorry about opening the issue without understanding the problem fully!
No problem! SPAA is an interesting topic. :)
@jspahrsummers Out of curiosity, do you have a sliver of an idea how 10.8 NSText*
views are able to use SPAA as long as there's one opaque ancestor?
My assumption is that they replicate their ancestor's rendered image in the same context, then draw the text on top.
@jspahrsummers I was thinking that too, but seems a bit too much work...
Hey,
I have a layer-hosting NSView with its own background.
If I simply insert a CATextLayer into that layer, everything looks great.
Now I try this:
The text rendering is very ugly. I understand that normally, layer needs to have a background in order for that subpixel AA to work, but in this case my parent layer is the background.
My first experiment (inserting simple CATextLayer with clear background) proves that it should work.
Can anybody help me please?