tobihagemann / THLabel

UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.
https://tobiha.de
Other
668 stars 110 forks source link

Thin black outline around text #26

Closed jowie closed 9 years ago

jowie commented 10 years ago

If I render a white THLabel above a white background, you can see it adding a thin black line around the text. This also means that text rendered small will become thinner and disappear quicker than it should.

screen shot 2014-10-16 at 10 57 55

screen shot 2014-10-16 at 10 59 47

screen shot 2014-10-16 at 10 58 51

jowie commented 10 years ago

I've done a bit more research and it looks like it's got something to do with the premultiplied alpha... That is, it doesn't appear to be doing the premultiplied bit for some reason. If I run the same code in a UIKit application using UIGraphicsGetCurrentContext() then it works fine.

jowie commented 10 years ago

I've found a couple of possible ways to fix this... Please see http://stackoverflow.com/questions/26406551/why-am-i-getting-a-black-line-around-my-32-bit-context-in-cocos2d/26407669#26406872

tobihagemann commented 10 years ago

To put that in context, because I'm not sure what you mean: Are you using THLabel in cocos2d? Or what do you mean by a "non-UIKit" application? Could you send me an example project to tobias.hagemann@gmail.com? That would be great!

pronebird commented 9 years ago

@jowie How do you use it in cocos2d? Why don't you use other more reasonable solutions in OpenGL context, like TTF renderer or pre-rendered bitmap font?

jowie commented 9 years ago

Sorry, I haven't been checking my messages. I don't believe I ever said "non-UIKit application"...?

I'm afraid I won't be able to help on this subject much anymore, as I have left the company I was doing the project for. Sorry!

tobihagemann commented 9 years ago

No problem! You said something about "If I run the same code in a UIKit application [...]" and linked to a cocos2d stackoverflow answer. That's why I thought you were talking about a "non-UIKit application".

jowie commented 9 years ago

Now it's coming back to me... Sorry it's been a while. Yes, when I said "UIKit Application", I meant an app that wasn't using cocos2d. I'm not entirely sure now why we weren't using a different solution for cocos2d, so I would ignore my ramblings now!

tobihagemann commented 9 years ago

Alright, thanks for the info though! :)