Progress on text support

This commit is contained in:
Joshua Granick
2015-03-07 20:57:00 -08:00
parent f88a35f890
commit 7b5130f6d9
16 changed files with 1318 additions and 439 deletions

View File

@@ -0,0 +1,59 @@
#ifndef LIME_TEXT_FONT_H
#define LIME_TEXT_FONT_H
#include <graphics/ImageBuffer.h>
#include <utils/Resource.h>
#include <hx/CFFI.h>
#include <list>
namespace lime {
class Image;
typedef struct {
unsigned long codepoint;
size_t size;
int index;
int height;
} GlyphInfo;
class Font {
public:
Font (void* face = 0);
Font (Resource *resource, int faceIndex = 0);
~Font ();
value Decompose (int em);
wchar_t *GetFamilyName ();
bool InsertCodepointFromIndex (unsigned long codepoint);
void LoadGlyphs (const char *glyphs);
void LoadRange (unsigned long start, unsigned long end);
value RenderToImage (ImageBuffer *image);
void SetSize (size_t size);
void* face;
private:
bool InsertCodepoint (unsigned long codepoint, bool b = true);
std::list<GlyphInfo> glyphList;
size_t mSize;
};
}
#endif

View File

@@ -0,0 +1,35 @@
#ifndef LIME_TEXT_TEXT_LAYOUT_H
#define LIME_TEXT_TEXT_LAYOUT_H
#include <text/Font.h>
#include <hx/CFFI.h>
namespace lime {
class TextLayout {
public:
TextLayout (int direction, const char *script, const char *language);
~TextLayout ();
value Layout (Font *font, size_t size, const char *text);
private:
void *mBuffer;
int mDirection;
int mScript;
int mLanguage;
};
}
#endif