1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-26 18:09:43 +00:00
openmw/components/fontloader/fontloader.hpp
psi29a 77beaf5bc6 Merge branch 'font_loading' into 'master'
Cleanup fonts loading

See merge request OpenMW/openmw!2309

(cherry picked from commit f36e13444e)

9e1ab590 Cleanup fonts loading
2022-08-21 20:11:15 +00:00

55 lines
1.4 KiB
C++

#ifndef OPENMW_COMPONENTS_FONTLOADER_H
#define OPENMW_COMPONENTS_FONTLOADER_H
#include <MyGUI_XmlDocument.h>
#include <MyGUI_Version.h>
#include <components/myguiplatform/myguidatamanager.hpp>
#include <components/to_utf8/to_utf8.hpp>
namespace VFS
{
class Manager;
}
namespace MyGUI
{
class ITexture;
class ResourceManualFont;
}
namespace Gui
{
/// @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.
class FontLoader
{
public:
FontLoader (ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor);
void loadFonts();
void overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
int getFontHeight();
static std::string getFontForFace(const std::string& face);
private:
ToUTF8::FromType mEncoding;
const VFS::Manager* mVFS;
int mFontHeight;
float mScalingFactor;
void loadFont(const std::string& fontName, const std::string& fontId);
void loadBitmapFont (const std::string& fileName, const std::string& fontId);
void loadTrueTypeFont(const std::string& fileName, const std::string& fontId);
FontLoader(const FontLoader&);
void operator=(const FontLoader&);
};
}
#endif