texlive[64127] Build/source/texk/web2c/luatexdir: luatex: sync with

commits+kakuto at tug.org commits+kakuto at tug.org
Tue Aug 16 22:41:59 CEST 2022


Revision: 64127
          http://tug.org/svn/texlive?view=revision&revision=64127
Author:   kakuto
Date:     2022-08-16 22:41:58 +0200 (Tue, 16 Aug 2022)
Log Message:
-----------
luatex: sync with the upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/luatexdir/ChangeLog
    trunk/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
    trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
    trunk/Build/source/texk/web2c/luatexdir/tex/textoken.c
    trunk/Build/source/texk/web2c/luatexdir/utils/unistring.c

Modified: trunk/Build/source/texk/web2c/luatexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2022-08-16 20:41:58 UTC (rev 64127)
@@ -1,3 +1,7 @@
+2022-08-16  Luigi Scarso <luigi.scarso at gmail.com> 
+     * Accent 0xFFFD but still error on invalid utf (compatible) (H.Hagen)
+     * omitinfodict added: \pdfvariable omitinfodict 1 omit Info dicttionary (H.Hagen)
+
 2022-08-05  Luigi Scarso <luigi.scarso at gmail.com> 
      * Fixed a missed lua_settop in lua_appendtovlist_callback() (thanks to Hironori KITAGAWA)
 

Modified: trunk/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/lua/lpdflib.c	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/lua/lpdflib.c	2022-08-16 20:41:58 UTC (rev 64127)
@@ -814,6 +814,12 @@
     return 1 ;
 }
 
+static int getpdfomitinfodict(lua_State * L)
+{
+    lua_pushinteger(L, (pdf_omit_infodict));
+    return 1 ;
+}
+
 static int setpdfgentounicode(lua_State * L)
 {
     if (lua_type(L, 1) == LUA_TNUMBER) {
@@ -838,6 +844,14 @@
     return 0 ;
 }
 
+static int setpdfomitinfodict(lua_State * L)
+{
+    if (lua_type(L, 1) == LUA_TNUMBER) {
+        set_pdf_omit_infodict(lua_tointeger(L, 1));
+    }
+    return 0 ;
+}
+
 /* for tracing purposes when no pages are flushed */
 
 static int setforcefile(lua_State * L)
@@ -1350,11 +1364,13 @@
     { "getgentounicode", getpdfgentounicode },
     { "getomitcidset", getpdfomitcidset },
     { "getomitcharset", getpdfomitcharset },
+    { "getomitinfo", getpdfomitinfodict },
     { "setinclusionerrorlevel", setpdfinclusionerrorlevel },
     { "setignoreunknownimages", setpdfignoreunknownimages },
     { "setgentounicode", setpdfgentounicode },
     { "setomitcidset", setpdfomitcidset },
     { "setomitcharset", setpdfomitcharset },
+    { "setomitinfo", setpdfomitinfodict },
     { "setforcefile", setforcefile },
     { "mapfile", l_mapfile },
     { "mapline", l_mapline },

Modified: trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2022-08-16 20:41:58 UTC (rev 64127)
@@ -1,4 +1,4 @@
 #ifndef luatex_svn_revision_h
 #define luatex_svn_revision_h
-#define luatex_svn_revision 7536
+#define luatex_svn_revision 7538
 #endif

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c	2022-08-16 20:41:58 UTC (rev 64127)
@@ -2227,7 +2227,8 @@
         print_err(" ==> Fatal error occurred, no output PDF file produced!");
     } else {
         int i, j, k;
-        int root, info;
+        int root = 0;
+        int info = 0;
         int xref_stm = 0;
         int outlines = 0;
         int threads = 0;
@@ -2268,6 +2269,7 @@
                 pdf->gen_tounicode = pdf_gen_tounicode;
                 pdf->omit_cidset = pdf_omit_cidset;
                 pdf->omit_charset = pdf_omit_charset;
+                pdf->omit_infodict = pdf_omit_infodict;
                 /*tex
                     The first pass over the list will flag the slots that are
                     used so that we can do a preroll for type 3 fonts.
@@ -2384,7 +2386,8 @@
                 print_pdf_table_string(pdf, "catalog");
                 pdf_end_dict(pdf);
                 pdf_end_obj(pdf);
-                info = pdf_print_info(pdf, luatexversion, luatexrevision);
+                if (! pdf->omit_infodict) 
+                    info = pdf_print_info(pdf, luatexversion, luatexrevision);
                 if (pdf->os_enable) {
                     pdf_buffer_select(pdf, OBJSTM_BUF);
                     pdf_os_write_objstream(pdf);
@@ -2418,7 +2421,8 @@
                     pdf_add_int(pdf, 1);
                     pdf_end_array(pdf);
                     pdf_dict_add_ref(pdf, "Root", root);
-                    pdf_dict_add_ref(pdf, "Info", info);
+                    if (! pdf->omit_infodict) 
+                        pdf_dict_add_ref(pdf, "Info", info);
                     if (pdf_trailer_toks != null) {
                         pdf_print_toks(pdf, pdf_trailer_toks);
                         delete_token_ref(pdf_trailer_toks);
@@ -2476,7 +2480,8 @@
                     pdf_begin_dict(pdf);
                     pdf_dict_add_int(pdf, "Size", pdf->obj_ptr + 1);
                     pdf_dict_add_ref(pdf, "Root", root);
-                    pdf_dict_add_ref(pdf, "Info", info);
+                    if (! pdf->omit_infodict) 
+                        pdf_dict_add_ref(pdf, "Info", info);
                     if (pdf_trailer_toks != null) {
                         pdf_print_toks(pdf, pdf_trailer_toks);
                         delete_token_ref(pdf_trailer_toks);

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.h	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.h	2022-08-16 20:41:58 UTC (rev 64127)
@@ -141,6 +141,7 @@
     c_pdf_omit_cidset,
     c_pdf_recompress,
     c_pdf_omit_charset,
+    c_pdf_omit_infodict,
 } pdf_backend_counters ;
 
 typedef enum {
@@ -190,6 +191,7 @@
 #  define pdf_suppress_optional_info    get_tex_extension_count_register(c_pdf_suppress_optional_info)
 #  define pdf_omit_cidset               get_tex_extension_count_register(c_pdf_omit_cidset)
 #  define pdf_omit_charset              get_tex_extension_count_register(c_pdf_omit_charset)
+#  define pdf_omit_infodict             get_tex_extension_count_register(c_pdf_omit_infodict)
 #  define pdf_recompress                get_tex_extension_count_register(c_pdf_recompress)
 
 #  define pdf_h_origin                  get_tex_extension_dimen_register(d_pdf_h_origin)
@@ -213,6 +215,7 @@
 #  define set_pdf_obj_compress_level(i) set_tex_extension_count_register(c_pdf_obj_compress_level,i)
 #  define set_pdf_omit_cidset(i)        set_tex_extension_count_register(c_pdf_omit_cidset,i)
 #  define set_pdf_omit_charset(i)       set_tex_extension_count_register(c_pdf_omit_charset,i)
+#  define set_pdf_omit_infodict(i)      set_tex_extension_count_register(c_pdf_omit_infodict,i)
 #  define set_pdf_gen_tounicode(i)      set_tex_extension_count_register(c_pdf_gen_tounicode,i)
 #  define set_pdf_recompress(i)         set_tex_extension_count_register(c_pdf_recompress,i)
 

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h	2022-08-16 20:41:58 UTC (rev 64127)
@@ -295,6 +295,7 @@
     int gen_tounicode;
     int omit_cidset;
     int omit_charset;
+    int omit_infodict;
     int inclusion_copy_font;
     int major_version;          /* fixed major part of the PDF version */
     int minor_version;          /* fixed minor part of the PDF version */

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/textoken.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/textoken.c	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/textoken.c	2022-08-16 20:41:58 UTC (rev 64127)
@@ -2620,6 +2620,7 @@
     else if (scan_keyword("suppressoptionalinfo")) { do_variable_backend_int(c_pdf_suppress_optional_info); }
     else if (scan_keyword("omitcidset"))           { do_variable_backend_int(c_pdf_omit_cidset); }
     else if (scan_keyword("omitcharset"))          { do_variable_backend_int(c_pdf_omit_charset); }
+    else if (scan_keyword("omitinfodict"))         { do_variable_backend_int(c_pdf_omit_infodict); }
     else if (scan_keyword("recompress"))           { do_variable_backend_int(c_pdf_recompress); }
 
     else if (scan_keyword("horigin"))              { do_variable_backend_dimen(d_pdf_h_origin); }

Modified: trunk/Build/source/texk/web2c/luatexdir/utils/unistring.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/utils/unistring.c	2022-08-15 23:51:12 UTC (rev 64126)
+++ trunk/Build/source/texk/web2c/luatexdir/utils/unistring.c	2022-08-16 20:41:58 UTC (rev 64127)
@@ -32,6 +32,7 @@
     deletions_allowed = true;
 }
 
+/*
 unsigned str2uni(const unsigned char *k)
 {
     register int ch;
@@ -40,7 +41,7 @@
     if ((ch = *text++) < 0x80) {
         val = (unsigned) ch;
     } else if (ch <= 0xbf) {
-        /*tex An error that we skip. */
+        // 
     } else if (ch <= 0xdf) {
         if (*text >= 0x80 && *text < 0xc0)
             val = (unsigned) (((ch & 0x1f) << 6) | (*text++ & 0x3f));
@@ -58,19 +59,52 @@
         if (*text < 0x80 || text[1] < 0x80 || text[2] < 0x80 ||
             *text >= 0xc0 || text[1] >= 0xc0 || text[2] >= 0xc0)
             val = 0xFFFD;
-    } else {
-        /*tex
-
-            The 5- and 6-byte UTF-8 sequences generate integers that are outside
-            of the valid UCS range, and therefore unsupported.
-
-         */
     }
     if (val == 0xFFFD)
         utf_error();
     return (val);
 }
+*/
 
+/* 
+    Per August 13 2022 we do the following. We still error on an invalid utf because we 
+    have to remain compatible but accept 0xFFFD as valid now. 
+*/
+
+unsigned str2uni(const unsigned char *k)
+{
+    int val = -1;
+    const unsigned char *text = k;
+    register int ch = *text++;
+    if (ch < 0x80) {
+        val = (unsigned) ch;
+    } else if (ch <= 0xbf) {
+        /*tex An error. */
+    } else if (ch <= 0xdf) {
+        if (*text >= 0x80 && *text < 0xc0) {
+            val = (unsigned) (((ch & 0x1f) << 6) | (*text++ & 0x3f));
+        }
+    } else if (ch <= 0xef) {
+        if (*text >= 0x80 && *text < 0xc0 && text[1] >= 0x80 && text[1] < 0xc0) {
+            val = (unsigned) (((ch & 0xf) << 12) | ((text[0] & 0x3f) << 6) | (text[1] & 0x3f));
+        }
+    } else if (ch <= 0xf7) {
+        int w = (((ch & 0x7) << 2) | ((text[0] & 0x30) >> 4)) - 1, w2;
+        w = (w << 6) | ((text[0] & 0xf) << 2) | ((text[1] & 0x30) >> 4);
+        w2 = ((text[1] & 0xf) << 6) | (text[2] & 0x3f);
+        val = (unsigned) (w * 0x400 + w2 + 0x10000);
+        if (*text < 0x80 || text[1] < 0x80 || text[2] < 0x80 || *text >= 0xc0 || text[1] >= 0xc0 || text[2] >= 0xc0) {
+            val = -1;
+        }
+    }
+    if (val < 0) {
+        utf_error();
+        return 0xFFFD;
+    } else {
+        return val;
+    }
+}
+
 /*tex
 
     A real basic helper.



More information about the tex-live-commits mailing list.