texlive[72111] trunk: luafindfont (26aug24)

commits+karl at tug.org commits+karl at tug.org
Mon Aug 26 22:06:48 CEST 2024


Revision: 72111
          https://tug.org/svn/texlive?view=revision&revision=72111
Author:   karl
Date:     2024-08-26 22:06:47 +0200 (Mon, 26 Aug 2024)
Log Message:
-----------
luafindfont (26aug24)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
    trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
    trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
    trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex
    trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua

Modified: trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua	2024-08-26 16:49:18 UTC (rev 72110)
+++ trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua	2024-08-26 20:06:47 UTC (rev 72111)
@@ -1,6 +1,6 @@
 #!/usr/bin/env texlua
 --
---  $Id: luafindfont.lua 735 2023-06-22 19:12:29Z herbert $
+--  $Id: luafindfont.lua 961 2024-08-25 16:47:59Z herbert $
 -----------------------------------------------------------------------
 --         FILE:  luafindfont.lua
 --  DESCRIPTION:  search for fonts in the database
@@ -8,7 +8,7 @@
 --       AUTHOR:  Herbert Voß  (C) 2023-06-21
 -----------------------------------------------------------------------
         luafindfont = luafindfont or { }
-      local version = 0.13
+      local version = 0.14
 luafindfont.version = version
 
 --[[
@@ -31,6 +31,7 @@
 
 ]]
 
+-- equivilant with ConTeXt, e.g. times
 -- mtxrun --script font --list --name --all --pattern=times
 
 kpse.set_program_name("luatex")
@@ -38,8 +39,6 @@
 
 require("lualibs")  -- all part of LuaTeX
 
---require("luafindfont-utflib")
-
 if #arg == 0 then
   print("I need at least one argument or option! Will exit ...")
   os.exit()
@@ -282,6 +281,13 @@
   end
 end
 
+function centerText(text, width)
+  if text == nil then return "" end
+  local spaces = math.floor((width-string.len(text))/2)
+  local len = string.len(text)
+  return ((" "):rep(spaces)..text..(" "):rep(spaces))
+end
+
 local fontData = {}
 local fontListFile = getFileLocation()
 if fontListFile == "" then
@@ -375,20 +381,38 @@
 local minChars = 26
 local Fontname = "Filename"
 local Path = "Path"
-local SymbolicName = "Symbolic name"
+local SymbolicName = "Symbolic"
 local lfdNr = "No."
 
 if (font_str ~= "*") and not noSymbolicNames then
   if args_xetex > 0 then
-    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) 
+--    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    io.write(centerText(Path,l_max[3]))
+    print("X") 
   else      
-    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) 
+--    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    print(centerText(Path,l_max[3]))
   end
 else
   if args_xetex > 0 then
-    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) 
+--    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    io.write(centerText(Path,l_max[3]))
+    print("X")
   else
-    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s",lfdNr,Fontname,Path)) 
+--    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s",lfdNr,Fontname,Path)) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    print(centerText(Path,l_max[3]))
   end
 end
 

Modified: trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG	2024-08-26 16:49:18 UTC (rev 72110)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG	2024-08-26 20:06:47 UTC (rev 72111)
@@ -1,3 +1,4 @@
+0.14  2024-08-25  - small changes to the output
 0.13  2023-06-23  - add exrun:close() for every kpsewhich test
 0.12  2023-06-21  - bugfix for undefined exrun (l. 251)
                   - check for empty font list and given font number

Modified: trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex	2024-08-26 16:49:18 UTC (rev 72110)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex	2024-08-26 20:06:47 UTC (rev 72111)
@@ -1,4 +1,4 @@
- %% $Id: luafindfont-doc.tex 648 2022-11-03 19:58:48Z herbert $
+ %% $Id: luafindfont-doc.tex 962 2024-08-25 16:50:54Z herbert $
 %
 \listfiles\setcounter{errorcontextlines}{100}
 \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
@@ -81,7 +81,7 @@
 \def\setVersion#1{\setVVersion#1!!}
 \def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}} 
 
-\setVersion{version = 0.11}%  can be automatically changed by perl
+\setVersion{version = 0.14}%  can be automatically changed by perl
 
 \setkeys{hv}{cleanup={},force}
 

Modified: trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua	2024-08-26 16:49:18 UTC (rev 72110)
+++ trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua	2024-08-26 20:06:47 UTC (rev 72111)
@@ -1,6 +1,6 @@
 #!/usr/bin/env texlua
 --
---  $Id: luafindfont.lua 735 2023-06-22 19:12:29Z herbert $
+--  $Id: luafindfont.lua 961 2024-08-25 16:47:59Z herbert $
 -----------------------------------------------------------------------
 --         FILE:  luafindfont.lua
 --  DESCRIPTION:  search for fonts in the database
@@ -8,7 +8,7 @@
 --       AUTHOR:  Herbert Voß  (C) 2023-06-21
 -----------------------------------------------------------------------
         luafindfont = luafindfont or { }
-      local version = 0.13
+      local version = 0.14
 luafindfont.version = version
 
 --[[
@@ -31,6 +31,7 @@
 
 ]]
 
+-- equivilant with ConTeXt, e.g. times
 -- mtxrun --script font --list --name --all --pattern=times
 
 kpse.set_program_name("luatex")
@@ -38,8 +39,6 @@
 
 require("lualibs")  -- all part of LuaTeX
 
---require("luafindfont-utflib")
-
 if #arg == 0 then
   print("I need at least one argument or option! Will exit ...")
   os.exit()
@@ -282,6 +281,13 @@
   end
 end
 
+function centerText(text, width)
+  if text == nil then return "" end
+  local spaces = math.floor((width-string.len(text))/2)
+  local len = string.len(text)
+  return ((" "):rep(spaces)..text..(" "):rep(spaces))
+end
+
 local fontData = {}
 local fontListFile = getFileLocation()
 if fontListFile == "" then
@@ -375,20 +381,38 @@
 local minChars = 26
 local Fontname = "Filename"
 local Path = "Path"
-local SymbolicName = "Symbolic name"
+local SymbolicName = "Symbolic"
 local lfdNr = "No."
 
 if (font_str ~= "*") and not noSymbolicNames then
   if args_xetex > 0 then
-    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) 
+--    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    io.write(centerText(Path,l_max[3]))
+    print("X") 
   else      
-    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) 
+--    print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s  %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    print(centerText(Path,l_max[3]))
   end
 else
   if args_xetex > 0 then
-    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) 
+--    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    io.write(centerText(Path,l_max[3]))
+    print("X")
   else
-    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s",lfdNr,Fontname,Path)) 
+--    print(string.format("%5s %"..l_max[1].."s  %"..l_max[3].."s",lfdNr,Fontname,Path)) 
+    io.write(string.format("%5s",lfdNr))
+    io.write(centerText(Fontname,l_max[1]))
+    io.write(centerText(SymbolicName,l_max[2]))
+    print(centerText(Path,l_max[3]))
   end
 end
 



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