[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Print zero based subfont indices in luaotfload-tool (e804d59)

Marcel Fabian Krüger tex at 2krueger.de
Sat Feb 1 07:56:01 CET 2020


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

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

commit e804d5945d46c957b7ca1d0ca047eb01206be57f
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Wed Jan 29 14:35:52 2020 +0100

    Print zero based subfont indices in luaotfload-tool


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

e804d5945d46c957b7ca1d0ca047eb01206be57f
 src/luaotfload-tool.lua | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index 1893b9d..cd678ac 100644
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -454,6 +454,9 @@ local show_info_table show_info_table = function (t, depth)
     for n = 1, #keys do
         local key = keys [n]
         local val = t [key]
+        if key == "subfontindex" then
+            val = val - 1 -- We use 0-based subfont indices
+        end
         if type (val) == "table" then
             texiowrite_nl (indent .. stringformat (info_fmt, key, "<table>"))
             show_info_table (val, depth + 1)
@@ -670,16 +673,11 @@ end
 
 local subfont_by_name
 subfont_by_name = function (lst, askedname, n)
-    if not n then
-        return subfont_by_name (lst, askedname, 1)
-    end
-
-    local font = lst[n]
-    if font then
+    for n = 1, #lst do
+        local font = lst[n]
         if fonts.names.sanitize_fontname (font.fullname) == askedname then
             return font
         end
-        return subfont_by_name (lst, askedname, n + 1)
     end
     return false
 end
@@ -726,7 +724,7 @@ local show_font_info = function (basename, askedname, detail, subfont)
                 for subfont = 1, nfonts do
                     logreport (true, 1, "resolve",
                                [[Showing info for font no. %d]],
-                               subfont)
+                               subfont - 1)
                     show_info_items(shortinfo[subfont])
                     if detail == true then
                         show_full_info(fullname, subfont)
@@ -1211,7 +1209,7 @@ actions.query = function (job)
         if subfont then
             logreport (false, 0, "resolve",
                        "Resolved file name %q, subfont nr. %q",
-                       foundname, subfont)
+                       foundname, subfont - 1)
         else
             logreport (false, 0, "resolve",
                        "Resolved file name %q", foundname)





More information about the latex3-commits mailing list.