From b8fe0f8628cfd9a82e523c10a4d5b0a481b758d2 Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Sat, 3 Feb 2024 22:26:14 +0000 Subject: Ensures that setgentounicode has a glyph_unicode_tree not NULL. git-svn-id: svn://tug.org/texlive/trunk@69693 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/ChangeLog | 3 +++ Build/source/texk/web2c/luatexdir/font/tounicode.c | 7 +++++++ Build/source/texk/web2c/luatexdir/lua/lpdflib.c | 2 ++ Build/source/texk/web2c/luatexdir/lua/luatex-api.h | 1 + Build/source/texk/web2c/luatexdir/luatex_svnversion.h | 2 +- 5 files changed, 14 insertions(+), 1 deletion(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 0a9915fd01b..cbf824eb1a2 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,6 @@ +2024-03-24 Luigi Scarso + * Ensures that setgentounicode has a glyph_unicode_tree not NULL + 2024-01-24 Luigi Scarso * New kpse.in_name_ok_silent_extended and kpse.in_name_ok_silent_extended * In kpse mode diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.c b/Build/source/texk/web2c/luatexdir/font/tounicode.c index 68b6e01fd7e..19e64471158 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.c +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.c @@ -69,6 +69,13 @@ void glyph_unicode_free(void) avl_destroy(glyph_unicode_tree, destroy_glyph_unicode_entry); } +void glyph_unicode_new(void) +{ + if (glyph_unicode_tree == NULL) { + glyph_unicode_tree = avl_create(comp_glyph_unicode_entry, NULL, &avl_xallocator); + } +} + void def_tounicode(str_number glyph, str_number unistr) { char buf[SMALL_BUF_SIZE], *p, *ph; diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 263fd56444c..7cd4b8d4943 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -828,6 +828,8 @@ static int getpdfomitmediabox(lua_State * L) static int setpdfgentounicode(lua_State * L) { + /* ensures that glyph_unicode_tree is not null */ + glyph_unicode_new(); if (lua_type(L, 1) == LUA_TNUMBER) { set_pdf_gen_tounicode(lua_tointeger(L, 1)); } diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index 8e696bc666d..a4abf84ff62 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -159,6 +159,7 @@ extern int font_parameters_to_lua(lua_State * L, int f); extern int font_to_lua(lua_State * L, int f, int usecache); extern int font_from_lua(lua_State * L, int f); /* return is boolean */ extern int characters_from_lua(lua_State * L, int f); /* return is boolean */ +extern void glyph_unicode_new(void); /* ensures that glyph_unicode_tree is not null */ extern int luaopen_token(lua_State * L); extern void tokenlist_to_lua(lua_State * L, int p); diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h index 9ef1dab7242..bbdd30a131c 100644 --- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1,4 +1,4 @@ #ifndef luatex_svn_revision_h #define luatex_svn_revision_h -#define luatex_svn_revision 7601 +#define luatex_svn_revision 7602 #endif -- cgit v1.2.3