Drop fonts export - users are supposed to use TrueType fonts or mods with legacy format

LTO-timing^2
Andrei Kortunov 2 years ago
parent b60d14d434
commit 845a812ebf

@ -453,7 +453,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mScriptConsoleMode (false)
, mActivationDistanceOverride(-1)
, mGrab(true)
, mExportFonts(false)
, mRandomSeed(0)
, mFSStrict (false)
, mScriptBlacklistUse (true)
@ -823,7 +822,7 @@ void OMW::Engine::prepareEngine()
mWindowManager = std::make_unique<MWGui::WindowManager>(mWindow, mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(),
mCfgMgr.getLogPath().string() + std::string("/"),
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts,
mScriptConsoleMode, mTranslationDataStorage, mEncoding,
Version::getOpenmwVersionDescription(mResDir.string()), shadersSupported);
mEnvironment.setWindowManager(*mWindowManager);
@ -1186,11 +1185,6 @@ void OMW::Engine::setScriptBlacklistUse (bool use)
mScriptBlacklistUse = use;
}
void OMW::Engine::enableFontExport(bool exportFonts)
{
mExportFonts = exportFonts;
}
void OMW::Engine::setSaveGameFile(const std::string &savegame)
{
mSaveGameFile = savegame;

@ -160,7 +160,6 @@ namespace OMW
// Grab mouse?
bool mGrab;
bool mExportFonts;
unsigned int mRandomSeed;
Compiler::Extensions mExtensions;
@ -254,8 +253,6 @@ namespace OMW
void setScriptBlacklistUse (bool use);
void enableFontExport(bool exportFonts);
/// Set the save game file to load after initialising the engine.
void setSaveGameFile(const std::string& savegame);

@ -156,7 +156,6 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
Fallback::Map::init(variables["fallback"].as<FallbackMap>().mMap);
engine.setSoundUsage(!variables["no-sound"].as<bool>());
engine.setActivationDistanceOverride (variables["activate-dist"].as<int>());
engine.enableFontExport(variables["export-fonts"].as<bool>());
engine.setRandomSeed(variables["random-seed"].as<unsigned int>());
return true;

@ -129,7 +129,7 @@ namespace MWGui
WindowManager::WindowManager(
SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, bool useShaders)
ToUTF8::FromType encoding, const std::string& versionDescription, bool useShaders)
: mOldUpdateMask(0)
, mOldCullMask(0)
, mStore(nullptr)
@ -206,7 +206,7 @@ namespace MWGui
// Load fonts
mFontLoader = std::make_unique<Gui::FontLoader>(encoding, resourceSystem->getVFS(), mScalingFactor);
mFontLoader->loadBitmapFonts(exportFonts);
mFontLoader->loadBitmapFonts();
//Register own widgets with MyGUI
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWSkill>("Widget");

@ -136,7 +136,7 @@ namespace MWGui
WindowManager(SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, bool useShaders);
ToUTF8::FromType encoding, const std::string& versionDescription, bool useShaders);
virtual ~WindowManager();
/// Set the ESMStore to use for retrieving of GUI-related strings.

@ -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*>(

@ -28,8 +28,7 @@ namespace Gui
FontLoader (ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor);
~FontLoader();
/// @param exportToFile export the converted fonts (Images and XML with glyph metrics) to files?
void loadBitmapFonts (bool exportToFile);
void loadBitmapFonts ();
void loadTrueTypeFonts ();
void loadFontFromXml(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
@ -49,8 +48,7 @@ namespace Gui
std::string getInternalFontName(const std::string& name);
/// @param exportToFile export the converted font (Image and XML with glyph metrics) to files?
void loadBitmapFont (const std::string& fileName, bool exportToFile);
void loadBitmapFont (const std::string& fileName);
FontLoader(const FontLoader&);
void operator=(const FontLoader&);

Loading…
Cancel
Save