[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Don't fail when outputtng ill-formed font names (d8139fe)

Marcel Fabian Krüger tex at 2krueger.de
Sun Sep 29 20:18:09 CEST 2019


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/d8139feb5dcf29e0c8c3afb71c7e29f7c545a2be

>---------------------------------------------------------------

commit d8139feb5dcf29e0c8c3afb71c7e29f7c545a2be
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Sep 29 20:18:09 2019 +0200

    Don't fail when outputtng ill-formed font names
    
    Probably fixes #99.


>---------------------------------------------------------------

d8139feb5dcf29e0c8c3afb71c7e29f7c545a2be
 src/luaotfload-database.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 0610618..c6192a4 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -2281,7 +2281,14 @@ local truncate_string = function (str, restrict)
     local tw  = config.luaotfload.misc.termwidth
     local wd  = tw - restrict
     local len = utf8len (str)
-    if wd - len < 0 then
+    if not len then
+        -- str is not valid UTF-8... We will assume a 8-bit
+        -- encoding and forward it verbatim to the output.
+        len = #str
+        if wd - len < 0 then
+            str = ".." .. stringsub(str, len - wd + 2)
+        end
+    elseif wd - len < 0 then
         --- combined length exceeds terminal,
         str = ".." .. stringsub(str, utf8offset(str, - wd + 2))
     end





More information about the latex3-commits mailing list