summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-05-08 20:26:00 +0000
committerKarl Berry <karl@freefriends.org>2022-05-08 20:26:00 +0000
commitcd003a26e4503a84bb3f45ef4f21a48515c4f7d7 (patch)
tree779e2f5c130a8ead1a28a41a750a67ac8f5c2088
parent6fd01e0e4194d0b6c992167beeaf13f858f295a4 (diff)
luafindfont (8may22)
git-svn-id: svn://tug.org/texlive/trunk@63265 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua99
-rw-r--r--Master/texmf-dist/doc/man/man1/luafindfont.12
-rw-r--r--Master/texmf-dist/doc/man/man1/luafindfont.man1.pdfbin24166 -> 24076 bytes
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/CHANGELOG3
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdfbin81978 -> 86485 bytes
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex16
-rwxr-xr-xMaster/texmf-dist/scripts/luafindfont/luafindfont.lua99
7 files changed, 128 insertions, 91 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
index 62d0e8cd4f5..d3532b643ed 100755
--- a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
+++ b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
@@ -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 @@ kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
require("lualibs") -- all part of LuaTeX
+
--require("luafindfont-utflib")
if #arg == 0 then
@@ -112,7 +113,13 @@ while i <= #arg do
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 @@ if not args_font then
os.exit()
end
-local vlevel = args_verbose
--local otfinfo = args_otfinfo
local info = args_info
local noSymbolicNames = args_nosymbolicnames
@@ -153,12 +159,14 @@ function getFileParts(fullpath,part)
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 @@ function getFileLocation()
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,42 +200,51 @@ function getFileLocation()
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")
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 @@ function compareEntries(f1, f2)
end
end
-
local fontData = {}
local fontListFile = getFileLocation()
if fontListFile == "" then
@@ -302,6 +318,7 @@ fontDataMap = newFontDataMap
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 @@ end
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
diff --git a/Master/texmf-dist/doc/man/man1/luafindfont.1 b/Master/texmf-dist/doc/man/man1/luafindfont.1
index 8bc78a2a597..6814193feac 100644
--- a/Master/texmf-dist/doc/man/man1/luafindfont.1
+++ b/Master/texmf-dist/doc/man/man1/luafindfont.1
@@ -1,6 +1,6 @@
.\" Manpage for luafindfont.
.\" Contact hvoss@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.
diff --git a/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf b/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf
index c321ca4d879..79471db4889 100644
--- a/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
index 38c1a9726a1..acd81406f38 100644
--- a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
+++ b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
@@ -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
diff --git a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
index 4dc4203bd5a..913da1bc1d2 100644
--- a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
+++ b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex
index 90d0c57d946..59ac70890cf 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 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 @@ the length is limited to 50 characters and in the middle of the long name there
\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 @@ the usual way by running \texttt{texhash} or via a menu entry if using a file ma
\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 @@ luafindfont segoe
\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}
diff --git a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
index 62d0e8cd4f5..d3532b643ed 100755
--- a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
+++ b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
@@ -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 @@ kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
require("lualibs") -- all part of LuaTeX
+
--require("luafindfont-utflib")
if #arg == 0 then
@@ -112,7 +113,13 @@ while i <= #arg do
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 @@ if not args_font then
os.exit()
end
-local vlevel = args_verbose
--local otfinfo = args_otfinfo
local info = args_info
local noSymbolicNames = args_nosymbolicnames
@@ -153,12 +159,14 @@ function getFileParts(fullpath,part)
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 @@ function getFileLocation()
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,42 +200,51 @@ function getFileLocation()
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")
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 @@ function compareEntries(f1, f2)
end
end
-
local fontData = {}
local fontListFile = getFileLocation()
if fontListFile == "" then
@@ -302,6 +318,7 @@ fontDataMap = newFontDataMap
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 @@ end
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