| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #pragma once
- #include "CmPrerequisites.h"
- #include "CmResource.h"
- #include "CmFontDesc.h"
- namespace CamelotFramework
- {
- struct CM_EXPORT FontData : public IReflectable
- {
- UINT32 size;
- FONT_DESC fontDesc;
- Vector<HTexture>::type texturePages;
- const CHAR_DESC& getCharDesc(UINT32 charId) const;
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class FontDataRTTI;
- static RTTITypeBase* getRTTIStatic();
- virtual RTTITypeBase* getRTTI() const;
- };
- // TODO - When saved on disk font currently stores a copy of the texture pages. This should be acceptable
- // if you import a new TrueType or OpenType font since the texture will be generated on the spot
- // but if you use a bitmap texture to initialize the font manually, then you will potentially have duplicate textures.
- // Also, changing the source texture will not automatically update the font because there is no direct link between them.
- // -- This is probably not a large problem, but it is something to keep an eye out.
- class CM_EXPORT Font : public Resource
- {
- public:
- virtual ~Font();
- void initialize(Vector<FontData>::type& fontData);
- const FontData* getFontDataForSize(UINT32 size) const;
- INT32 getClosestAvailableSize(UINT32 size) const;
- protected:
- friend class FontManager;
- Font();
- private:
- Map<UINT32, FontData>::type mFontDataPerSize;
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class FontRTTI;
- static RTTITypeBase* getRTTIStatic();
- virtual RTTITypeBase* getRTTI() const;
- /************************************************************************/
- /* STATICS */
- /************************************************************************/
-
- public:
- static HFont create(Vector<FontData>::type& fontInitData);
- };
- }
|