2015-04-30 23:41:33 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_FONTLOADER_H
|
|
|
|
#define OPENMW_COMPONENTS_FONTLOADER_H
|
2013-06-06 20:13:30 +00:00
|
|
|
|
2020-05-28 19:09:10 +00:00
|
|
|
#include <MyGUI_XmlDocument.h>
|
|
|
|
#include <MyGUI_Version.h>
|
|
|
|
|
2018-09-04 05:15:07 +00:00
|
|
|
#include <components/myguiplatform/myguidatamanager.hpp>
|
2013-06-06 20:13:30 +00:00
|
|
|
#include <components/to_utf8/to_utf8.hpp>
|
|
|
|
|
2015-04-30 23:41:33 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MyGUI
|
|
|
|
{
|
|
|
|
class ITexture;
|
|
|
|
class ResourceManualFont;
|
|
|
|
}
|
|
|
|
|
2014-09-12 02:27:23 +00:00
|
|
|
namespace Gui
|
2013-06-06 20:13:30 +00:00
|
|
|
{
|
2015-04-30 23:41:33 +00:00
|
|
|
/// @brief loads Morrowind's .fnt/.tex fonts for use with MyGUI and OSG
|
|
|
|
/// @note The FontLoader needs to remain in scope as long as you want to use the loaded fonts.
|
2013-06-06 20:13:30 +00:00
|
|
|
class FontLoader
|
|
|
|
{
|
|
|
|
public:
|
2021-04-15 11:14:41 +00:00
|
|
|
FontLoader (ToUTF8::FromType encoding, const VFS::Manager* vfs, const std::string& userDataPath, float scalingFactor);
|
2015-04-30 23:41:33 +00:00
|
|
|
~FontLoader();
|
2014-08-11 18:37:29 +00:00
|
|
|
|
|
|
|
/// @param exportToFile export the converted fonts (Images and XML with glyph metrics) to files?
|
2018-09-04 05:15:07 +00:00
|
|
|
void loadBitmapFonts (bool exportToFile);
|
|
|
|
void loadTrueTypeFonts ();
|
2013-06-06 20:13:30 +00:00
|
|
|
|
2020-05-28 19:09:10 +00:00
|
|
|
void loadFontFromXml(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
|
|
|
|
|
|
|
|
int getFontHeight();
|
|
|
|
|
2022-07-07 19:20:22 +00:00
|
|
|
static std::string getFontForFace(const std::string& face);
|
|
|
|
|
2013-06-06 20:13:30 +00:00
|
|
|
private:
|
|
|
|
ToUTF8::FromType mEncoding;
|
2015-04-30 23:41:33 +00:00
|
|
|
const VFS::Manager* mVFS;
|
2018-09-04 05:15:07 +00:00
|
|
|
std::string mUserDataPath;
|
2020-05-28 19:09:10 +00:00
|
|
|
int mFontHeight;
|
2021-04-15 11:14:41 +00:00
|
|
|
float mScalingFactor;
|
2015-04-30 23:41:33 +00:00
|
|
|
|
|
|
|
std::vector<MyGUI::ITexture*> mTextures;
|
|
|
|
std::vector<MyGUI::ResourceManualFont*> mFonts;
|
2013-06-06 20:13:30 +00:00
|
|
|
|
2022-07-07 19:20:22 +00:00
|
|
|
std::string getInternalFontName(const std::string& name);
|
|
|
|
|
2014-08-11 18:37:29 +00:00
|
|
|
/// @param exportToFile export the converted font (Image and XML with glyph metrics) to files?
|
2020-05-28 19:09:10 +00:00
|
|
|
void loadBitmapFont (const std::string& fileName, bool exportToFile);
|
2015-04-30 23:41:33 +00:00
|
|
|
|
|
|
|
FontLoader(const FontLoader&);
|
|
|
|
void operator=(const FontLoader&);
|
2013-06-06 20:13:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|