face->size->metrics->ascender seems to be unreliable for some fonts,
additionally the freetype documentation says that it may be used
differently for different fonts.
Therefore it may happen that the ascender of a font face is less then
the glyphs bounding box resulting in accessing invalid memory.
The fix is to use the bbox attribute instead of the ascender
First destroy CCDirector instance with cocos2d::CCDirector::sharedDirector()->end()
Then create new CCDirector instance with
cocos2d::CCApplication::sharedApplication()->run();
APP will crash at
CCApplication::setAnimationInterval
[[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ];
This patch fixed the size calculations for true type fonts (especially for
italic fonts)
Additinally a very simple greedy line break algorithm has been added for
true type labels.
As FcFontMach is quite an expensive call the results of getFontFile() are
now cached in an std::map if either a ttf file is packed with the app or
if a font file has been found by using fontconfig
We should only load the 'MarkerFelt-Wide' fallback font in 'CCImage.mm, _initWithString()' if the user is attempting to load a custom font, not when the user is attempting to load a system font. If the user is trying to load a system font then give back the default system font instead.
Fix up how fonts are loaded in Cocos2dx for iOS to work transparently with custom font filenames/paths such as 'MyCustomFont.ttf' or 'fonts/MyCustomFont.ttf'. Referring to fonts by these paths would be OK on Android but can't be used on iOS since fonts must be referred to by family name on iOS; we must use 'MyCustomFont' when referring to that particular font in both examples on iOS. Hence add the code to strip out the folder path and extension on iOS so that the font path 'MyCustomFont.ttf' and 'fonts/MyCustomFont.ttf' can be used transparently across all platforms. This is required especially in the case where we have custom fonts being referenced from CCB files, since CCB files store the font names with the .ttf extension included.