Debian Codegraph @

texmf-dist/doc/support/luafindfont/luafindfont-doc.tex

raw
1 %% $Id: luafindfont-doc.tex 1117 2025-07-04 09:32:59Z herbert $
2 %
3 \listfiles\setcounter{errorcontextlines}{100}
4 \documentclass[paper=landscape,paper=a4,fontsize=11pt,DIV=14,parskip=half-,
5 captions=tableabove,twoside=on]{scrartcl}
6 \usepackage{fontspec}
7 %\usepackage{libertinus-otf}
8 \setmainfont{AccanthisADFStdNo3}[
9 UprightFont =*-Regular,
10 BoldFont =*-Bold,
11 ItalicFont =*-Italic,
12 BoldItalicFont=*-BoldItalic,
13 RawFeature = -rlig,
14 ]
15 \setsansfont{GilliusADF}[
16 UprightFont =*-Regular,
17 BoldFont =*-Bold,
18 ItalicFont =*-Italic,
19 BoldItalicFont=*-BoldItalic,
20 RawFeature = -rlig,
21 ]
22 \setmonofont{DejaVu Sans Mono}[Scale=MatchLowercase,FakeStretch=0.9]
23 %\setmonofont{Anonymous Pro}[Scale=MatchLowercase,FakeStretch=0.9]
24
25 \usepackage[english]{babel}
26 \usepackage{scrlayer-scrpage}
27 \automark[section]{section}
28 \automark*[subsection]{}
29 \pagestyle{scrheadings}
30
31 {\catcode`\%=12
32 \gdef\perCent{%}
33 \gdef\DoubleperCent{%%}
34 }
35
36 \usepackage{xcolor,fancyvrb,varioref}
37 \usepackage{xltabular,pdflscape}
38 \usepackage{hvlogos} % for Wikipedia W
39 \usepackage{listings}
40 \usepackage{hvextern}
41
42 \setkeys{hv}{moveToExampleDir,ExampleDir=Examples,showFilename=false,force,verbose}
43 \lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX}
44 \usepackage{ragged2e}
45
46 \usepackage{makeidx}\makeindex
47 \usepackage{hvindex}
48
49 \def\Lfile#1{\texttt{#1}\index{#1 file@\texttt{#1} file}}
50 \def\Lext#1{\texttt{.#1}\index{#1 file extension@\texttt{.#1} file extension}}
51 \def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}}
52 \def\Lenv#1{\texttt{#1}\index{#1 environment@\texttt{#1} environment}}
53 \def\Lpack#1{\texttt{#1}\index{#1 package@\texttt{#1} package}}
54 \def\Lprog#1{\texttt{#1}\index{#1 program@\texttt{#1} program}}
55 \def\Loption#1{\texttt{#1}\index{#1@\texttt{#1} package option}}
56 \def\Largb#1{\emph{\{#1\}}}
57
58 %\usepackage[bibstyle=dtk]{biblatex}
59 %\addbibresource{\jobname.bib}
60
61 \raggedbottom
62 \usepackage{url}
63 \usepackage[colorlinks,linktocpage]{hyperref}
64
65 \makeatletter% from: doc.sty
66 \newcommand*\GetFileInfo[1]{%
67 \def\filename{#1}%
68 \def\@tempb##1 ##2 ##3\relax##4\relax{%
69 \def\filedate{##1}%
70 \def\fileversion{##2}%
71 \def\fileinfo{##3}}%
72 \edef\@tempa{\csname ver@#1\endcsname}%
73 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
74 \makeatother
75
76 %\GetFileInfo{xltabular.sty}
77 \usepackage{xspace}
78
79 \newcommand\FF{\texttt{luafindfont}\xspace}
80
81 \def\setVersion#1{\setVVersion#1!!}
82 \def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}}
83
84 \setVersion{version = 0.15}% can be automatically changed by perl
85
86 \setkeys{hv}{cleanup={},force}
87
88 \title{Program \texttt{luafindfont} \\--\\ \normalsize \luafindfontVersion\ (\today)}
89 \author{\shortstack{Herbert Voß\\\small \href{mailto:[email protected]}{[email protected]}}}
90 \date{}
91 \begin{document}
92 \maketitle
93 \thispagestyle{empty}
94 \enlargethispage{1cm}
95 \tableofcontents
96
97 \vfill
98 Thanks to: \\
99 Gerhard Bachmaier;
100 Karl Berry;
101 {\setmainfont[Scale=MatchUppercase]{NotoSerifGeorgian-Medium.ttf} მამუკა ჯიბლაძე} (Mamuka Jibladze);
102 Jakob Mendel;
103 Rolf Niepraschk;
104 \clearpage
105
106 \section{Introduction}
107 The Lua program
108 \FF is a program for searching installed fonts which are usable for \LuaLaTeX\ and \XeLaTeX.
109 The already existing Lua program \Lprog{luaotfload-tool} can also be used for searching, but
110 the search-interface is somewhat cryptic and too complex for a user, who wants only to know
111 if a font is present or not. And if present, where can it be found. For example:
112
113
114 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
115 #StartVisibleMain
116 luaotfload-tool --find=times
117 #StopVisibleMain
118 \end{externalDocument}
119
120 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
121 #StartVisibleMain
122 luaotfload-tool --fuzzy --find="times new roman"
123 #StopVisibleMain
124 \end{externalDocument}
125
126
127
128
129 But that are not \emph{all} Times fonts. Compare it with the output of \Lprog{luafindfont},
130 where the searchname \emph{times} must only be a part of a longer name:
131
132 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
133 #StartVisibleMain
134 luafindfont times
135 #StopVisibleMain
136 \end{externalDocument}
137
138
139
140 \subsection{Syntax}
141
142 The \Index{syntax} is
143
144 \verb|luafindfont [...] <font>|
145
146 where \verb|[...]| are optional \Index{argument}s, either in short or
147 long form which, of course, can be mixed:
148
149 \begin{Verbatim}[frame=lines,label=Parameter]
150 parameter handling
151 -h,--help
152 -n,--nosymbolicnames
153 ,--no-symbolic-names
154 -o,--otfinfo (default 0)
155 -i,--info (default 0)
156 -I,--Info (default 0)
157 -l, --listonlynames
158 -L, --listonlyfiles
159 -x, --xetex
160 -v, --verbose
161 -V, --version
162 -m,--max_string (default 90)
163 <(partial) fontname>
164 \end{Verbatim}
165
166 For example:
167
168 \begin{verbatim}
169 luafindfont times
170 luafindfont palatino -o 3
171 luafindfont -i 3 -m 50 arial
172 luafindfont "LinLibertine & Bold"
173 \end{verbatim}
174
175 \begin{enumerate}
176 \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|
177 the length is limited to 50 characters and in the middle of the long name there will be \ldots, representing the missing characters.
178 \item \texttt{-o <number[character]>}: For the font with the given number from the font list the program \Lprog{otfinfo} is called
179 for some generell font informations. An additional optional argument for \Lprog{otfinfo} (only one character) must follow directly the fontnumber
180 (see also section~\ref{otfinfo})
181 \item \texttt{-i <number>}: For the font with the given number from the font list the existing other corresponding font styles are listed.
182 \end{enumerate}
183
184 \section{How it works}
185 \FF uses the data file \Lfile{luaotfloadtool-names.lua} which is created by \LuaTeX. If it is
186 missing it will be created by \FF itself. The name of the font should be in lowercase
187 characters and must not be the complete name. A ``\verb|time|'' for finding all fonts with
188 ``time'' in its names is sufficiant for searching ``times new roman''.
189
190
191 \subsection{Fontname}
192 The fontname can only be a substring of the complete filename. It is not case sensitive, \texttt{Myriad} and \texttt{myriad}
193 are the same. It is possible to combine two search strings which will act like a boolean \texttt{and}. A search with
194 \texttt{"Myriad \& bold"} (in quotes) will list all files which have \texttt{myriad} \emph{and} \texttt{bold} in its name.
195
196
197
198 \subsection{Option \texttt{-V}}
199 Prints the version number and exits.
200
201
202
203 \subsection{Option \texttt{-o}}\label{otfinfo}
204 This needs an installed program \Lprog{otfinfo}, which should be the default for all \TeX\ distributions.
205 This program lists some useful informations of a given fontnumber. The fontnumber can be combined by an
206 additional character for different outputs. For example \texttt{-o 2f} lists the features of the font number 2
207 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
208 informations defined!
209
210 The possible options are (i is the default):
211
212 \begin{Verbatim}[frame=lines,label=otfinfo]
213 s Report font’s supported scripts.
214 f Report font’s GSUB/GPOS features.
215 z Report font’s optical size information.
216 p Report font’s PostScript name.
217 a Report font’s family name.
218 v Report font’s version information.
219 i Report font’s names and designer/vendor info.
220 g Report font’s glyph names.
221 t Report font’s OpenType tables.
222 \end{Verbatim}
223
224
225
226
227 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
228 #StartVisibleMain
229 luafindfont -o 2f "myriad & semibold"
230 #StopVisibleMain
231 \end{externalDocument}
232
233 if no parameter is given, then \texttt{-i} is assumed.
234
235
236 \subsection{Option \texttt{-i}}
237 For a given font number \texttt{luafindfont} will list the font styles which were found by the font search
238 and which correspond to the font number. This is useful if a fontname doesn't has the style in its name or
239 only in short form.
240
241 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
242 #StartVisibleMain
243 luafindfont -i 4 "myriad & semibold"
244 #StopVisibleMain
245 \end{externalDocument}
246
247
248 For the font number 4 there also exists a Regular, Bold, and a Italic font. The font no 4 itself
249 is a BoldItalic version.
250
251
252 \subsection{Option \texttt{-I}}
253 This similiar to option \texttt{-i}, but uses \texttt{mtxrun} to get a long list of all informations
254 of the font, including features and corresponding languages. The list can be very long!
255
256 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
257 #StartVisibleMain
258 luafindfont -I 4 "myriad & semibold"
259 #StopVisibleMain
260 \end{externalDocument}
261
262
263 \subsection{Option \texttt{-l} or \texttt{-L}}
264 With one of these options you get a long sorted list of available symbolic fontnames
265 or a long sorted list of the filenames (\texttt{L}) without the path.
266
267
268
269 \subsection{Option \texttt{-x}}\label{xetex}
270
271 \XeTeX\ will find OpenType and TrueType fonts only, if they are part of the system fonts or
272 found by \texttt{kpsewhich} by its filename. With the option \texttt{-x} you'll an additional
273 column, which shows if the font is found by \texttt{kpsewhich} (1) or not (0). If not, then
274 it is obvious, that you have to update the filename database of the \TeX\ distribution in
275 the usual way by running \texttt{texhash} or via a menu entry if using a file manager.
276
277
278
279 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
280 #StartVisibleMain
281 luafindfont -m 55 -x PStricksdotfont
282 #StopVisibleMain
283 \end{externalDocument}
284
285
286 The font \texttt{myFont.otf} is found by \LuaTeX\ but not by \XeTeX.
287
288
289
290
291 \section{Examples}
292
293
294 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
295 #StartVisibleMain
296 luafindfont segoe
297 #StopVisibleMain
298 \end{externalDocument}
299
300 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
301 #StartVisibleMain
302 luafindfont -m 35 libertinus
303 #StopVisibleMain
304 \end{externalDocument}
305
306 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
307 #StartVisibleMain
308 luafindfont -i 9 sego
309 #StopVisibleMain
310 \end{externalDocument}
311
312
313 %\begin{landscape}
314
315 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
316 #StartVisibleMain
317 luafindfont -o 6 arial
318 #StopVisibleMain
319 \end{externalDocument}
320
321
322 \begin{externalDocument}[redirect,includegraphic=false,force,code,docType=sh,ext=sh,compiler=sh]{exa}
323 #StartVisibleMain
324 luafindfont --no-symbolic-names minion
325 #StopVisibleMain
326 \end{externalDocument}
327
328
329
330 \section{List of all fonts}
331 This possible with the symbolic fontname "*" instead of a real fontname:
332
333 \begin{Verbatim}[fontsize=\small]
334 bash-3.2$ luafindfont "*"
335 \end{Verbatim}
336
337 This list maybe really long and is shortend here!
338
339 \VerbatimInput[fontsize=\small]{Examples/exa05.txt}
340
341
342 %\end{landscape}
343
344
345 \printindex
346
347 \end{document}