summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-20 18:39:27 +0000
committerKarl Berry <karl@freefriends.org>2021-01-20 18:39:27 +0000
commite65b2a64508243e4279778a8555868815dd87acd (patch)
tree6b717e784baceaec802554a0faa1872fce038943 /Build/source/texk/web2c/pdftexdir
parent705e19f654d894c826a6c7a802354e6094abb105 (diff)
allow (un)dumping \pdfglyphtounicode in .fmt
git-svn-id: svn://tug.org/texlive/trunk@57476 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir')
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog15
-rw-r--r--Build/source/texk/web2c/pdftexdir/NEWS2
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web4
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexlib.h4
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexmac.h30
-rw-r--r--Build/source/texk/web2c/pdftexdir/tounicode.c56
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeimg.c32
7 files changed, 108 insertions, 35 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index faa05f20db1..d4c1ec7074a 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,18 @@
+2021-01-20 Karl Berry <karl@freefriends.org>
+
+ * NEWS: update.
+
+2021-01-20 Marcel Fabian Krueger <tex@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@gmail.com>
* ttf2afm.c (make_name): yet another attempt at filtering
diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS
index 907e712efae..13b154cdefd 100644
--- a/Build/source/texk/web2c/pdftexdir/NEWS
+++ b/Build/source/texk/web2c/pdftexdir/NEWS
@@ -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.
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index 9c85d212b15..33ac3c914b2 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -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(head_tab[obj_type_ximage]);
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(head_tab[obj_type_ximage]);
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|
diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h
index e11ab063194..b10d289b38b 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexlib.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h
@@ -1,5 +1,5 @@
/* ptexlib.h: macros for pdfTeX library code.
-Copyright 1996-2018 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -206,6 +206,8 @@ extern boolean handle_subfont_fm(fm_entry *, int);
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 *);
diff --git a/Build/source/texk/web2c/pdftexdir/ptexmac.h b/Build/source/texk/web2c/pdftexdir/ptexmac.h
index 54e12159245..cebb279138a 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexmac.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexmac.h
@@ -1,5 +1,5 @@
/* ptexmac.h: common macros for pdfTeX.
-Copyright 1996-2018 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -215,4 +215,32 @@ size_t T##_limit
# 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 */
diff --git a/Build/source/texk/web2c/pdftexdir/tounicode.c b/Build/source/texk/web2c/pdftexdir/tounicode.c
index 3d93a3578d4..0b90331ef8b 100644
--- a/Build/source/texk/web2c/pdftexdir/tounicode.c
+++ b/Build/source/texk/web2c/pdftexdir/tounicode.c
@@ -1,5 +1,5 @@
/*
-Copyright 2006-2019 Han The Thanh, <thanh@pdftex.org>
+Copyright 2006-2021 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -475,3 +475,57 @@ integer write_tounicode(char **glyph_names, const char *tfmname,
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);
+ }
+}
diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c
index 3cc814ddb6e..c4d2feda7c3 100644
--- a/Build/source/texk/web2c/pdftexdir/writeimg.c
+++ b/Build/source/texk/web2c/pdftexdir/writeimg.c
@@ -1,5 +1,5 @@
/*
-Copyright 1996-2014 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -443,36 +443,6 @@ void img_free(void)
/* #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;