Rename FONT_TYPE enum to FontType and expose it to Font public API. Closes #1786.
This commit is contained in:
parent
be4dc04f9a
commit
32310a2c12
@ -67,6 +67,11 @@ static bool FontSaveXMLFile(File* file, int pointSize, bool usedGlyphs, const St
|
||||
|
||||
static void RegisterFont(asIScriptEngine* engine)
|
||||
{
|
||||
engine->RegisterEnum("FontType");
|
||||
engine->RegisterEnumValue("FontType", "FONT_NONE", FONT_NONE);
|
||||
engine->RegisterEnumValue("FontType", "FONT_FREETYPE", FONT_FREETYPE);
|
||||
engine->RegisterEnumValue("FontType", "FONT_BITMAP", FONT_BITMAP);
|
||||
|
||||
RegisterResource<Font>(engine, "Font");
|
||||
engine->RegisterObjectMethod("Font", "bool SaveXML(File@+, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLFile), asCALL_CDECL_OBJLAST);
|
||||
engine->RegisterObjectMethod("Font", "bool SaveXML(VectorBuffer&, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLVectorBuffer), asCALL_CDECL_OBJLAST);
|
||||
@ -76,6 +81,7 @@ static void RegisterFont(asIScriptEngine* engine)
|
||||
engine->RegisterObjectMethod("Font", "const IntVector2& get_absoluteGlyphOffset() const", asMETHOD(Font, GetAbsoluteGlyphOffset), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("Font", "void set_scaledGlyphOffset(const Vector2&)", asMETHOD(Font, SetScaledGlyphOffset), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("Font", "const Vector2& get_scaledGlyphOffset() const", asMETHOD(Font, GetScaledGlyphOffset), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("Font", "FontType get_fontType() const", asMETHOD(Font, GetFontType), asCALL_THISCALL);
|
||||
}
|
||||
|
||||
static void RegisterUIElement(asIScriptEngine* engine)
|
||||
|
@ -1,5 +1,13 @@
|
||||
$#include "UI/Font.h"
|
||||
|
||||
enum FontType
|
||||
{
|
||||
FONT_NONE = 0,
|
||||
FONT_FREETYPE,
|
||||
FONT_BITMAP,
|
||||
MAX_FONT_TYPES
|
||||
};
|
||||
|
||||
class Font : public Resource
|
||||
{
|
||||
void SetAbsoluteGlyphOffset(const IntVector2& offset);
|
||||
@ -8,8 +16,10 @@ class Font : public Resource
|
||||
const IntVector2& GetAbsoluteGlyphOffset() const;
|
||||
const Vector2& GetScaledGlyphOffset() const;
|
||||
IntVector2 GetTotalGlyphOffset(int pointSize) const;
|
||||
FontType GetFontType() const;
|
||||
bool IsSDFFont() const;
|
||||
|
||||
tolua_property__get_set IntVector2 absoluteGlyphOffset;
|
||||
tolua_property__get_set Vector2 scaledGlyphOffset;
|
||||
tolua_readonly tolua_property__get_set FontType fontType;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ static const int FONT_TEXTURE_MIN_SIZE = 128;
|
||||
static const int FONT_DPI = 96;
|
||||
|
||||
/// %Font file type.
|
||||
enum FONT_TYPE
|
||||
enum FontType
|
||||
{
|
||||
FONT_NONE = 0,
|
||||
FONT_FREETYPE,
|
||||
@ -67,6 +67,9 @@ public:
|
||||
/// Return font face. Pack and render to a texture if not rendered yet. Return null on error.
|
||||
FontFace* GetFace(int pointSize);
|
||||
|
||||
/// Return font type.
|
||||
FontType GetFontType() const { return fontType_; }
|
||||
|
||||
/// Is signed distance field font.
|
||||
bool IsSDFFont() const { return sdfFont_; }
|
||||
|
||||
@ -101,7 +104,7 @@ private:
|
||||
/// Point size scaled position adjustment for glyphs.
|
||||
Vector2 scaledOffset_;
|
||||
/// Font type.
|
||||
FONT_TYPE fontType_;
|
||||
FontType fontType_;
|
||||
/// Signed distance field font flag.
|
||||
bool sdfFont_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user