texlive[57464] Build/source/texk/web2c/pdftexdir: another attempt at

commits+karl at tug.org commits+karl at tug.org
Tue Jan 19 00:54:21 CET 2021


Revision: 57464
          http://tug.org/svn/texlive?view=revision&revision=57464
Author:   karl
Date:     2021-01-19 00:54:21 +0100 (Tue, 19 Jan 2021)
Log Message:
-----------
another attempt at clearing control characters

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/ttf2afm.c

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2021-01-18 22:15:49 UTC (rev 57463)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2021-01-18 23:54:21 UTC (rev 57464)
@@ -1,3 +1,10 @@
+2021-01-04  Thanh Han The  <hanthethanh at 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 at freefriends.org>
 
 	* ttf2afm.c (make_name): better to use unsigned char.

Modified: trunk/Build/source/texk/web2c/pdftexdir/ttf2afm.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ttf2afm.c	2021-01-18 22:15:49 UTC (rev 57463)
+++ trunk/Build/source/texk/web2c/pdftexdir/ttf2afm.c	2021-01-18 23:54:21 UTC (rev 57464)
@@ -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.
 
@@ -438,13 +438,23 @@
         *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);



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