diff --git a/manual/luatex-nodes.tex b/manual/luatex-nodes.tex index 5e8cfa8f7ce6b3cfe46206dd7d2e4cc84543d2c6..16488dbbb85c2d7fff0e19edd137a6eb8a843bee 100644 --- a/manual/luatex-nodes.tex +++ b/manual/luatex-nodes.tex @@ -1938,6 +1938,7 @@ consistency. You can of course always define additional accessor using \type \NC \type {getdepth} \NC \nop \NC \yes \NC \NR \NC \type {getdir} \NC \nop \NC \yes \NC \NR \NC \type {getdisc} \NC \yes \NC \yes \NC \NR +\NC \type {getfam} \NC \nop \NC \yes \NC \NR \NC \type {getfield} \NC \yes \NC \yes \NC \NR \NC \type {getfont} \NC \yes \NC \yes \NC \NR \NC \type {getglue} \NC \yes \NC \yes \NC \NR diff --git a/manual/luatex.pdf b/manual/luatex.pdf index 5dc9ebba2e091d48a3acff0e2210c7490700da7a..1fa0475e8dc683725d9aea2d95234499d8cdec2c 100644 Binary files a/manual/luatex.pdf and b/manual/luatex.pdf differ diff --git a/source/texk/web2c/luatexdir/lua/lnodelib.c b/source/texk/web2c/luatexdir/lua/lnodelib.c index c63e867d3368b10c9b1902e94944bca4122fb597..26b6f5f4df61abe3374b09c9b5ef21db94ec4c90 100644 --- a/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -451,6 +451,8 @@ static int lua_nodelib_direct_getfont(lua_State * L) lua_pushinteger(L, font(n)); } else if ((t == math_char_node) || (t == math_text_char_node)) { lua_pushinteger(L, fam_fnt(math_fam(n), 0)); + } else if (t == delim_node) { + lua_pushinteger(L, fam_fnt(small_fam(n), 0)); } else { lua_pushnil(L); } @@ -486,6 +488,8 @@ static int lua_nodelib_direct_setfont(lua_State * L) lua_pushinteger(L, font(*n)); } else if ((t == math_char_node) || (t == math_text_char_node)) { lua_pushinteger(L, fam_fnt(math_fam(*n), 0)); + } else if (t == delim_node) { + lua_pushinteger(L, fam_fnt(small_fam(*n), 0)); } else { lua_pushnil(L); } @@ -505,6 +509,27 @@ static int lua_nodelib_direct_getchar(lua_State * L) lua_pushinteger(L, character(n)); } else if ((t == math_char_node) || (t == math_text_char_node)) { lua_pushinteger(L, math_character(n)); + } else if (t == delim_node) { + /* used in wide fonts */ + lua_pushinteger(L, small_char(n)); + } else { + lua_pushnil(L); + } + } else { + lua_pushnil(L); + } + return 1; +} + +static int lua_nodelib_direct_getfam(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if (n) { + halfword t = type(n); + if ((t == math_char_node) || (t == math_text_char_node)) { + lua_pushinteger(L, math_fam(n)); + } else if (t == delim_node) { + lua_pushinteger(L, small_fam(n)); } else { lua_pushnil(L); } @@ -523,23 +548,47 @@ static int lua_nodelib_direct_setchar(lua_State * L) character(n) = (halfword) lua_tointeger(L, 2); } else if ((t == math_char_node) || (t == math_text_char_node)) { math_character(n) = (halfword) lua_tointeger(L, 2); + } else if (t == delim_node) { + /* used in wide fonts */ + small_char(n) = (halfword) lua_tointeger(L, 2); } } return 0; } +static int lua_nodelib_direct_setfam(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if ((n) && (lua_type(L, 2) == LUA_TNUMBER)) { + halfword t = type(n); + if ((t == math_char_node) || (t == math_text_char_node)) { + math_fam(n) = (halfword) lua_tointeger(L, 2); + } else if (t == delim_node) { + small_fam(n) = (halfword) lua_tointeger(L, 2); + } + } + return 0; +} /* node.getchar */ static int lua_nodelib_getchar(lua_State * L) { halfword *n = lua_touserdata(L, 1); - if ( (n == NULL) || (! lua_getmetatable(L,1)) ) { + if ((n == NULL) || (! lua_getmetatable(L,1))) { lua_pushnil(L); - } else if (type(*n) == glyph_node) { - lua_pushinteger(L, character(*n)); - } else if ((type(*n) == math_char_node) || (type(*n) == math_text_char_node)) { - lua_pushinteger(L, math_character(*n)); + } else { + halfword t = type(*n); + if (t == glyph_node) { + lua_pushinteger(L, character(*n)); + } else if ((t == math_char_node) || (t == math_text_char_node)) { + lua_pushinteger(L, math_character(*n)); + } else if (t == delim_node) { + /* used in wide fonts */ + lua_pushinteger(L, small_char(*n)); + } else { + lua_pushnil(L); + } } return 1; } @@ -7961,6 +8010,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"getshift", lua_nodelib_direct_getshift}, {"getfield", lua_nodelib_direct_getfield}, {"getfont", lua_nodelib_direct_getfont}, + {"setfam", lua_nodelib_direct_getfam}, {"getid", lua_nodelib_direct_getid}, {"getnext", lua_nodelib_direct_getnext}, {"getprev", lua_nodelib_direct_getprev}, @@ -8002,6 +8052,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"setfield", lua_nodelib_direct_setfield}, {"setchar", lua_nodelib_direct_setchar}, {"setfont", lua_nodelib_direct_setfont}, + {"setfam", lua_nodelib_direct_setfam}, {"setcomponents", lua_nodelib_direct_setcomponents}, {"setlang", lua_nodelib_direct_setlang}, {"setkern", lua_nodelib_direct_setkern}, diff --git a/source/texk/web2c/luatexdir/luatex_svnversion.h b/source/texk/web2c/luatexdir/luatex_svnversion.h index b4b5b28caf0a2a6472405a1b899d63e18087785f..d8fd70c8fe5cefcc93ac4b0519be19ca1085c93d 100644 --- a/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1 +1 @@ -#define luatex_svn_revision 6420 +#define luatex_svn_revision 6421