texlive[57476] Build/source/texk/web2c/pdftexdir: allow (un)dumping

commits+karl at tug.org commits+karl at tug.org
Wed Jan 20 19:39:28 CET 2021


Revision: 57476
          http://tug.org/svn/texlive?view=revision&revision=57476
Author:   karl
Date:     2021-01-20 19:39:27 +0100 (Wed, 20 Jan 2021)
Log Message:
-----------
allow (un)dumping \pdfglyphtounicode in .fmt

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/NEWS
    trunk/Build/source/texk/web2c/pdftexdir/pdftex.web
    trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h
    trunk/Build/source/texk/web2c/pdftexdir/ptexmac.h
    trunk/Build/source/texk/web2c/pdftexdir/tounicode.c
    trunk/Build/source/texk/web2c/pdftexdir/writeimg.c

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,3 +1,18 @@
+2021-01-20  Karl Berry  <karl at freefriends.org>
+
+	* NEWS: update.
+
+2021-01-20  Marcel Fabian Krueger  <tex at 2krueger.de>
+
+	(Un)dump \pdfglyphtounicode assignments in the .fmt.
+	* pdftex.web (Dump/Undump pdftex data): call (un)dumptounicode.
+	* ptexlib.h ((un)dumptounicode): declare.
+	* tounicode.c ((un)dumptounicode): define.
+	* ptexmac.h ((un)dumpcharptr): #define here, from writeimg.c
+	(using generic_dump). Use xmalloc instead of malloc.
+	* writeimg.c: #defines moved.
+	ntg-pdftex mail, 17 Jan 2021 21:47:33.
+
 2021-01-04  Thanh Han The  <hanthethanh at gmail.com>
 
 	* ttf2afm.c (make_name): yet another attempt at filtering

Modified: trunk/Build/source/texk/web2c/pdftexdir/NEWS
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/NEWS	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/NEWS	2021-01-20 18:39:27 UTC (rev 57476)
@@ -3,6 +3,8 @@
     turning off generation of links in headers and footers.
   - warn instead of aborting when "\pdfendlink ended up in
     different nesting level than \pdfstartlink". 
+  - dump \pdfglyphtounicode assignments in fmt file.
+  - ttf2afm outputs name information.
 
 - bugfixes:
   - avoid crash in unusual autoexpand cases.

Modified: trunk/Build/source/texk/web2c/pdftexdir/pdftex.web
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/pdftex.web	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/pdftex.web	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,4 +1,4 @@
-% Copyright 1996-2020 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
+% Copyright 1996-2021 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
 % <thanh@@pdftex.org>
 
 % This file is part of pdfTeX.
@@ -33017,6 +33017,7 @@
 dump_int(pdf_last_obj);
 dump_int(pdf_last_xform);
 dump_int(pdf_last_ximage);
+dumptounicode;
 end
 
 @ And restoring the pdftex data structures from the format. The
@@ -33051,6 +33052,7 @@
 undump_int(pdf_last_obj);
 undump_int(pdf_last_xform);
 undump_int(pdf_last_ximage);
+undumptounicode;
 end
 
 @ We have already printed a lot of statistics, so we set |tracing_stats:=0|

Modified: trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,5 +1,5 @@
 /* ptexlib.h: macros for pdfTeX library code.
-Copyright 1996-2018 Han The Thanh, <thanh at pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh at pdftex.org>
 
 This file is part of pdfTeX.
 
@@ -206,6 +206,8 @@
 extern void glyph_unicode_free(void);
 extern void deftounicode(strnumber, strnumber);
 extern integer write_tounicode(char **, const char *, const char *);
+extern void dumptounicode(void);
+extern void undumptounicode(void);
 
 /* utils.c */
 extern boolean str_eq_cstr(strnumber, char *);

Modified: trunk/Build/source/texk/web2c/pdftexdir/ptexmac.h
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ptexmac.h	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/ptexmac.h	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,5 +1,5 @@
 /* ptexmac.h: common macros for pdfTeX.
-Copyright 1996-2018 Han The Thanh, <thanh at pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh at pdftex.org>
 
 This file is part of pdfTeX.
 
@@ -215,4 +215,32 @@
 
 #  define str_prefix(s1, s2)  (strncmp((s1), (s2), strlen(s2)) == 0)
 
+/* (un)dumping a string means dumping the allocation size, followed
+ * by the bytes. The trailing \0 is (un)dumped as well, because that
+ * makes the code simpler.
+ */
+
+#define dumpcharptr(a)				\
+  do {						\
+    integer x;					\
+    if (a!=NULL) {				\
+      x = strlen(a)+1;				\
+      generic_dump(x);  dumpthings(*a, x);	\
+    } else {					\
+      x = 0; generic_dump(x);			\
+    }						\
+  } while (0)
+
+#define undumpcharptr(s)			\
+  do {						\
+    integer x;					\
+    char *a;					\
+    generic_undump (x);				\
+    if (x>0) {					\
+      a = malloc(x);				\
+      undumpthings(*a,x);			\
+      s = a ;					\
+    } else { s = NULL; }			\
+  } while (0)
+
 #endif                          /* PDFTEXMAC */

Modified: trunk/Build/source/texk/web2c/pdftexdir/tounicode.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/tounicode.c	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/tounicode.c	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,5 +1,5 @@
 /*
-Copyright 2006-2019 Han The Thanh, <thanh at pdftex.org>
+Copyright 2006-2021 Han The Thanh, <thanh at pdftex.org>
 
 This file is part of pdfTeX.
 
@@ -475,3 +475,57 @@
     pdfendstream();
     return objnum;
 }
+
+void dumptounicode(void)
+{
+    struct avl_traverser traverse;
+    size_t count;
+    glyph_unicode_entry *gu;
+
+    if (glyph_unicode_tree == NULL) {
+        count = 0;
+        generic_dump(count);
+        return;
+    }
+
+    count = avl_count(glyph_unicode_tree);
+    generic_dump(count);
+
+    avl_t_init(&traverse, glyph_unicode_tree);
+    while (gu = avl_t_next(&traverse)) {
+        dumpcharptr(gu->name);
+        generic_dump(gu->code);
+
+        if (gu->code == UNI_STRING)
+            dumpcharptr(gu->unicode_seq);
+    }
+}
+
+void undumptounicode(void)
+{
+    glyph_unicode_entry *tmp;
+    size_t remaining;
+
+    generic_undump(remaining);
+
+    if (remaining == 0)
+        return;
+
+    assert(glyph_unicode_tree == NULL);
+    glyph_unicode_tree =
+        avl_create(comp_glyph_unicode_entry, NULL, &avl_xallocator);
+    assert(glyph_unicode_tree != NULL);
+
+    while (remaining--) {
+        void **result;
+        glyph_unicode_entry *gu = new_glyph_unicode_entry();
+        undumpcharptr(gu->name);
+        generic_undump(gu->code);
+
+        if (gu->code == UNI_STRING)
+            undumpcharptr(gu->unicode_seq);
+
+        result = avl_probe(glyph_unicode_tree, gu);
+        assert(*result == gu);
+    }
+}

Modified: trunk/Build/source/texk/web2c/pdftexdir/writeimg.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/writeimg.c	2021-01-20 00:54:00 UTC (rev 57475)
+++ trunk/Build/source/texk/web2c/pdftexdir/writeimg.c	2021-01-20 18:39:27 UTC (rev 57476)
@@ -1,5 +1,5 @@
 /*
-Copyright 1996-2014 Han The Thanh, <thanh at pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh at pdftex.org>
 
 This file is part of pdfTeX.
 
@@ -443,36 +443,6 @@
 /* #define undumpsizet   generic_undump */
 #define undumpinteger generic_undump
 
-/* (un)dumping a string means dumping the allocation size, followed
- * by the bytes. The trailing \0 is dumped as well, because that 
- * makes the code simpler.
- */
-
-#define dumpcharptr(a)				\
-  do {						\
-    integer x;					\
-    if (a!=NULL) {				\
-      x = strlen(a)+1;				\
-      dumpinteger(x);  dumpthings(*a, x);	\
-    } else {					\
-      x = 0; dumpinteger(x);			\
-    }						\
-  } while (0)
-
-#define undumpcharptr(s)			\
-  do {						\
-    integer x;					\
-    char *a;					\
-    undumpinteger (x);				\
-    if (x>0) {					\
-      a = malloc(x);				\
-      undumpthings(*a,x);			\
-      s = a ;					\
-    } else { s = NULL; }			\
-  } while (0)
-
-
-
 void dumpimagemeta(void)
 {
     int cur_image, img;



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