texlive[67425] trunk: luafindfont (21jun23)
commits+karl at tug.org
commits+karl at tug.org
Wed Jun 21 22:06:01 CEST 2023
Revision: 67425
http://tug.org/svn/texlive?view=revision&revision=67425
Author: karl
Date: 2023-06-21 22:06:01 +0200 (Wed, 21 Jun 2023)
Log Message:
-----------
luafindfont (21jun23)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
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/README.md
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
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/support/luafindfont/exa01.txt
trunk/Master/texmf-dist/doc/support/luafindfont/exa02.txt
trunk/Master/texmf-dist/doc/support/luafindfont/exa03.txt
trunk/Master/texmf-dist/doc/support/luafindfont/exa04.txt
trunk/Master/texmf-dist/doc/support/luafindfont/exa05.txt
trunk/Master/texmf-dist/doc/support/luafindfont/exa06.txt
Modified: trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,13 +1,14 @@
#!/usr/bin/env texlua
--
+-- $Id: luafindfont.lua 734 2023-06-21 10:04:46Z herbert $
-----------------------------------------------------------------------
-- FILE: luafindfont.lua
-- DESCRIPTION: search for fonts in the database
-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, xindex-lapp
--- AUTHOR: Herbert Voß (C) 2022-09-02
+-- AUTHOR: Herbert Voß (C) 2023-06-21
-----------------------------------------------------------------------
luafindfont = luafindfont or { }
- local version = 0.11
+ local version = 0.12
luafindfont.version = version
--[[
@@ -30,6 +31,8 @@
]]
+-- mtxrun --script font --list --name --all --pattern=times
+
kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
@@ -56,7 +59,7 @@
local i = 1
while i <= #arg do
if arg[i] == "-h" or arg[i] == "--help" then
- print("Version "..version..", Copyright 2021 by Herbert Voß")
+ print("Version "..version..", Copyright 2021-23 by Herbert Voß")
print([[Syntax: luafindfont [options] <font>
By default the Lua program 'luafindfont' creates a list of the
fonts which have in its names the given string.
@@ -358,6 +361,12 @@
end
end
+if #fontList == 0 then
+ print("There are no fonts with the given search name!\n")
+ os.exit()
+end
+
+
-- print(l_max[1],l_max[2],l_max[3])
if l_max[3] > maxStrLength then l_max[3] = maxStrLength end
@@ -387,11 +396,14 @@
if string.len(path) > l_max[3] then
path = string.sub (path, 1, minChars).."..."..string.sub (path, string.len(path)-maxStrLength+minChars+4)
end
- local exrun = io.popen("kpsewhich "..v["basename"],'r')
- if string.len(exrun:read('*all')) > 0 then
- kpsewhich = "1"
- else
+ if args_xetex > 0 then
kpsewhich = "0"
+ local exrun = io.popen("kpsewhich "..v["basename"],'r')
+ if exrun then
+ if string.len(exrun:read('*all')) > 0 then
+ kpsewhich = "1"
+ end
+ end
end
if (font_str ~= "*") and not noSymbolicNames then
if args_xetex > 0 then
@@ -410,40 +422,48 @@
if fontNo > 0 and mtxrun == 0 then
print()
- print("Running otfinfo -"..otfinfo_arg.." on font no."..fontNo)
- local font = fontList[fontNo]["fullpath"]
- print("otfinfo -"..otfinfo_arg.." \""..font.."\"")
- local exrun = io.popen("otfinfo -"..otfinfo_arg.." \""..font.."\"", 'r') -- ".." font may have spaces
- local output = exrun:read('*all')
- print(output)
- exrun:close()
+ if fontNo > #fontList then
+ print("given font number is greater than the number of the fontlist!")
+ else
+ print("Running otfinfo -"..otfinfo_arg.." on font no."..fontNo)
+ local font = fontList[fontNo]["fullpath"]
+ print("otfinfo -"..otfinfo_arg.." \""..font.."\"")
+ local exrun = io.popen("otfinfo -"..otfinfo_arg.." \""..font.."\"", 'r') -- ".." font may have spaces
+ local output = exrun:read('*all')
+ print(output)
+ exrun:close()
+ end
end
if info > 0 then
- font = fontList[info]["familyname"]
- print("\nFont: "..font)
- local font_dir = {"local","system","texmf"}
- local font_ext = {"ttf","otf","ttc"}
- for j = 1,#font_dir do
- for i = 1,#font_ext do
- local fonttype = ""
- local ext = font_ext[i]
- local dir = font_dir[j]
- if fontData["families"][dir][ext] then -- font extension exists?
- local entry = fontData["families"][dir][ext][font]
- if entry then
- if entry["r"] then fonttype = fonttype.."Regular " end
- if entry["b"] then fonttype = fonttype.."| Bold " end
- if entry["i"] then fonttype = fonttype.."| Italic " end
- if entry["bi"] then fonttype = fonttype.."| BoldItalic" end
- io.write("Fonttype "..ext.."("..dir..") --> ")
- if #fonttype > 0 then
- print("| "..fonttype.." |")
+ if info > #fontList then
+ print("given font number is greater than the number of the fontlist!")
+ else
+ font = fontList[info]["familyname"]
+ print("\nFont: "..font)
+ local font_dir = {"local","system","texmf"}
+ local font_ext = {"ttf","otf","ttc"}
+ for j = 1,#font_dir do
+ for i = 1,#font_ext do
+ local fonttype = ""
+ local ext = font_ext[i]
+ local dir = font_dir[j]
+ if fontData["families"][dir][ext] then -- font extension exists?
+ local entry = fontData["families"][dir][ext][font]
+ if entry then
+ if entry["r"] then fonttype = fonttype.."Regular " end
+ if entry["b"] then fonttype = fonttype.."| Bold " end
+ if entry["i"] then fonttype = fonttype.."| Italic " end
+ if entry["bi"] then fonttype = fonttype.."| BoldItalic" end
+ io.write("Fonttype "..ext.."("..dir..") --> ")
+ if #fonttype > 0 then
+ print("| "..fonttype.." |")
+ else
+ print(" undefined ") --- no regular definiert
+ end
else
- print(" undefined ") --- no regular definiert
+ print()
end
- else
- print()
end
end
end
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 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/CHANGELOG 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,3 +1,6 @@
+0.12 2023-06-21 - bugfix for undefined exrun (l. 251)
+ - check for empty font list and given font number
+ - print a message if no fonts for given (partial) name exists
0.11 2022-11-03 - added option -V (--version) and -I (--Info),
-I uses mtxrun for a long list of features,
corresponding languages and font names
Modified: trunk/Master/texmf-dist/doc/support/luafindfont/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/README.md 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/README.md 2023-06-21 20:06:01 UTC (rev 67425)
@@ -12,15 +12,13 @@
parameter handling
- -h,--help
-- -n,--nosymbolicnames
-- ,--no-symbolic-names
- -o,--otfinfo (default 0)
- -i,--info (default 0)
-- -I,--Info (default 0)
-- -x, --xetex
-- -v, --verbose
-- -V, --version
+- -I,--info (default 0) with mtxrun
+- -x,--xetex
+- -v,--verbose
- -m,--max_string (default 90)
+- -n,--nosymbolicnames
- <font> (string)
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa01.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa01.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa01.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,11 +0,0 @@
-We are using Lua 5.3
-Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
- 1. Segoe UI Symbol.ttf segoeuisymbol /Users/voss/Library/Fonts/Segoe/Segoe UI Symbol.ttf
- 2. Segoe_Print.ttf segoeprint /Users/voss/Library/Fonts/Segoe/Segoe_Print.ttf
- 3. Segoe_Print_Bold.ttf segoeprint /Users/voss/Library/Fonts/Segoe/Segoe_Print_Bold.ttf
- 4. Segoe_Script.ttf segoescript /Users/voss/Library/Fonts/Segoe/Segoe_Script.ttf
- 5. Segoe_Script_Bold.ttf segoescript /Users/voss/Library/Fonts/Segoe/Segoe_Script_Bold.ttf
- 6. Segoe_UI.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI.ttf
- 7. Segoe_UI_Bold.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Bold.ttf
- 8. Segoe_UI_Bold_Italic.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Bold_Italic.ttf
- 9. Segoe_UI_Italic.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Italic.ttf
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa02.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa02.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa02.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,16 +0,0 @@
-We are using Lua 5.3
-Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
- 1. LibertinusKeyboard-Regular.otf libertinuskeyboard /usr/local/texlive/2021/te...Regular.otf
- 2. LibertinusMath-Regular.otf libertinusmath /usr/local/texlive/2021/te...Regular.otf
- 3. LibertinusMono-Regular.otf libertinusmono /usr/local/texlive/2021/te...Regular.otf
- 4. LibertinusSans-Bold.otf libertinussans /usr/local/texlive/2021/te...ns-Bold.otf
- 5. LibertinusSans-Italic.otf libertinussans /usr/local/texlive/2021/te...-Italic.otf
- 6. LibertinusSans-Regular.otf libertinussans /usr/local/texlive/2021/te...Regular.otf
- 7. LibertinusSerif-Bold.otf libertinusserif /usr/local/texlive/2021/te...if-Bold.otf
- 8. LibertinusSerif-BoldItalic.otf libertinusserif /usr/local/texlive/2021/te...dItalic.otf
- 9. LibertinusSerif-Italic.otf libertinusserif /usr/local/texlive/2021/te...-Italic.otf
-10. LibertinusSerif-Regular.otf libertinusserif /usr/local/texlive/2021/te...Regular.otf
-11. LibertinusSerif-Semibold.otf libertinusserif /usr/local/texlive/2021/te...emibold.otf
-12. LibertinusSerif-SemiboldItalic.otf libertinusserif /usr/local/texlive/2021/te...dItalic.otf
-13. LibertinusSerifDisplay-Regular.otf libertinusserifdisplay /usr/local/texlive/2021/te...Regular.otf
-14. LibertinusSerifInitials-Regular.otf libertinusserifinitials /usr/local/texlive/2021/te...Regular.otf
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa03.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa03.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa03.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,34 +0,0 @@
-We are using Lua 5.3
-Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
- 1. Arial Black.ttf arialblack /System/Library/Fonts/Supplemental/Arial Black.ttf
- 2. Arial Bold Italic.ttf arial /System/Library/Fonts/Supplemental/Arial Bold Italic.ttf
- 3. Arial Bold.ttf arial /System/Library/Fonts/Supplemental/Arial Bold.ttf
- 4. Arial Italic.ttf arial /System/Library/Fonts/Supplemental/Arial Italic.ttf
- 5. Arial Narrow Bold Italic.ttf arialnarrow /System/Library/Fonts/Supplemental/Arial Narrow Bold Italic.ttf
- 6. Arial Narrow Bold.ttf arialnarrow /System/Library/Fonts/Supplemental/Arial Narrow Bold.ttf
- 7. Arial Narrow Italic.ttf arialnarrow /System/Library/Fonts/Supplemental/Arial Narrow Italic.ttf
- 8. Arial Narrow.ttf arialnarrow /System/Library/Fonts/Supplemental/Arial Narrow.ttf
- 9. Arial Rounded Bold.ttf arialroundedmtbold /System/Library/Fonts/Supplemental/Arial Rounded Bold.ttf
-10. Arial Unicode.ttf arialunicodems /Library/Fonts/Arial Unicode.ttf
-11. Arial Unicode.ttf arialunicodems /System/Library/Fonts/Supplemental/Arial Unicode.ttf
-12. Arial.ttf arial /System/Library/Fonts/Supplemental/Arial.ttf
-13. Arial.ttf arial /Users/voss/Library/Fonts/Arial/Arial.ttf
-14. ArialHB.ttc arialhebrew /System/Library/Fonts/ArialHB.ttc
-15. ArialHB.ttc arialhebrewdeskinterface /System/Library/Fonts/ArialHB.ttc
-16. ArialHB.ttc arialhebrewscholar /System/Library/Fonts/ArialHB.ttc
-17. ArialHB.ttc arialhebrew /System/Library/Fonts/ArialHB.ttc
-
-Run otfinfo:6
-Family: Arial Narrow
-Subfamily: Bold
-Full name: Arial Narrow Bold
-PostScript name: ArialNarrow-Bold
-Version: Version 2.38.1x
-Unique ID: Arial Narrow Bold : 2007
-Description: Monotype Drawing Office 1982. A contemporary sans serif design, Arial contains more humanist characteristics than many of its predecessors and as such is more in tune with the mood of the last decades of the twentieth century. The overall treatment of curves is softer and fuller than in most industrial-style sans serif faces. Terminal strokes are cut on the diagonal which helps to give the face a less mechanical appearance. Arial is an extremely versatile family of typefaces which can be used with equal success for text setting in reports, presentations, magazines etc, and for display use in newspapers, advertising and promotions.
-Designer: Robin Nicholas, Patricia Saunders
-Manufacturer: The Monotype Corporation
-Trademark: Arial is a trademark of The Monotype Corporation in the United States and/or other countries.
-Copyright: © 2007 The Monotype Corporation. All Rights Reserved.
-License Description: You may use this font to display and print content as permitted by the license terms for the product in which this font is included. You may only (i) embed this font in content as permitted by the embedding restrictions included in this font; and (ii) temporarily download this font to a printer or other output device to help print content.
-Vendor ID: TMC
\ No newline at end of file
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa04.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa04.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa04.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,14 +0,0 @@
-We are using Lua 5.3
-Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
- 1. Segoe UI Symbol.ttf segoeuisymbol /Users/voss/Library/Fonts/Segoe/Segoe UI Symbol.ttf
- 2. Segoe_Print.ttf segoeprint /Users/voss/Library/Fonts/Segoe/Segoe_Print.ttf
- 3. Segoe_Print_Bold.ttf segoeprint /Users/voss/Library/Fonts/Segoe/Segoe_Print_Bold.ttf
- 4. Segoe_Script.ttf segoescript /Users/voss/Library/Fonts/Segoe/Segoe_Script.ttf
- 5. Segoe_Script_Bold.ttf segoescript /Users/voss/Library/Fonts/Segoe/Segoe_Script_Bold.ttf
- 6. Segoe_UI.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI.ttf
- 7. Segoe_UI_Bold.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Bold.ttf
- 8. Segoe_UI_Bold_Italic.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Bold_Italic.ttf
- 9. Segoe_UI_Italic.ttf segoeui /Users/voss/Library/Fonts/Segoe/Segoe_UI_Italic.ttf
-
-Font: segoeui
-Fonttype ttf(system) --> | Regular | Bold | Italic | BoldItalic |
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa05.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa05.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa05.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,26 +0,0 @@
-Looking for font "*"
- Nr. Filename Path
- 1. Aboensis-Regular.otf /usr/local/texlive/texmf-dist/fonts/opentype/public/aboensis/
- 2. academicons.ttf /usr/local/texlive/texmf-dist/fonts/truetype/public/academicons/
- 3. Academy Engraved LET Fonts.ttf /System/Library/Fonts/Supplemental/
- 4. ACaslonPro-Bold.otf /Users/voss/Library/Fonts/Caslon/
- 5. ACaslonPro-BoldItalic.otf /Users/voss/Library/Fonts/Caslon/
- 6. ACaslonPro-Italic.otf /Users/voss/Library/Fonts/Caslon/
- 7. ACaslonPro-Regular.otf /Users/voss/Library/Fonts/Caslon/
- 8. ACaslonPro-Semibold.otf /Users/voss/Library/Fonts/Caslon/
- 9. ACaslonPro-SemiboldItalic.otf /Users/voss/Library/Fonts/Caslon/
- 10. Acathist-Regular.otf /usr/local/texlive/texmf-dist/fonts/opentype/public/fonts-churchslavonic/
- 11. AccanthisADFStdNo3-Bold.otf /usr/local/texlive/texmf-dist/fonts/opentype/arkandis/accanthis/
- 12. AccanthisADFStdNo3-BoldItalic.otf /usr/local/texlive/texmf-dist/fonts/opentype/arkandis/accanthis/
- 13. AccanthisADFStdNo3-Italic.otf /usr/local/texlive/texmf-dist/fonts/opentype/arkandis/accanthis/
- 14. AccanthisADFStdNo3-Regular.otf /usr/local/texlive/texmf-dist/fonts/opentype/arkandis/accanthis/
- 15. ACE.ttc /Users/voss/Library/Fonts/AppleSymbols/
- 16. ACE.ttc /Users/voss/Library/Fonts/AppleSymbols/
- 17. AdineKirnberg-Script.otf /Users/voss/Library/Fonts/AdineScript/
- 18. AdobeArabic-Bold.otf /Users/voss/Library/Fonts/Adobe/
- 19. AdobeArabic-BoldItalic.otf /Users/voss/Library/Fonts/Adobe/
-[...] [...] [...]
-6847. 儷宋_Pro.ttf /Users/voss/Library/Fonts/KozukaPro/
-6848. 华文仿宋.ttf /Users/voss/Library/Fonts/KozukaPro/
-6849. 华文宋体.ttf /Users/voss/Library/Fonts/KozukaPro/
-6850. 华文楷体.ttf /Users/voss/Library/Fonts/KozukaPro/
Deleted: trunk/Master/texmf-dist/doc/support/luafindfont/exa06.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/luafindfont/exa06.txt 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/exa06.txt 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,19 +0,0 @@
-We are using Lua 5.3
-Looking for font "minion"
-Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
- Nr. Fontname Path
- 1. MinionMath-Bold.otf /Users/voss/Library/Fonts/MinionMath/
- 2. MinionMath-Regular.otf /Users/voss/Library/Fonts/MinionMath/
- 3. MinionPro-Bold.otf /Users/voss/Library/Fonts/MinionPro/
- 4. MinionPro-BoldCn.otf /Users/voss/Library/Fonts/MinionPro/
- 5. MinionPro-BoldCnIt.otf /Users/voss/Library/Fonts/MinionPro/
- 6. MinionPro-BoldIt.otf /Users/voss/Library/Fonts/MinionPro/
- 7. MinionPro-Capt.otf /Users/voss/Library/Fonts/MinionPro/
- 8. MinionPro-Disp.otf /Users/voss/Library/Fonts/MinionPro/
- 9. MinionPro-It.otf /Users/voss/Library/Fonts/MinionPro/
- 10. MinionPro-Medium.otf /Users/voss/Library/Fonts/MinionPro/
- 11. MinionPro-MediumIt.otf /Users/voss/Library/Fonts/MinionPro/
- 12. MinionPro-Regular.otf /Users/voss/Library/Fonts/MinionPro/
- 13. MinionPro-Semibold.otf /Users/voss/Library/Fonts/MinionPro/
- 14. MinionPro-SemiboldIt.otf /Users/voss/Library/Fonts/MinionPro/
- 15. MinionPro-Subh.otf /Users/voss/Library/Fonts/MinionPro/
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 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,4 +1,4 @@
- %% $Id: luafindfont-doc.tex 599 2022-09-02 09:48:32Z herbert $
+ %% $Id: luafindfont-doc.tex 648 2022-11-03 19:58:48Z herbert $
%
\listfiles\setcounter{errorcontextlines}{100}
\documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
Modified: trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua 2023-06-21 18:29:23 UTC (rev 67424)
+++ trunk/Master/texmf-dist/scripts/luafindfont/luafindfont.lua 2023-06-21 20:06:01 UTC (rev 67425)
@@ -1,13 +1,14 @@
#!/usr/bin/env texlua
--
+-- $Id: luafindfont.lua 734 2023-06-21 10:04:46Z herbert $
-----------------------------------------------------------------------
-- FILE: luafindfont.lua
-- DESCRIPTION: search for fonts in the database
-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, xindex-lapp
--- AUTHOR: Herbert Voß (C) 2022-09-02
+-- AUTHOR: Herbert Voß (C) 2023-06-21
-----------------------------------------------------------------------
luafindfont = luafindfont or { }
- local version = 0.11
+ local version = 0.12
luafindfont.version = version
--[[
@@ -30,6 +31,8 @@
]]
+-- mtxrun --script font --list --name --all --pattern=times
+
kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
@@ -56,7 +59,7 @@
local i = 1
while i <= #arg do
if arg[i] == "-h" or arg[i] == "--help" then
- print("Version "..version..", Copyright 2021 by Herbert Voß")
+ print("Version "..version..", Copyright 2021-23 by Herbert Voß")
print([[Syntax: luafindfont [options] <font>
By default the Lua program 'luafindfont' creates a list of the
fonts which have in its names the given string.
@@ -358,6 +361,12 @@
end
end
+if #fontList == 0 then
+ print("There are no fonts with the given search name!\n")
+ os.exit()
+end
+
+
-- print(l_max[1],l_max[2],l_max[3])
if l_max[3] > maxStrLength then l_max[3] = maxStrLength end
@@ -387,11 +396,14 @@
if string.len(path) > l_max[3] then
path = string.sub (path, 1, minChars).."..."..string.sub (path, string.len(path)-maxStrLength+minChars+4)
end
- local exrun = io.popen("kpsewhich "..v["basename"],'r')
- if string.len(exrun:read('*all')) > 0 then
- kpsewhich = "1"
- else
+ if args_xetex > 0 then
kpsewhich = "0"
+ local exrun = io.popen("kpsewhich "..v["basename"],'r')
+ if exrun then
+ if string.len(exrun:read('*all')) > 0 then
+ kpsewhich = "1"
+ end
+ end
end
if (font_str ~= "*") and not noSymbolicNames then
if args_xetex > 0 then
@@ -410,40 +422,48 @@
if fontNo > 0 and mtxrun == 0 then
print()
- print("Running otfinfo -"..otfinfo_arg.." on font no."..fontNo)
- local font = fontList[fontNo]["fullpath"]
- print("otfinfo -"..otfinfo_arg.." \""..font.."\"")
- local exrun = io.popen("otfinfo -"..otfinfo_arg.." \""..font.."\"", 'r') -- ".." font may have spaces
- local output = exrun:read('*all')
- print(output)
- exrun:close()
+ if fontNo > #fontList then
+ print("given font number is greater than the number of the fontlist!")
+ else
+ print("Running otfinfo -"..otfinfo_arg.." on font no."..fontNo)
+ local font = fontList[fontNo]["fullpath"]
+ print("otfinfo -"..otfinfo_arg.." \""..font.."\"")
+ local exrun = io.popen("otfinfo -"..otfinfo_arg.." \""..font.."\"", 'r') -- ".." font may have spaces
+ local output = exrun:read('*all')
+ print(output)
+ exrun:close()
+ end
end
if info > 0 then
- font = fontList[info]["familyname"]
- print("\nFont: "..font)
- local font_dir = {"local","system","texmf"}
- local font_ext = {"ttf","otf","ttc"}
- for j = 1,#font_dir do
- for i = 1,#font_ext do
- local fonttype = ""
- local ext = font_ext[i]
- local dir = font_dir[j]
- if fontData["families"][dir][ext] then -- font extension exists?
- local entry = fontData["families"][dir][ext][font]
- if entry then
- if entry["r"] then fonttype = fonttype.."Regular " end
- if entry["b"] then fonttype = fonttype.."| Bold " end
- if entry["i"] then fonttype = fonttype.."| Italic " end
- if entry["bi"] then fonttype = fonttype.."| BoldItalic" end
- io.write("Fonttype "..ext.."("..dir..") --> ")
- if #fonttype > 0 then
- print("| "..fonttype.." |")
+ if info > #fontList then
+ print("given font number is greater than the number of the fontlist!")
+ else
+ font = fontList[info]["familyname"]
+ print("\nFont: "..font)
+ local font_dir = {"local","system","texmf"}
+ local font_ext = {"ttf","otf","ttc"}
+ for j = 1,#font_dir do
+ for i = 1,#font_ext do
+ local fonttype = ""
+ local ext = font_ext[i]
+ local dir = font_dir[j]
+ if fontData["families"][dir][ext] then -- font extension exists?
+ local entry = fontData["families"][dir][ext][font]
+ if entry then
+ if entry["r"] then fonttype = fonttype.."Regular " end
+ if entry["b"] then fonttype = fonttype.."| Bold " end
+ if entry["i"] then fonttype = fonttype.."| Italic " end
+ if entry["bi"] then fonttype = fonttype.."| BoldItalic" end
+ io.write("Fonttype "..ext.."("..dir..") --> ")
+ if #fonttype > 0 then
+ print("| "..fonttype.." |")
+ else
+ print(" undefined ") --- no regular definiert
+ end
else
- print(" undefined ") --- no regular definiert
+ print()
end
- else
- print()
end
end
end
More information about the tex-live-commits
mailing list.