Can not change the font in my game

I want to use another font in my game like this:
CCLabelTTF* pLabel = CCLabelTTF::labelWithString(“Hello World”, “Marker Felt”, 24);
But it doesn’t work,the error info is:cocos2d-x debug info [could not find font Marker Felt replacing with Arial]

And I find it’s the same in cocos2dx’s font sample.

What’s wrong?


font.png (422.7 KB)

Does your system include this font “Marker Felt”?

Hi, custom ttf font isn’t supported in Blackberry port.

Hi, custom ttf font isn’t supported in Blackberry port.

does that mean that we should use spritefonts instead of ttf as an alternative, right?

James Chen wrote:

Hi, custom ttf font isn’t supported in Blackberry port.
Forgive me for such a late reply.
Does there any document for this?

it would be good to add this to the wiki

Hello, is there any kind of font supported???

So is the alignment/custom font issue now fixed in latest? I’ve tried the tests using the latest CCImage.cpp from dducharme, but it still doesn’t seem to work. Am I doing something wrong, or is this still a pending issue?

Thanks for all the hard work dducharme!

Ben

Ben Ward wrote:

So is the alignment/custom font issue now fixed in latest? I’ve tried the tests using the latest CCImage.cpp from dducharme, but it still doesn’t seem to work. Am I doing something wrong, or is this still a pending issue?
>
Thanks for all the hard work dducharme!
>
Ben

I used sprite font at last.
I don’t know if it support other fonts now.You can test cocos2dx’s font sample with the newest version.

顺旺 徐 wrote:

I used sprite font at last.
I don’t know if it support other fonts now.You can test cocos2dx’s font sample with the newest version.

Thanks for the reply Xu. I don’t really want to have to go through and replace every bit of text in my games with sprite fonts, as I have quite a lot of text which is already aligned perfectly for all the other platforms. Looks like I’m going to have to hack together a fix for this, as it’s quite a fundamental part of my UI design…

Ben

Update: I took another look at dducharme’s latest check-in, and updating CCImage.cpp and removing the old grskia dependency seems to have worked for me. Text alignment and wrapping now works (although wrapping is a little broken - it wraps mid-word). If anybody else is having this problem I suggest they look at Github and integrate the latest changes into their project.

Ben