summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-18 23:54:21 +0000
committerKarl Berry <karl@freefriends.org>2021-01-18 23:54:21 +0000
commit5a945e393be9acda7593f648d83f44c12e014f1c (patch)
tree49fdaa703aa29fb37c7579f3f2c2b2585fcf11a0 /Build
parent1980641bf70a8a584e59c089c20b2a1d9d67b476 (diff)
another attempt at clearing control characters
git-svn-id: svn://tug.org/texlive/trunk@57464 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-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);