I am having enormous difficulty getting test text to show using Iw2DDrawString
Here is what I have got so far.
I used the font tool to create 2 files: "fontc.gxfont" and "fontc.tga"
I put these 2 files in the "data" folder and amended my .mkb asset section as follows:
assets
{
(data)
someimage.png
fontc.gxfont.bin
fontc.tga
}
My main function loads the font like this:
fontc=Iw2DCreateFont("fontc");
Iw2DSetFont(fontc);
Except that this does not work... I get this error on the x86 debug Win32 emulator:
IwAssert failure:
Channel: GX_FONT
File: IwResHandlerGXFONT.cpp
Line: 128
Expression: false
Message: Font fontc does not exist
Callstack:
CIwResHandlerGXFONT::Build
Iw2DCreateFont
What am I doing wrong?












kerpob,
I am sorry to hear, that you can't get test the fonts, but here is the solution to your problem:
The font system works in conjunction with the resource management, which means that you cannot include the fonts directly in your project as assets, but only as part of the resource management, which means that you need to create a group containing your font files. You need to take this route, because assets are "just being loaded", while the resource management system contains handlers, which help set up the font properties.
For information about resource management, please look here:
http://www.madewithmarmalade.com/devnet/docs#/api/iwresmanagerapidocumen...
I also want to point you towards one of our demos, which is exactly showcasing the steps to use fonts in Iw2D:
http://www.madewithmarmalade.com/devnet/docs#/api/api/ExampleIw2DStrings...
Good luck,
Chris
OK - I created a load group called Level1.group like this:
CIwResGroup
{
name "Level1"
"./fontc.gxfont"
"./fontc.tga"
}
Hmmm Now I get this error:
IwAssert failure:
Channel: GX_FONT
File: IwGxFontBuilder.cpp
Line: 143
Expression: false
Message: Could not open image cfont.tga
CIwTextParser error: /fontc.gxfont, line 10
Callstack:
CIwGxFontBuilder::OpenInputImage
CIwGxFontBuilder::Build
CIwGxFont::ParseAttribute
_ITXReadUnknown
CIwTextParser::_Parse
CIwTextParser::ParseString
CIwTextParser::ParseFile
CIwTextParserITX::ParseFile
CIwResHandlerGXFONT::Build
CIwResManager::LoadRes
CIwResGroup::ParseAttribute
_ITXReadUnknown
CIwTextParser::_Parse
CIwTextParser::ParseString
CIwTextParser::ParseFile
CIwTextParserITX::ParseFile
CIwResManager::LoadGroup
Now the weird thing is that cfont.tga does not exist, it is fontc.tga
I did use cfont.tga a couple of days ago when abortively tring to make it work. Now I think that cfont has got stuck in the system somewhere... how do I clear it out!
kerpob,
You probably binarised your group and are still working with the old group. I recommend to you:
1) Read the documentation about the resource management system, which is situated here: http://www.madewithmarmalade.com/devnet/docs#/api/iwresmanagerapidocumen...
2) Delete your data-ram directory and any ".bin" files you might still have in your data directory; Rerunning your application in X86 Debug will recreate the files, that you need.
Hope that solves your problems,
Chris
No, I deleted the directory... no luck. So I uninstalled marmalade and reinstalled (updated to 6.02). Still getting the same error referring to cfont.tga
I can only assume it's somehow got into the font itself... god knows how!
And indeed that was the reason. I created a new font and it worked fine.
Hmm,
I doubt installing and deinstalling Marmalade is a fruitful way of solving resource problems and I hope that you will have a way of finding the real culprit, so you can avoid the same problem in the future.
In any case, your problems are solved now and I hope your next post is to announce your finished project in the "Marmalade Apps" section.
Good luck,
Chris