-
Notifications
You must be signed in to change notification settings - Fork 904
Blurry LabelTTF caused by white fillstyle? #1092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any update to this? I get extremely blurry text: Changing the fill style to "rgba(0, 0, 0, 1)" worked for me: But of course I want colored strings! This only started happening when I updated to the latest dev version a few months ago. Before then I was using one from a year ago maybe, and the font isn't blurry there. I'm not using design sizes or anything. @dingpinglv: those two are different. If you look closely, the black one on top is higher-resolution than the white one on the bottom. Look closely at the "p", for example. This is more noticeable with smaller fonts. |
@MarkEHenderson: Thanks very much, I just ended up doing what you did - change the fillStyle, and then invert the image data. (Clearly I have to make this font bigger anyway.) It wasn't too expensive for me because I only have to do it when a label changes, which isn't so often... in any case, this issue really needs to be resolved in a proper manner. |
I'm wondering if this "blurriness" also affects other things such as Sprites? I noticed that there's a difference when I do:
vs
Thoughts? Or my guess is that it's related to: #1130 because it doesn't happen on "non-retina" devices |
I think that is likely a separate issue. This seems to have something to do with the fill color and style and how the blending of the text is done - something particular to LabelTTF. Although maybe that aliasing issue affects this also, but in a different way. I get this LabelTTF behavior on non-retina devices too. |
Another way to get around this is to use cc.LabelBMFont? |
Yep but then you don't get to use TTF fonts On Mon, Feb 17, 2014 at 4:56 PM, Grady Laksmono [email protected]:
|
Hi, |
We've noticed that LabelTTFs in webGL are really blurry, and took some time to try to fix them.
The only way I could get them to render with sharp edges was to change the context.fillStyle in _drawTTFInCanvasForWebGL to render the text as black:
right side is with context.fillStyle = "rgba(255,255,255,1)";
left side is with context.fillStyle = "rgba(0,0,0,1)";
of course, with the canvas text colored black, coloring the text didn't work correctly - everything just comes out as black.
I've solved that by changing the rendering code in the draw function:
becomes
I'm going to try to clean that up a little, as I suspect just forcing the blend funcs in that manner will cause other issues. For now though, the text looks a lot better than it did before, and the various colors of text we're using work fine.
EDIT
apparently those blend func values don't work in newer version of chrome and possibly other browsers. I'm working on figuring out a working solution for that.
EDIT 2
I couldn't get the blend functions to make the text white reliably across browsers, so I threw in some code at the bottom of _drawTTFInCanvasForWebGL to invert the canvas:
The text was updated successfully, but these errors were encountered: