summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/pdftexdir/ttf2afm.c20
2 files changed, 22 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index 8fb078ee65b..faa05f20db1 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-04 Thanh Han The <hanthethanh@gmail.com>
+
+ * ttf2afm.c (make_name): yet another attempt at filtering
+ control characters, since the test font, SourceCodePro (as well
+ as many other Mac fonts), actually contains control characters
+ (24 and 25), due to UTF-16BE.
+
2021-01-11 Karl Berry <karl@freefriends.org>
* ttf2afm.c (make_name): better to use unsigned char.
diff --git a/Build/source/texk/web2c/pdftexdir/ttf2afm.c b/Build/source/texk/web2c/pdftexdir/ttf2afm.c
index d0205030dce..0750173355c 100644
--- a/Build/source/texk/web2c/pdftexdir/ttf2afm.c
+++ b/Build/source/texk/web2c/pdftexdir/ttf2afm.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.
@@ -438,13 +438,23 @@ static char *make_name(long platform_id, int len)
*p = (unsigned char) get_char();
i++;
if (*p == 0 && platform_id == 3) {
- /* assume this is an UTF-16BE encoded string but contains english
- * text, which is the most common case; simply copy the 2nd byte.
- * Note: will not work for non-ascii text */
+ /* assume this is an UTF-16BE encoded string but contains latin
+ * chars, which is the most common case; simply copy the 2nd byte.
+ * Note: will not work for non-latin text */
*p = (unsigned char) get_char();
i++;
}
- p++;
+ /* sometime a UTF-16BE string will contain chars where the 1st
+ or 2nd byte is in range (0..32) */
+ if (*p < 32
+ && *p != '\r'
+ && *p != '\n'
+ && *p != '\t'
+ ) {
+ ttf_warn("skipping unsafe character: %i", *p);
+ } else {
+ p++;
+ }
}
*p = 0;
return xstrdup(buf);