texlive[63265] trunk: luafindfont (8may22)

commits+karl at tug.org commits+karl at tug.org
Sun May 8 22:26:00 CEST 2022


Revision: 63265
          http://tug.org/svn/texlive?view=revision&revision=63265
Author:   karl
Date:     2022-05-08 22:26:00 +0200 (Sun, 08 May 2022)
Log Message:
-----------
luafindfont (8may22)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
    trunk/Master/texmf-dist/doc/man/man1/luafindfont.1
    trunk/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf
    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	2022-05-08 20:25:41 UTC (rev 63264)
+++ trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua	2022-05-08 20:26:00 UTC (rev 63265)
@@ -1,5 +1,5 @@
 #!/usr/bin/env texlua
-
+--
 -----------------------------------------------------------------------
 --         FILE:  luafindfont.lua
 --  DESCRIPTION:  search for fonts in the database
@@ -7,7 +7,7 @@
 --       AUTHOR:  Herbert Voß  (C) 2022-05-05
 -----------------------------------------------------------------------
         luafindfont = luafindfont or { }
-   local version = 0.08
+      local version = 0.09
 luafindfont.version = version
 
 --[[
@@ -34,6 +34,7 @@
 local f = kpse.find_file("lualibs.lua")
 
 require("lualibs")  -- all part of LuaTeX
+
 --require("luafindfont-utflib")
 
 if #arg == 0 then
@@ -112,7 +113,13 @@
   i = i + 1
 end
 
-if args_verbose > 0 then
+local vlevel = args_verbose
+
+function logprint(str)
+  if vlevel > 0 then print(str) end
+end
+
+if vlevel > 0 then
   print("Parameter:")
   print("args_verbose = "..args_verbose)
   print("args_nosymbolicnames = "..tostring(args_nosymbolicnames))
@@ -127,7 +134,6 @@
   os.exit()
 end
 
-local vlevel = args_verbose
 --local otfinfo = args_otfinfo
 local info = args_info
 local noSymbolicNames = args_nosymbolicnames
@@ -153,12 +159,14 @@
   else return file end
 end
 
+-- for fileparts see also file fontloader-l-file.lua in /luaotfload
+
 function getFileLocation()
   local cachepaths = kpse.expand_var('$TEXMFCACHE') or ""
   if cachepaths == "" or cachepaths == "$TEXMFCACHE" then
     cachepaths = kpse.expand_var('$TEXMFVAR') or ""
   end
-  if vlevel > 0 then print("cachepaths: ",cachepaths) end
+  logprint("cachepaths: "..cachepaths)
   if cachepaths == "" then
     print("umghhh ....")
     print("No cache path found ... ")
@@ -169,14 +177,14 @@
   else
     paths = string.split(cachepaths,":")
   end
-  if vlevel > 0 then print ("Pathes: ", paths[1], paths[2]) end
+  logprint ("Pathes: "..paths[1]..", "..paths[2])
   local file = paths[1].."/luatex-cache/generic/names" 
-  if vlevel > 0 then print("try: ",file) end
+  logprint("try path: "..file)
   local f,err = io.open (file.."/test.tmp", "w") 
   if not f and #paths > 1 then
-    if vlevel > 0 then print("first path has no file, I'll try the second one ...") end
+    logprint("first path has no file, I'll try the second one ...")
     file = paths[2].."/luatex-cache/generic/names"
-  if vlevel > 0 then print("try: ",file) end
+    logprint("try path: "..file)
     f,err = io.open (file.."/test.tmp", "w") 
     if not f then
       print("Error getting file location: \n",err)
@@ -192,36 +200,21 @@
 end
 
 function readBinaryOrZippedFile(file)
-  if vlevel > 0 then print("Check for file "..file..".luc") end
+  logprint("Check for file "..file..".luc.gz")
+  local f,err = io.open (file..".luc.gz", "rb") 
+  if f then
+    logprint("Found a zipped binary data file ... ") 
+    local chunk = gzip.decompress(f:read"*all")
+    f:close()
+    local func = load (chunk, "b")
+    str = func()
+    return str
+  end
+  logprint("There is no zipped binary data file ... ") 
+  logprint("Check for unzipped file "..file..".luc")
   local f,err = io.open (file..".luc", "rb") 
-  if not f then
-    if vlevel > 0 then 
-      print("There is no binary data file ... checking for lua.gz")
-    end
-    f,err = io.open (file..".lua.gz", "r") 
-    if not f then
-      if vlevel > 0 then print("There is no gzipped data file ... ") end
-      f,err = io.open (file..".lua", "r") 
-      if not f then
-        if vlevel > 0 then print("There is no data file ... ") end
-        print("Error reading file: ",err)
-        return nil
-      else
-        if vlevel > 0 then print("Found a normal data file ... ") end
-        local str = dofile(f)
-        f:close()
-        return str
-      end
-    else  
-      if vlevel > 0 then print("Found a gzipped data file ... ") end
-      local str = f:read("*all")
-      local str2 = loadstring(gzip.decompress(str))
-      str = str2()
-      f:close()
-      return str
-    end
-  else
-    if vlevel > 0 then print("Found a binary data file ... ") end
+  if f then
+    logprint("Found a binary data file ... ") 
     local chunk = f:read"*all"
     f:close()
     local func = load (chunk, "b")
@@ -228,6 +221,30 @@
     str = func()
     return str
   end
+  logprint("There is no binary data file ... ") 
+  logprint("Check for zipped file "..file..".lua.gz")
+  f,err = io.open (file..".lua.gz", "rb") 
+  if f then
+    logprint("Found a gzipped data file ... ")
+    local str = f:read("*all")
+    local str2 = loadstring(gzip.decompress(str))
+    str = str2()
+    f:close()
+    return str
+  end
+  logprint("There is no gzipped data file ... ") 
+  logprint("Check for file "..file..".lua")
+  f,err = io.open (file..".lua", "r") 
+  if f then
+    logprint("Found a normal data file ... ")
+    local str = dofile(f)
+    f:close()
+    return str
+  else
+    logprint("There is no data file ... ")
+    print("Error reading file: ",err)
+    return nil
+  end
 end
 
 function compareEntries(f1, f2)
@@ -240,7 +257,6 @@
   end
 end
 
-
 local fontData = {}
 local fontListFile = getFileLocation()
 if fontListFile == "" then
@@ -302,6 +318,7 @@
 
 local j = 1
 local fontList = {}
+-- now calculate the longest string for all colums
 local l_max = {1, 1, 1}
 for i, v in ipairs(fontDataMap) do 
   if v["familyname"] then
@@ -323,9 +340,9 @@
 if l_max[3] > maxStrLength then l_max[3] = maxStrLength end
 
 local minChars = 26
-local Fontname = "Fontname"
+local Fontname = "Filename"
 local Path = "Path"
-local SymbolicName = "Symbolic Name"
+local SymbolicName = "Symbolic name"
 local lfdNr = "No."
 
 if (font_str ~= "*") and not noSymbolicNames then

Modified: trunk/Master/texmf-dist/doc/man/man1/luafindfont.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/luafindfont.1	2022-05-08 20:25:41 UTC (rev 63264)
+++ trunk/Master/texmf-dist/doc/man/man1/luafindfont.1	2022-05-08 20:26:00 UTC (rev 63265)
@@ -1,6 +1,6 @@
 .\" Manpage for luafindfont.
 .\" Contact hvoss at tug.org to correct errors or typos.
-.TH luafindfont 1 "05 may 2022" "0.08" "luafindfont man page"
+.TH luafindfont 1 "07 may 2022" "0.09" "luafindfont man page"
 .SH NAME
 luafindfont
 \- retrieve font informations of all installed system and TeX fonts.

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

Modified: trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG	2022-05-08 20:25:41 UTC (rev 63264)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG	2022-05-08 20:26:00 UTC (rev 63265)
@@ -1,5 +1,6 @@
+0.09  2022-05-07  - load first a luc.gz database, if present 
 0.08  2022-05-05  - added --no-symbolic-names as a synonym
-                    edited some output messages
+                  - edited some output messages
 0.07  2022-05-01  - added -x option for a kpsewhich test
 0.06  2022-02-08  - small fix for output log
 0.05  2021-12-04  - use always lowercase for internal search

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	2022-05-08 20:25:41 UTC (rev 63264)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex	2022-05-08 20:26:00 UTC (rev 63265)
@@ -1,4 +1,4 @@
- %% $Id: luafindfont-doc.tex 533 2022-05-01 18:31:44Z herbert $
+ %% $Id: luafindfont-doc.tex 545 2022-05-08 14:21:52Z herbert $
 %
 \listfiles\setcounter{errorcontextlines}{100}
 \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
@@ -39,11 +39,13 @@
 \usepackage{listings}
 \usepackage{hvextern}
 
-\setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename=false}
+\setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename=false,force,verbose}
 \lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX}
 \usepackage{ragged2e}
+
 \usepackage{makeidx}\makeindex
 \usepackage{hvindex}
+
 \def\Lfile#1{\texttt{#1}\index{#1 file@\texttt{#1} file}}
 \def\Lext#1{\texttt{.#1}\index{#1 file extension@\texttt{.#1} file extension}}
 \def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}}
@@ -79,7 +81,7 @@
 \def\setVersion#1{\setVVersion#1!!}
 \def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}} 
 
-\setVersion{version = 0.08}%  can be automatically changed by perl
+\setVersion{version = 0.09}%  can be automatically changed by perl
 
 \setkeys{hv}{cleanup={},force}
 
@@ -174,8 +176,8 @@
 \section{How it works}
 \FF uses the data file \Lfile{luaotfloadtool-names.lua} which is created by \LuaTeX. If it is
 missing it will be created by \FF itself. The name of the font should be in lowercase
-characters and must not be the complete name. A \verb|time| for finding all fonts with
-time in its names is sufficiant.
+characters and must not be the complete name. A ``\verb|time|'' for finding all fonts with
+``time'' in its names is sufficiant for searching ``times new roman''.
 
 
 \subsection{Fontname}
@@ -246,7 +248,7 @@
 
 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
 #StartVisibleMain
-luafindfont -x PStricksdotfont
+luafindfont -m 55 -x PStricksdotfont
 #StopVisibleMain
 \end{externalDocument}
 
@@ -267,7 +269,7 @@
 
 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
 #StartVisibleMain
-luafindfont -m 40 libertinus
+luafindfont -m 35 libertinus
 #StopVisibleMain
 \end{externalDocument}
 

Modified: trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua	2022-05-08 20:25:41 UTC (rev 63264)
+++ trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua	2022-05-08 20:26:00 UTC (rev 63265)
@@ -1,5 +1,5 @@
 #!/usr/bin/env texlua
-
+--
 -----------------------------------------------------------------------
 --         FILE:  luafindfont.lua
 --  DESCRIPTION:  search for fonts in the database
@@ -7,7 +7,7 @@
 --       AUTHOR:  Herbert Voß  (C) 2022-05-05
 -----------------------------------------------------------------------
         luafindfont = luafindfont or { }
-   local version = 0.08
+      local version = 0.09
 luafindfont.version = version
 
 --[[
@@ -34,6 +34,7 @@
 local f = kpse.find_file("lualibs.lua")
 
 require("lualibs")  -- all part of LuaTeX
+
 --require("luafindfont-utflib")
 
 if #arg == 0 then
@@ -112,7 +113,13 @@
   i = i + 1
 end
 
-if args_verbose > 0 then
+local vlevel = args_verbose
+
+function logprint(str)
+  if vlevel > 0 then print(str) end
+end
+
+if vlevel > 0 then
   print("Parameter:")
   print("args_verbose = "..args_verbose)
   print("args_nosymbolicnames = "..tostring(args_nosymbolicnames))
@@ -127,7 +134,6 @@
   os.exit()
 end
 
-local vlevel = args_verbose
 --local otfinfo = args_otfinfo
 local info = args_info
 local noSymbolicNames = args_nosymbolicnames
@@ -153,12 +159,14 @@
   else return file end
 end
 
+-- for fileparts see also file fontloader-l-file.lua in /luaotfload
+
 function getFileLocation()
   local cachepaths = kpse.expand_var('$TEXMFCACHE') or ""
   if cachepaths == "" or cachepaths == "$TEXMFCACHE" then
     cachepaths = kpse.expand_var('$TEXMFVAR') or ""
   end
-  if vlevel > 0 then print("cachepaths: ",cachepaths) end
+  logprint("cachepaths: "..cachepaths)
   if cachepaths == "" then
     print("umghhh ....")
     print("No cache path found ... ")
@@ -169,14 +177,14 @@
   else
     paths = string.split(cachepaths,":")
   end
-  if vlevel > 0 then print ("Pathes: ", paths[1], paths[2]) end
+  logprint ("Pathes: "..paths[1]..", "..paths[2])
   local file = paths[1].."/luatex-cache/generic/names" 
-  if vlevel > 0 then print("try: ",file) end
+  logprint("try path: "..file)
   local f,err = io.open (file.."/test.tmp", "w") 
   if not f and #paths > 1 then
-    if vlevel > 0 then print("first path has no file, I'll try the second one ...") end
+    logprint("first path has no file, I'll try the second one ...")
     file = paths[2].."/luatex-cache/generic/names"
-  if vlevel > 0 then print("try: ",file) end
+    logprint("try path: "..file)
     f,err = io.open (file.."/test.tmp", "w") 
     if not f then
       print("Error getting file location: \n",err)
@@ -192,36 +200,21 @@
 end
 
 function readBinaryOrZippedFile(file)
-  if vlevel > 0 then print("Check for file "..file..".luc") end
+  logprint("Check for file "..file..".luc.gz")
+  local f,err = io.open (file..".luc.gz", "rb") 
+  if f then
+    logprint("Found a zipped binary data file ... ") 
+    local chunk = gzip.decompress(f:read"*all")
+    f:close()
+    local func = load (chunk, "b")
+    str = func()
+    return str
+  end
+  logprint("There is no zipped binary data file ... ") 
+  logprint("Check for unzipped file "..file..".luc")
   local f,err = io.open (file..".luc", "rb") 
-  if not f then
-    if vlevel > 0 then 
-      print("There is no binary data file ... checking for lua.gz")
-    end
-    f,err = io.open (file..".lua.gz", "r") 
-    if not f then
-      if vlevel > 0 then print("There is no gzipped data file ... ") end
-      f,err = io.open (file..".lua", "r") 
-      if not f then
-        if vlevel > 0 then print("There is no data file ... ") end
-        print("Error reading file: ",err)
-        return nil
-      else
-        if vlevel > 0 then print("Found a normal data file ... ") end
-        local str = dofile(f)
-        f:close()
-        return str
-      end
-    else  
-      if vlevel > 0 then print("Found a gzipped data file ... ") end
-      local str = f:read("*all")
-      local str2 = loadstring(gzip.decompress(str))
-      str = str2()
-      f:close()
-      return str
-    end
-  else
-    if vlevel > 0 then print("Found a binary data file ... ") end
+  if f then
+    logprint("Found a binary data file ... ") 
     local chunk = f:read"*all"
     f:close()
     local func = load (chunk, "b")
@@ -228,6 +221,30 @@
     str = func()
     return str
   end
+  logprint("There is no binary data file ... ") 
+  logprint("Check for zipped file "..file..".lua.gz")
+  f,err = io.open (file..".lua.gz", "rb") 
+  if f then
+    logprint("Found a gzipped data file ... ")
+    local str = f:read("*all")
+    local str2 = loadstring(gzip.decompress(str))
+    str = str2()
+    f:close()
+    return str
+  end
+  logprint("There is no gzipped data file ... ") 
+  logprint("Check for file "..file..".lua")
+  f,err = io.open (file..".lua", "r") 
+  if f then
+    logprint("Found a normal data file ... ")
+    local str = dofile(f)
+    f:close()
+    return str
+  else
+    logprint("There is no data file ... ")
+    print("Error reading file: ",err)
+    return nil
+  end
 end
 
 function compareEntries(f1, f2)
@@ -240,7 +257,6 @@
   end
 end
 
-
 local fontData = {}
 local fontListFile = getFileLocation()
 if fontListFile == "" then
@@ -302,6 +318,7 @@
 
 local j = 1
 local fontList = {}
+-- now calculate the longest string for all colums
 local l_max = {1, 1, 1}
 for i, v in ipairs(fontDataMap) do 
   if v["familyname"] then
@@ -323,9 +340,9 @@
 if l_max[3] > maxStrLength then l_max[3] = maxStrLength end
 
 local minChars = 26
-local Fontname = "Fontname"
+local Fontname = "Filename"
 local Path = "Path"
-local SymbolicName = "Symbolic Name"
+local SymbolicName = "Symbolic name"
 local lfdNr = "No."
 
 if (font_str ~= "*") and not noSymbolicNames then



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