summaryrefslogtreecommitdiff
path: root/Build
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 /Build
parent6fd01e0e4194d0b6c992167beeaf13f858f295a4 (diff)
luafindfont (8may22)
git-svn-id: svn://tug.org/texlive/trunk@63265 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua99
1 files changed, 58 insertions, 41 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