Loading images and fonts from zip archives

Hi, what I'm trying to do is to have a "skinning system", that would allow me to launch the application with diferent graphical interface. For that I need to place images and fonts in one file and load it from there. I tried to pack the resources in zip and then read them with ZipFile class and it's createStreamFromEntry(). Well this works for text files but does not for images. ImageFileFormat::loadFrom(*imgFile) always returns empty image even though the InputStream is created successfully.

I was also thinking about using ImageCache but I don't see how to do that for images that are in a zip file. Maybe if I could read them I could insert them manually with addImageToCache() but then I would have to generate some unique hash for it.

 

As for fonts - here I'm kind of lost completely. I could install the fonts to the OS, and then specify in some textfile within the archive the name of the font, but I think it would be better to just embed the font in the file.

 

Do you have any suggestion how to best achieve what I want? And do you see why loadFrom() method fails if it gets a steam created with createStreamFromEntry()?

 

Thanks

You can load images + fonts from any stream - it shouldn't make any difference whether it came from a zip or not. Most likely you're just made some kind of coding error, as you don't sound very confident about what you're doing there?

For fonts, the method to look at is Typeface::createSystemTypefaceFor

OK, I'll check the Typeface method. As for the image loading. You were of course right - I created a stream with wrong entry variable (this one pointed to  .txt file)