3
#include <pango/pango.h>
6
#include <string.h> // strcmp
7
#include <errno.h> // errno
9
// the output array size isn't easily determined.
10
static int l_pango_tab_array_get_tabs(lua_State *L)
12
OBJECT_ARG(tab_array, PangoTabArray, *, 1);
15
PangoTabAlign *alignments = NULL;
16
gint *locations = NULL;
19
luaL_argcheck(L, t2 == LUA_TNIL || t2 == LUA_TTABLE, 2, "nil or table");
22
luaL_argcheck(L, t3 == LUA_TNIL || t3 == LUA_TTABLE, 3, "nil or table");
24
n = pango_tab_array_get_size(tab_array);
26
pango_tab_array_get_tabs(tab_array, t2 == LUA_TNIL ? NULL : &alignments,
27
t3 == LUA_TNIL ? NULL : &locations);
29
// copy the values to the table
31
api->empty_table(L, 2);
32
typespec_t ts = api->find_struct(L, "PangoTabAlign", 0);
34
api->push_constant(L, ts, alignments[i]);
35
lua_rawseti(L, 2, i + 1);
41
api->empty_table(L, 3);
43
lua_pushnumber(L, locations[i]);
44
lua_rawseti(L, 3, i + 1);
52
FSO(pango_attr_iterator_get_attrs, GSLIST_FREE_PANGO_ATTR);
53
FSO(pango_glyph_item_apply_attrs, GSLIST_FREE_PANGO_GLYPH);
57
static int l_pango_attr_iterator_get_font(lua_State *L)
59
int rc = api->call_byname(L, "pango_attr_iterator_get_font");
60
// XXX this is an optional return value... where is it on the stack?
61
struct object *w = (struct object*) lua_touserdata(L, WHATEVER);
62
w->flags = GSLIST_FREE_PANGO_ATTR;
67
// strangely enough, these functions are actually defined in GDK
68
static int l_pango_layout_get_clip_region(lua_State *L)
70
return api->call_function(L, "gdk", "gdk_pango_layout_get_clip_region");
73
// strangely enough, these functions are actually defined in GDK
74
static int l_pango_layout_line_get_clip_region(lua_State *L)
76
return api->call_function(L, "gdk",
77
"gdk_pango_layout_line_get_clip_region");
80
const luaL_reg pango_overrides[] = {
81
OVERRIDE(pango_tab_array_get_tabs),
82
OVERRIDE(pango_attr_iterator_get_attrs),
83
OVERRIDE(pango_glyph_item_apply_attrs),
84
OVERRIDE(pango_layout_get_clip_region),
85
OVERRIDE(pango_layout_line_get_clip_region),