diff options
author | Karl Berry <karl@freefriends.org> | 2023-06-21 20:06:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-06-21 20:06:01 +0000 |
commit | b8c4de69436d412f854b482d38c0157db6662f87 (patch) | |
tree | 02a2416f040c0d9e73c7daf128322a2e0026740e | |
parent | b57eecd952753ae25249997a06cc461eb9309966 (diff) |
luafindfont (21jun23)
git-svn-id: svn://tug.org/texlive/trunk@67425 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua | 92 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf | bin | 24218 -> 24217 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/CHANGELOG | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/README.md | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa01.txt | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa02.txt | 16 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa03.txt | 34 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa04.txt | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa05.txt | 26 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/exa06.txt | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf | bin | 98556 -> 98679 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/luafindfont/luafindfont.lua | 92 |
13 files changed, 120 insertions, 199 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua index bf1804db021..54a507c452d 100755 --- a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua +++ b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua @@ -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 @@ Report bugs to hvoss@tug.org ]] +-- 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 fontNo = 0 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 @@ for i, v in ipairs(fontDataMap) do 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 @@ for i, v in ipairs(fontList) do 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 @@ end 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 diff --git a/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf b/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf Binary files differindex a6e47af6670..b5a21e249bd 100644 --- a/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf diff --git a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG index 9c2bf6debf4..0e987a1623c 100644 --- a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG +++ b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG @@ -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 diff --git a/Master/texmf-dist/doc/support/luafindfont/README.md b/Master/texmf-dist/doc/support/luafindfont/README.md index 90229178e43..ec1cd02b73a 100644 --- a/Master/texmf-dist/doc/support/luafindfont/README.md +++ b/Master/texmf-dist/doc/support/luafindfont/README.md @@ -12,15 +12,13 @@ luafindfont [options] <font name> 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) diff --git a/Master/texmf-dist/doc/support/luafindfont/exa01.txt b/Master/texmf-dist/doc/support/luafindfont/exa01.txt deleted file mode 100644 index e530f26082d..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa01.txt +++ /dev/null @@ -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 diff --git a/Master/texmf-dist/doc/support/luafindfont/exa02.txt b/Master/texmf-dist/doc/support/luafindfont/exa02.txt deleted file mode 100644 index 8c113341de4..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa02.txt +++ /dev/null @@ -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 diff --git a/Master/texmf-dist/doc/support/luafindfont/exa03.txt b/Master/texmf-dist/doc/support/luafindfont/exa03.txt deleted file mode 100644 index 2bb02df1a6a..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa03.txt +++ /dev/null @@ -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 diff --git a/Master/texmf-dist/doc/support/luafindfont/exa04.txt b/Master/texmf-dist/doc/support/luafindfont/exa04.txt deleted file mode 100644 index 5de45e30c6a..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa04.txt +++ /dev/null @@ -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 | diff --git a/Master/texmf-dist/doc/support/luafindfont/exa05.txt b/Master/texmf-dist/doc/support/luafindfont/exa05.txt deleted file mode 100644 index d2353f923d6..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa05.txt +++ /dev/null @@ -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/ diff --git a/Master/texmf-dist/doc/support/luafindfont/exa06.txt b/Master/texmf-dist/doc/support/luafindfont/exa06.txt deleted file mode 100644 index c076ffffd3d..00000000000 --- a/Master/texmf-dist/doc/support/luafindfont/exa06.txt +++ /dev/null @@ -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/ 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 80155cf2bd9..919145bd966 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 259af15f038..c10483ce5a2 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 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-, diff --git a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua index bf1804db021..54a507c452d 100755 --- a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua +++ b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua @@ -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 @@ Report bugs to hvoss@tug.org ]] +-- 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 fontNo = 0 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 @@ for i, v in ipairs(fontDataMap) do 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 @@ for i, v in ipairs(fontList) do 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 @@ end 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 |