Large text not displayed

auto scoreLabel = Label::createWithTTF(tmpScore->getCString(), "fonts/arial.ttf", this->visibleSize.height / 4);

The code above does not render the text on large resolutions such as iPhone 6 Plus. I am aware that the size of the text is the problem, but is there any workaround for this or any suggestion how to display the largest possible?

Thank you.

You may need to use getWinSizeInPixels().height instead?

The problem is, how to create a text with the same size. Not how to read a value that is smaller. I guess I have to use scaling, even though it is an ugly solution.

Ah, so you mean it doesn’t even display. So it’s probably hitting texture size limits? Is that what you mean? I wonder what happens if you specify a small design resolution if it will scale up the entire scene for you correctly. You may need to use scaling to achieve the affect. You can probably use a shader or texture parameters to make sure it looks decent after scaling up.

Part of the issue once you get it to render is that the 6+ is rendering larger and scaling down to fit the screen, unless cocos2d-x (or you) are forcing the OpenGL surface to be created with the exact size of the device.

If not then I’m confused at what the issue “looks” like.

Yes, it doesn’t appear on the screen. OpenGL error 0x501.

You could try and use BMFont instead assuming Glyphy or bmFont utilities support the size of text in pixels that you’re looking for.

I don’t think that scaling will be that ugly of a solution. Either you’re using aliased text and nearest neighbor scaling will work fine, or you’re using anti-aliased text (the default) and scaling shouldn’t it shouldn’t look that bad. You can always look into post-processing effects or shader programming to enhance the text after it’s scaled.

I would at least start with creating the label with a font size of maybe 128, to start. Then to scale it up so the label fills the screen/device height use setScale(this->visibleSize.height / fontSize); … again you may need to get the height of the screen/device in pixels instead of points, but since labels deal with points by default visibleSize may be the correct dimension.

You might try using a system font so it doesn’t create an atlas, and just renders the text to texture. If the complete text is guaranteed to be the size of the screen or smaller then you shouldn’t have any issues.

auto scoreLabel = Label::createWithSystemFont(tmpScore->getCString(), “Arial”, this->visibleSize.height / 4);