summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-12-05 21:11:40 +0000
committerKarl Berry <karl@freefriends.org>2021-12-05 21:11:40 +0000
commitc091f43a4cd6251af7cabd727950966d21b9d3d3 (patch)
tree3776625774bc4146f98ed7ca197c9ffd661186e8 /Master
parentc802f5243c81026d07599e4a0c4eda0c6439a677 (diff)
luafindfont (5dec21)
git-svn-id: svn://tug.org/texlive/trunk@61224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/man/man1/luafindfont.113
-rw-r--r--Master/texmf-dist/doc/man/man1/luafindfont.man1.pdfbin24597 -> 25666 bytes
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/CHANGELOG3
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/README.md2
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdfbin63280 -> 81195 bytes
-rw-r--r--Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.tex134
-rwxr-xr-xMaster/texmf-dist/scripts/luafindfont/luafindfont.lua47
7 files changed, 161 insertions, 38 deletions
diff --git a/Master/texmf-dist/doc/man/man1/luafindfont.1 b/Master/texmf-dist/doc/man/man1/luafindfont.1
index e2c684ed0b0..61bd90fd279 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 "29 nov 2021" "0.04" "luafindfont man page"
+.TH luafindfont 1 "04 dec 2021" "0.05" "luafindfont man page"
.SH NAME
luafindfont
\- retrieve font informations of all installed system and TeX fonts.
@@ -13,7 +13,10 @@ installed by the system and by the TeX distribution
.IP -h,--help
obvious ... :-)
.IP -o,--otfinfo (default 0)
-Use the program otfinfo for the font with the given number
+Use the program otfinfo for the font with the given number. The number
+can be followed by an optional argument for otfinfo, e.g. -o 2f, list
+all features for font no 2. Without an additional character, otfinfo is
+called with -i
.IP -i,--info (default 0)
List the given fontstyles (regular, bold, italic, bolditalic)
for the font with the given number
@@ -23,6 +26,10 @@ Give more informations, by now only -v works
The maximum of the stringlength of the full path of fonts
.IP -n,--nosymbolicnames
The fontlist contains only fontfile and fontpath
+.IP <fontname>
+Can be a substring, e.g. times, or a combination of two substrings
+which act like a boolean and, e.g. "times & bold" (must be in quotes).
+All strings are not case sensitive. Upper and lowercase can be mixed.
.SH EXAMPLES
$ luafindfont libertinssans
@@ -90,7 +97,7 @@ This produces the following output:
.nf
.ft CW
-bash-3.2$ ./luafindfont.lua -n minion
+bash-3.2$ luafindfont -n minion
We are using Lua 5.3
Check for file /usr/local/texlive/texmf-var/luatex-cache/generic/names/luaotfload-names
Nr. Fontname Path
diff --git a/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf b/Master/texmf-dist/doc/man/man1/luafindfont.man1.pdf
index d9a57f59352..842957b750a 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 9f6e801161a..8adced619b7 100644
--- a/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
+++ b/Master/texmf-dist/doc/support/luafindfont/CHANGELOG
@@ -1,3 +1,6 @@
+0.05 2021-12-04 - use always lowercase for internal search
+ - allow combined search like "times & bold"
+ - allow additional argument for otfinfo
0.04 2021-11-29 - rename the lua file to luafindfont
- do not use xindex-lapp, handle the options by
standard arg field
diff --git a/Master/texmf-dist/doc/support/luafindfont/README.md b/Master/texmf-dist/doc/support/luafindfont/README.md
index 1148ac3b78a..f16decd3a2c 100644
--- a/Master/texmf-dist/doc/support/luafindfont/README.md
+++ b/Master/texmf-dist/doc/support/luafindfont/README.md
@@ -28,7 +28,7 @@ parameter handling
-luafindfont -i 3 -m 50 arial
```
-## copyright
+## Copyright
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
diff --git a/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf b/Master/texmf-dist/doc/support/luafindfont/luafindfont-doc.pdf
index 79608402a1b..db4780bcb1a 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 b051447e549..0e1b4360f17 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: findfont-doc.tex 16 2021-11-07 19:42:57Z hvoss $
+ %% $Id: luafindfont-doc.tex 341 2021-12-05 10:38:08Z herbert $
%
\listfiles\setcounter{errorcontextlines}{100}
\documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
@@ -77,7 +77,7 @@
\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}}
-\setVersion{version = 0.04}% can be automatically changed by perl
+\setVersion{version = 0.05}% can be automatically changed by perl
\setkeys{dtk}{cleanup=true,force}
@@ -92,6 +92,7 @@
\vfill
Thanks to: \\
+Gerhard Bachmaier;
Rolf Niepraschk;
\clearpage
@@ -100,9 +101,9 @@ The Lua program
\FF is a program for searching installed fonts which are usable for \LuaLaTeX\ and \XeLaTeX.
The already existing Lua program \Lprog{luaotfload-tool} can also be used for searching, but
the search-interface is somewhat cryptic and too complex for a user, who wants only to know
-if a font is present or not. And if present, wher can it be found. For example:
+if a font is present or not. And if present, where can it be found. For example:
-\begin{verbatim}
+\begin{Verbatim}[frame=lines,label=luaotfload-tool]
H-MacBook:~ voss$
H-MacBook:~ voss$ luaotfload-tool --find=times
luaotfload | resolve : Font "times" found!
@@ -112,13 +113,13 @@ H-MacBook:~ voss$ luaotfload-tool --fuzzy --find="times new roman"
luaotfload | resolve : Font "times new roman" found!
luaotfload | resolve : Resolved file name "/System/Library/Fonts/Supplemental/Times New Roman.ttf"
H-MacBook:~ voss$
-\end{verbatim}
+\end{Verbatim}
-But this are not \emph{all} Times fonts. Compare it with the output of \Lprog{luafindfont},
+But that are not \emph{all} Times fonts. Compare it with the output of \Lprog{luafindfont},
where the searchname \emph{times} must only be a part of a longer name:
-\begin{verbatim}
-bash-3.2$ ./luafindfont.lua times
+\begin{Verbatim}[frame=lines,label=luafindfont times]
+bash-3.2$ luafindfont times
We are using Lua 5.3
Check for file /usr/local/texlive/texmf-var/luatex-cache/generic/names/luaotfload-names
Nr. Fontname Symbolic Name Path
@@ -146,7 +147,9 @@ Check for file /usr/local/texlive/texmf-var/luatex-cache/generic/names/luaotfloa
22. TimesNewRomanPSStd-BoldIt.otf timesnewromanpsstd /Users/voss/Library/Fonts/Times/
23. TimesNewRomanPSStd-Italic.otf timesnewromanpsstd /Users/voss/Library/Fonts/Times/
24. TimesNewRomanPSStd-Regular.otf timesnewromanpsstd /Users/voss/Library/Fonts/Times/
-\end{verbatim}
+\end{Verbatim}
+
+%$
\subsection{Syntax}
@@ -158,9 +161,8 @@ The \Index{syntax} is
where \verb|[...]| are optional \Index{argument}s, either in short or
long form which, of course, can be mixed:
-\begin{verbatim}
+\begin{Verbatim}[frame=lines,label=Parameter]
parameter handling
- -q,--quiet
-h,--help
-o,--otfinfo (default 0)
-i,--info (default 0)
@@ -168,7 +170,7 @@ long form which, of course, can be mixed:
-v... Verbosity output
-m,--max_string (default 90)
<font> (string)
-\end{verbatim}
+\end{Verbatim}
For example:
@@ -179,12 +181,12 @@ luafindfont -i 3 -m 50 arial
\end{verbatim}
\begin{enumerate}
-\item \texttt{-q}: quiet;
\item \texttt{-m <columns>}: How many columns are used for the font with full path. This can be really long, but with e.g. \verb|-m 50|
-the length is limited to 50 characters.
-\item \texttt{-o <number>}: For the font with the given number from the font list the program \Lprog{otfinfo} is called
- for some generell font informations.
-\item \texttt{-i <number>}: For the font with the given number from the font list the existing font styles are listed.
+the length is limited to 50 characters and in the middle of the long name there will be \ldots, representing the missing characters.
+\item \texttt{-o <number[character]>}: For the font with the given number from the font list the program \Lprog{otfinfo} is called
+ for some generell font informations. An additional optional argument for \Lprog{otfinfo} (only one character) must follow directly the fontnumber
+ (see also section~\ref{otfinfo})
+\item \texttt{-i <number>}: For the font with the given number from the font list the existing other corresponding font styles are listed.
\end{enumerate}
\section{How it works}
@@ -193,6 +195,104 @@ missing it will be created by \FF itself. The name of the font should be in lowe
characters and must not be the complete name. A \verb|time| for finding all fonts with
time in its names is sufficiant.
+
+\subsection{Fontname}
+The fontname can only be a substring of the complete filename. It is not case sensitive, \texttt{Myriad} and \texttt{myriad}
+are the same. It is possible to combine two search strings which will act like a boolean \texttt{and}. A search with
+\texttt{"Myriad \& bold"} (in quotes) will list all files which have \texttt{myriad} \emph{and} \texttt{bold} in its name.
+
+
+\subsection{Option \texttt{-o}}\label{otfinfo}
+This needs an installed program \Lprog{otfinfo}, which should be the default for all \TeX\ distributions.
+This program lists some useful informations of a given fontnumber. The fontnumber can be combined by an
+additional character for different outputs. For example \texttt{-o 2f} lists the features of the font number 2
+in the list. The order makes no difference: \texttt{-o f2} prints the same. If there is no output then the font has no such
+informations defined!
+
+The possible options are (i is the default):
+
+\begin{Verbatim}[frame=lines,label=otfinfo]
+ s Report font’s supported scripts.
+ f Report font’s GSUB/GPOS features.
+ z Report font’s optical size information.
+ p Report font’s PostScript name.
+ a Report font’s family name.
+ v Report font’s version information.
+ i Report font’s names and designer/vendor info.
+ g Report font’s glyph names.
+ t Report font’s OpenType tables.
+\end{Verbatim}
+
+
+\begin{Verbatim}[frame=lines,label=luafindfont -o 2f "myriad \& semibold"]
+bash-3.2$ luafindfont -o 2f "myriad & semibold"
+We are using Lua 5.3
+Looking for font "myriad & semibold"
+Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
+ No. Fontname Symbolic Name Path
+ 1. MyriadPro-Semibold.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 2. MyriadPro-SemiboldCond.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 3. MyriadPro-SemiboldCondIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 4. MyriadPro-SemiboldIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 5. MyriadPro-SemiboldSemiCn.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 6. MyriadPro-SemiboldSemiCnIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 7. MyriadPro-SemiboldSemiExt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 8. MyriadPro-SemiboldSemiExtIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+
+Run otfinfo -f: 2
+otfinfo -f "/Users/voss/Library/Fonts/MyriadPro/MyriadPro-SemiboldCond.otf"
+aalt Access All Alternates
+case Case-Sensitive Forms
+cpsp Capital Spacing
+dnom Denominators
+fina Terminal Forms
+frac Fractions
+kern Kerning
+liga Standard Ligatures
+lnum Lining Figures
+numr Numerators
+onum Oldstyle Figures
+ordn Ordinals
+pnum Proportional Figures
+sinf Scientific Inferiors
+sups Superscript
+tnum Tabular Figures
+zero Slashed Zero
+\end{Verbatim}
+
+if no parameter is given, then \texttt{-i} is assumed.
+
+
+\subsection{Option \texttt{-i}}
+For a given font number \texttt{luafindfont} will list the font styles which were found by the font search
+and which correspond to the font number. This is useful if a fontname doesn't has the style in its name or
+only in short form.
+
+\begin{Verbatim}[frame=lines,label=luafindfont -i 4 "myriad \& semibold"]
+bash-3.2$ luafindfont -i 4 "myriad & semibold"
+We are using Lua 5.3
+Looking for font "myriad & semibold"
+Check for file /usr/local/texlive/2021/texmf-var/luatex-cache/generic/names/luaotfload-names
+ No. Fontname Symbolic Name Path
+ 1. MyriadPro-Semibold.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 2. MyriadPro-SemiboldCond.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 3. MyriadPro-SemiboldCondIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 4. MyriadPro-SemiboldIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 5. MyriadPro-SemiboldSemiCn.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 6. MyriadPro-SemiboldSemiCnIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 7. MyriadPro-SemiboldSemiExt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+ 8. MyriadPro-SemiboldSemiExtIt.otf myriadpro /Users/voss/Library/Fonts/MyriadPro/
+
+Font: myriadpro
+
+Fonttype otf(system) --> | Regular | Bold | Italic | BoldItalic |
+\end{Verbatim}
+
+For the font number 4 there also exists a Regular, Bold, and a Italic font. The font no 4 itself
+is a BoldItalic version.
+
+
+
\section{Examples}
\begin{Verbatim}
diff --git a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
index cad6ee4044c..fc7a6b6577e 100755
--- a/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
+++ b/Master/texmf-dist/scripts/luafindfont/luafindfont.lua
@@ -8,7 +8,7 @@
-- AUTHOR: Herbert Voß (C) 2021-11-27
-----------------------------------------------------------------------
luafindfont = luafindfont or { }
- local version = 0.04
+ local version = 0.05
luafindfont.version = version
--[[
@@ -48,6 +48,9 @@ local args_otfinfo = 0
local args_info = 0
local args_max_string = 90
+local otfinfo_arg
+local fontNo = 0
+
local i = 1
while i <= #arg do
if arg[i] == "-h" or arg[i] == "--help" then
@@ -69,14 +72,18 @@ while i <= #arg do
elseif arg[i] == "-n" or arg[i] == "--nosymbolicnames" then
args_nosymbolicnames = 1
elseif arg[i] == "-o" or arg[i] == "--otfinfo" then
- local fontNr = tonumber(arg[i+1])
- if fontNr then
- args_otfinfo = fontNr
- i = i + 1
- else
- print("Option -o needs a following fontnumber!")
- args_otfinfo = 0
+ local o_arg = arg[i+1]
+ otfinfo_arg = "i"
+ fontNo = tonumber(o_arg)
+ if not fontNo then -- combination: No and Arg
+ fontNo = tonumber(string.match(o_arg,"%d+"))
+ otfinfo_arg = string.match(o_arg,"%a+")
+ if not fontNo then
+ print("Option -o needs a following fontnumber!")
+ fontNo = 0
+ end
end
+ i = i + 1
elseif arg[i] == "-i" or arg[i] == "--info" then
local fontNr = tonumber(arg[i+1])
if fontNr then
@@ -107,15 +114,20 @@ if not args_font then
end
local vlevel = args_verbose
-local otfinfo = args_otfinfo
+--local otfinfo = args_otfinfo
local info = args_info
local noSymbolicNames = args_nosymbolicnames
local maxStrLength = args_max_string
-local font_str = args_font
+local font_str = args_font:lower():gsub("%s+", ""):split("&")
+if #font_str == 1 then font_str[2] = "" end
local luaVersion = _VERSION
print("We are using "..luaVersion)
-print('Looking for font \"'..font_str..'\"')
+if #font_str > 1 then
+ print('Looking for font \"'..font_str[1]..' & '..font_str[2]..'\"')
+else
+ print('Looking for font \"'..font_str[1]..'\"')
+end
function getFileParts(fullpath,part)
local path, file, ext = string.match(fullpath, "(.-)([^/]-([^%.]+))$")
@@ -274,7 +286,7 @@ local fontList = {}
local l_max = {1, 1, 1}
for i, v in ipairs(fontDataMap) do
if v["familyname"] then
- if string.find (v["familyname"], font_str, 1, true) or (font_str == "*") then
+ if (string.find (v["familyname"]:lower(), font_str[1], 1, true) and string.find (v["basename"]:lower(), font_str[2], 1, true) ) or (font_str == "*") then
-- print(string.format("%2d. %30s %20s %50s",j,v["basename"],v["familyname"],v["fullpath"]))
fontList[#fontList+1] = v
local fullpath = getFileParts(v["fullpath"],"path") -- strip file name
@@ -295,7 +307,7 @@ local minChars = 26
local Fontname = "Fontname"
local Path = "Path"
local SymbolicName = "Symbolic Name"
-local lfdNr = "Nr."
+local lfdNr = "No."
if (font_str ~= "*") and not noSymbolicNames then
print(string.format("%4s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path))
else
@@ -314,11 +326,12 @@ for i, v in ipairs(fontList) do
end
end
-if otfinfo > 0 then
+if fontNo > 0 then
print()
- print("Run otfinfo:"..otfinfo)
- local font = fontList[otfinfo]["fullpath"]
- local exrun = io.popen("otfinfo -i \""..font.."\"", 'r') -- ".." font may have spaces
+ print("Run otfinfo -"..otfinfo_arg..": "..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()