gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/lua-text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'agg-plot/lua-text.cpp')
-rw-r--r--agg-plot/lua-text.cpp 12
1 files changed, 8 insertions, 4 deletions
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;
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月15日 19:23:03 +0000

AltStyle によって変換されたページ (->オリジナル) /