|
|
|
@ -196,12 +196,12 @@ namespace Gui
|
|
|
|
|
mFonts.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FontLoader::loadBitmapFonts(bool exportToFile)
|
|
|
|
|
void FontLoader::loadBitmapFonts()
|
|
|
|
|
{
|
|
|
|
|
for (const auto& path : mVFS->getRecursiveDirectoryIterator("Fonts/"))
|
|
|
|
|
{
|
|
|
|
|
if (Misc::getFileExtension(path) == "fnt")
|
|
|
|
|
loadBitmapFont(path, exportToFile);
|
|
|
|
|
loadBitmapFont(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -246,7 +246,7 @@ namespace Gui
|
|
|
|
|
float ascent;
|
|
|
|
|
} GlyphInfo;
|
|
|
|
|
|
|
|
|
|
void FontLoader::loadBitmapFont(const std::string &fileName, bool exportToFile)
|
|
|
|
|
void FontLoader::loadBitmapFont(const std::string &fileName)
|
|
|
|
|
{
|
|
|
|
|
Files::IStreamPtr file = mVFS->get(fileName);
|
|
|
|
|
|
|
|
|
@ -307,17 +307,6 @@ namespace Gui
|
|
|
|
|
|
|
|
|
|
std::string resourceName = name;
|
|
|
|
|
|
|
|
|
|
if (exportToFile)
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Image> image = new osg::Image;
|
|
|
|
|
image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE);
|
|
|
|
|
assert (image->isDataContiguous());
|
|
|
|
|
memcpy(image->data(), &textureData[0], textureData.size());
|
|
|
|
|
|
|
|
|
|
Log(Debug::Info) << "Writing " << resourceName + ".png";
|
|
|
|
|
osgDB::writeImageFile(*image, resourceName + ".png");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register the font with MyGUI
|
|
|
|
|
MyGUI::ResourceManualFont* font = static_cast<MyGUI::ResourceManualFont*>(
|
|
|
|
|
MyGUI::FactoryManager::getInstance().createObject("Resource", "ResourceManualFont"));
|
|
|
|
@ -494,13 +483,6 @@ namespace Gui
|
|
|
|
|
cursorCode->addAttribute("size", "0 0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exportToFile)
|
|
|
|
|
{
|
|
|
|
|
Log(Debug::Info) << "Writing " << resourceName + ".xml";
|
|
|
|
|
xmlDocument.createDeclaration();
|
|
|
|
|
xmlDocument.save(resourceName + ".xml");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
font->deserialization(root, MyGUI::Version(3,2,0));
|
|
|
|
|
|
|
|
|
|
MyGUI::ResourceManualFont* bookFont = static_cast<MyGUI::ResourceManualFont*>(
|
|
|
|
|