summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-01-24 17:34:57 +0000
committerpixel <pixel>2008-01-24 17:34:57 +0000
commitc23ff8369633962cb90b24c65389cea578f5a8e7 (patch)
tree0d4f176e19d092283436f1c6636c07f389feb6b0
parent59020e3e3dfd98c3619100934d83272287597a37 (diff)
Adding unicode versions of ftgl calls.
-rw-r--r--lib/LuaFTGL.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/LuaFTGL.cc b/lib/LuaFTGL.cc
index b64040f..1833e5a 100644
--- a/lib/LuaFTGL.cc
+++ b/lib/LuaFTGL.cc
@@ -19,8 +19,11 @@ enum EncapFTFont_methods_t {
FTFONT_DESCENDER,
FTFONT_LINEHEIGHT,
FTFONT_BBOX,
+ FTFONT_UBBOX,
FTFONT_ADVANCE,
+ FTFONT_UADVANCE,
FTFONT_RENDER,
+ FTFONT_URENDER,
FTFONT_ERROR,
};
@@ -44,8 +47,11 @@ struct lua_functypes_t EncapFTFont_methods[] = {
{ FTFONT_DESCENDER, "Descender", 0, 0, { } },
{ FTFONT_LINEHEIGHT, "LineHeight", 0, 0, { } },
{ FTFONT_BBOX, "BBox", 1, 1, { BLUA_STRING } },
+ { FTFONT_UBBOX, "UBBox", 1, 1, { BLUA_STRING } },
{ FTFONT_ADVANCE, "Advance", 1, 1, { BLUA_STRING } },
+ { FTFONT_UADVANCE, "UAdvance", 1, 1, { BLUA_STRING } },
{ FTFONT_RENDER, "Render", 1, 1, { BLUA_STRING } },
+ { FTFONT_URENDER, "URender", 1, 1, { BLUA_STRING } },
{ FTFONT_ERROR, "Error", 0, 0, { } },
{ -1, 0, 0, 0, 0 }
};
@@ -143,6 +149,7 @@ int sLua_EncapFTFont::EncapFTFont_proceed(Lua * L, int n, EncapFTFont * obj, int
FTFont * f = obj->Get();
FT_Encoding * l;
float llx, lly, llz, urx, ury, urz;
+ String x;
switch (caller) {
case FTFONT_CHARMAP:
@@ -205,13 +212,36 @@ int sLua_EncapFTFont::EncapFTFont_proceed(Lua * L, int n, EncapFTFont * obj, int
L->push(ury);
L->push(urz);
break;
+ case FTFONT_UBBOX:
+ r = 6;
+ x = L->tostring(2);
+ x.iconv("utf-8", "unicode");
+ f->BBox((wchar_t *) x.to_charp(), llx, lly, llz, urx, ury, urz);
+ L->push(llx);
+ L->push(lly);
+ L->push(llz);
+ L->push(urx);
+ L->push(ury);
+ L->push(urz);
+ break;
case FTFONT_ADVANCE:
r = 1;
L->push(f->Advance(L->tostring(2).to_charp()));
break;
+ case FTFONT_UADVANCE:
+ r = 1;
+ x = L->tostring(2);
+ x.iconv("utf-8", "unicode");
+ L->push(f->Advance((wchar_t *) x.to_charp()));
+ break;
case FTFONT_RENDER:
f->Render(L->tostring(2).to_charp());
break;
+ case FTFONT_URENDER:
+ x = L->tostring(2);
+ x.iconv("utf-8", "unicode");
+ f->Render((wchar_t *) x.to_charp());
+ break;
case FTFONT_ERROR:
r = 1;
L->push((lua_Number) f->Error());