HelloCpp and TestCpp with no texts (linux)

Hi. I’m trying to compile cocos2d-x on Slackware Linux 64 bits (current). I’m also making some patches to turn the compilation generic as possible on Linux desktops.

But I’m finding a problem that I can’t figure out what is wrong: there are no texts on TestCpp neither on HelloCpp

There are someone with the same problem around here?


hello_cpp.png (497.5 KB)


test_cpp.png (4.0 KB)

The CCImage or CCTexture implementation uses a hardcoded fallback font in case it cannot find the font provided when creating a CCLabelTTF.

You may want to change the font of the label or change the path to the fallback font in either CCImage.cpp or CCTexture.cpp (it is set only once, I just can’t remember were it was exactly, had the same issue on my Slackware Box)

Just took a closer look into the code and it seems it could be easily changed to use the fontconfig library.
I’m about to implement this functionality right now.

However, I don’t see any possibility to load a font shipped with the application? In thr 1.x branch this was possible by creating a relative path to a resource file within the applications resource directory.
I’m asking if there is any other way to add a font into the font-table?
I have not checked the mobile platforms, was this feature removed there as well?

Depending on how the font handling should be done in gerneral I could change the getFontFile() function as following:

char* getFontFile(const char* family_name) {
    // Step 1 - check if the family-name is a filename to a valid font-file using getFullPathFromRelativePath()
    // Step 2 - if step 1 has failed use fontconfig and try to match the parameter with the FC_FAMILY property
    // Step 3 - if both step 1 and two have failed, return a hardcoded fallback value (or NULL)
}

Maybe someone can give me a quick overview on how fonts should be handled in the 2.x branch, as I’m planning to improve font rendering and word wrapping as well (none of this should impact other platforms though)

Hey, I’ve tested your branch (https://github.com/Weeds/cocos2d-x, and did a merge with my own), and now it’s working! Thank you!

I just had to add a minor fix for building libcocos2d (no -lfontconfig on Makefile).

You can check my patches on https://github.com/rodrigogolive/cocos2d-x, need more tests yet (as test if it have not broken another builds)

For instance, I’m not using eclipse to develop.