diff options
author | Karl Berry <karl@freefriends.org> | 2024-08-26 20:06:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-08-26 20:06:47 +0000 |
commit | a1dd7f74ffde958f6240cce0e5e7501349c509b6 (patch) | |
tree | 6e1a325f7d48edca6dee8393dc5a4e7dcdda5d67 | |
parent | 34426d35f067c51fe4a999a963d5fb027634fc53 (diff) |
luafindfont (26aug24)
git-svn-id: svn://tug.org/texlive/trunk@72111 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua | 42 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/CHANGELOG | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf | bin | 98571 -> 98752 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex | 4 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/luafindfont/luafindfont.lua | 42 |
5 files changed, 69 insertions, 20 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua index a1d554b5aee..f77f913a7d6 100755 --- a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua +++ b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua @@ -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 @@ Report bugs to hvoss@tug.org ]] +-- equivilant with ConTeXt, e.g. times -- mtxrun --script font --list --name --all --pattern=times kpse.set_program_name("luatex") @@ -38,8 +39,6 @@ local f = kpse.find_file("lualibs.lua") 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 @@ function compareEntries(f1, f2) 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 @@ if l_max[3] > maxStrLength then l_max[3] = maxStrLength end 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 diff --git a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG index 783f804f294..a629f6617a8 100644 --- a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG +++ b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG @@ -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 diff --git a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf Binary files differindex 65be6ced105..f51c3478b88 100644 --- a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf +++ b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf diff --git a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex index c10483ce5a2..818cd16fbb1 100644 --- a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex +++ b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex @@ -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} diff --git a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua index a1d554b5aee..f77f913a7d6 100755 --- a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua +++ b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua @@ -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 @@ Report bugs to hvoss@tug.org ]] +-- equivilant with ConTeXt, e.g. times -- mtxrun --script font --list --name --all --pattern=times kpse.set_program_name("luatex") @@ -38,8 +39,6 @@ local f = kpse.find_file("lualibs.lua") 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 @@ function compareEntries(f1, f2) 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 @@ if l_max[3] > maxStrLength then l_max[3] = maxStrLength end 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 |