Progress on text support
This commit is contained in:
59
project/include/text/Font.h
Normal file
59
project/include/text/Font.h
Normal 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
|
||||
35
project/include/text/TextLayout.h
Normal file
35
project/include/text/TextLayout.h
Normal 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
|
||||
Reference in New Issue
Block a user