Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph.

This commit is contained in:
Alex Szpakowski
2013-06-16 07:36:18 -03:00
parent dd9cca1a55
commit d48d1fd441
21 changed files with 449 additions and 24 deletions
+24 -6
View File
@@ -24,6 +24,11 @@
// LOVE
#include "common/config.h"
#include "common/Data.h"
#include "common/Exception.h"
#include "common/StringMap.h"
// stdlib
#include <string>
namespace love
{
@@ -48,12 +53,13 @@ struct GlyphMetrics
**/
class GlyphData : public Data
{
public:
enum Format
{
FORMAT_LUMINANCE_ALPHA,
FORMAT_RGBA
FORMAT_RGBA,
FORMAT_MAX_ENUM
};
GlyphData(unsigned int glyph, GlyphMetrics glyphMetrics, Format f);
@@ -78,6 +84,11 @@ public:
**/
unsigned int getGlyph() const;
/**
* Gets the glyph as a UTF-8 string (instead of a UTF-8 code point.)
**/
std::string getGlyphString() const;
/**
* Gets the advance (the space the glyph takes up) of the glyph.
**/
@@ -118,19 +129,26 @@ public:
**/
Format getFormat() const;
static bool getConstant(const char *in, Format &out);
static bool getConstant(Format in, const char *&out);
private:
// The glyph itself
// The glyph codepoint itself.
unsigned int glyph;
// Glyph metrics
// Glyph metrics.
GlyphMetrics metrics;
// Glyph texture data
// Glyph texture data.
unsigned char *data;
// The format the data's in
// The format the data's in.
Format format;
static StringMap<Format, FORMAT_MAX_ENUM>::Entry formatEntries[];
static StringMap<Format, FORMAT_MAX_ENUM> formats;
}; // GlyphData
} // font