Hi, it's me again.

I'm now trying to load some fonts, and will hopefully manage it soon. I'm just reporting what looks like a bug. I'm running an Ubuntu 7.04 system, with ClanLib 8.0 compiled here (downloaded source from website).

I've tried loading fonts in several ways. I couldn't load any system font, though I need to try another thing. One thing I found was that the graphical context and so forth probably needs to be initialized before loading any resources.

Also, a suggestion that might help debugging. The error thrown when a font is not properly loaded by the ResourceManager and you try to use CL_Font's constructor is something along the lines of "Resource 'Fonts/Font' is not of type 'font'". It would be a lot easier to understand that there was a problem loading the font if the resource manager itself threw the exception when it was in the loading process.

Anyway, I'm currently using the following resource file:
Code:
<resources>
	<section name="Fonts">
		<sprite name="FG">
			<image file="./glyphs2.tga"><alpha /></image>
		</sprite>

		<font name="Font">
			<bitmap glyphs="Fonts/FG" letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\1234567890'|!&quot;#$%&/()=?" />
		</font>
	</section>
</resources>
The application code follows:
Code:
virtual int main(int argc, char **argv){
		CL_ConsoleWindow console("Console");
		console.redirect_stdio();
		std::cout << "App start." << std::endl;
		
		try{
			CL_SetupCore setup_core;
			CL_SetupDisplay setup_display;
			CL_SetupGL setup_gl;
			CL_DisplayWindow window("FontTest", 1200, 200);
			CL_GraphicContext *gc = window.get_gc();
			
			CL_ResourceManager resources("resources.xml");
			resources.load_all();
			std::cout << "Resources loaded." << std::endl;
			
			//CL_Font xxx("Fonts/Crap", &resources);
			CL_Resource xxx = resources.get_resource("Fonts/Font");
			std::cout << xxx.get_type() << std::endl;
			CL_Font f("Fonts/Font", &resources);
			...
		}catch (CL_Error err){
			std::cout << err.message.c_str() << std::endl;
		}
	...
Now, if I add the or characters on the XML file, and to the glyphs file, I get an error like "Font error: Letter characters: 66, Available font glyphs: 65".

After some debugging, I found out that those two characters () actually count as TWO characters EACH. If I add , it goes from 64 to 66, and if then add , it goes from 66 to 68. It gets counted twice. I'm not sure why that happens. I've tried changing the encoding of the XML file (from UTF-8 to ISO-9958-15) to see if that was it, but the same thing happened.

Seems I can't use those two characters, or maybe I can repeat them in the tga file. Either way, it's strange behaviour. I've tried using the html charcode, but the same happens.

Just letting you know!