I was try use different font call “NanumMyeongjo.ttf” and it didn’t work.
I put “NanumMyeongjo.ttf” file into Resource and here are code…
CCLabelTTF* pLabel = CCLabelTTF::labelWithString(“Font Test”, “NanumMyeongjo.ttf”, 30);
cocos2d-iphone uses FontLabel as third-party library to parse the custom ttf file.
But we haven’t implement this feature on cocos2d-x yet.
Issue #347 is created 1 month ago, but we still have no time to do it.
@Isaac Ashdown
It hears so bad. skia crashes. AFAIK, both GUI system & webkit on android use either skia or opengles for rendering.
I saw your post in another thread, so odd.
@Isaac Ashdown
After evaluating freetype library, we are clear that it cannot replace FontLabel directly. FreeType is too low-level for our usage.
We had to find new ways to render custom fonts. Do you have any suggestions?
Walzer, I am having a translation done to chinese for Mashemup, i would like to keep the current look of the game, so i guess i need to get the bitmap from the ttf.
Did freetype give you too much trouble to compile?
Ic… well, i think i will use, i need to create the look of my custom fonts so i already integrated cximage to use some of the features and to be able to access the bitmaps directly and modify them and add some stroke and effects to them.
After playing with the freetype library, i understand now what you mean by too low level.
It works and i get the bits done since i only need to extract a few characters although it is really a lot of work to have it generic.
At least on my case i dont need much of it so i guess i will use it.
There are not many other options to this one, right?
What about using the platform SDK? It seems it would be worth it, no? To be honest, without custom fonts the CCLabelTTF is fairly useless, because its pretty ugly
Seems at least on android it’s easy enough to do, and then sending the data as just a raw bitmap to the NDK layer shouldn’t be a problem. Guess it might be slow…but then if you want speed, you should use bitmap fonts anyway…
I agree with you, Isaac. Since we switch from skia to sdk to draw texts at 0.8.5, using sdk to support custom ttf seems feasible now.
Ming, what’s your opinion?
So! I noticed this feature was closed today, so i thought I’d grab the git edge version and take a peek.
It’s working very nicely on Android, which is fantastic! Thank you so much for implementing this!
However, it doesn’t appear to have made any changes on the win32 version. I notice that CCImage_win32 has seen some changes, and I’ve stepped through the code there and taken a look. It appears to be loading the font OK, as far as I can tell, but the rendered text is the same as before. It’s not a huge deal, as android is my target platform and all, I just do most of the development on win32…
Also, I was wondering - is it best practice to include the ‘.ttf’ extension in the font name, or to leave it out?
If remove ‘.ttf’ extension, it will be used as “xxx/yyy”. I think it is not so good. You may said that, in iOS, we just use “yyy” as the font name. But as you see, the ttf files are copied into the root directory of the app. If the android use like it, the ttf files should put into a directory with specified name, fonts as example. I think it is not a good idea.