author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年02月15日 23:18:38 +0100 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年02月15日 23:18:38 +0100 |
commit | 658ed523ec7f26aca179b294f0c5971d0c050c6e (patch) | |
tree | 28ecdbea8a836dea2d2fbf8dbc5f6c61f8c02f2a /agg-plot/lua-text.cpp | |
parent | 61e314fad8860b8dce9671355797032d6ff1cc8e (diff) | |
download | gsl-shell-658ed523ec7f26aca179b294f0c5971d0c050c6e.tar.gz |
-rw-r--r-- | agg-plot/lua-text.cpp | 12 |
diff --git a/agg-plot/lua-text.cpp b/agg-plot/lua-text.cpp index 04129c78..cb5dd7c4 100644 --- a/agg-plot/lua-text.cpp +++ b/agg-plot/lua-text.cpp @@ -25,6 +25,8 @@ static int agg_text_angle_get (lua_State *L); static draw::text* check_agg_text (lua_State *L, int index); +static const double text_line_width = 1.7; + static const struct luaL_Reg text_functions[] = { {"text", agg_text_new}, {NULL, NULL} @@ -63,10 +65,12 @@ check_agg_text (lua_State *L, int index) int agg_text_new (lua_State *L) { - const char *text = luaL_checkstring (L, 1); - double size = luaL_optnumber (L, 2, 10.0); - double width = luaL_optnumber (L, 3, 1.0) + 0.7; - new(L, GS_DRAW_TEXT) draw::text(text, size, width); + double x = luaL_checknumber (L, 1); + double y = luaL_checknumber (L, 2); + const char *text = luaL_checkstring (L, 3); + double size = luaL_optnumber (L, 4, 10.0); + draw::text* t = new(L, GS_DRAW_TEXT) draw::text(text, size, text_line_width); + t->set_point(x, y); return 1; } |