summaryrefslogtreecommitdiff
path: root/support/findfont/doc/luafindfont-doc.tex
blob: b051447e54949b5ab1fdac152570adadc24cd40e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
 %% $Id: findfont-doc.tex 16 2021-11-07 19:42:57Z hvoss $
%
\listfiles\setcounter{errorcontextlines}{100}
\documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-,
               captions=tableabove,twoside=on]{scrartcl}
\usepackage{fontspec}
%\usepackage{libertinus-otf}
\setmainfont{AccanthisADFStdNo3}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setsansfont{GilliusADF}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setmonofont{DejaVu Sans Mono}[Scale=MatchLowercase,FakeStretch=0.9]
%\setmonofont{Anonymous Pro}[Scale=MatchLowercase,FakeStretch=0.9]

\usepackage[english]{babel}
\usepackage{scrlayer-scrpage}
\automark[section]{section}
\automark*[subsection]{}
\pagestyle{scrheadings}

{\catcode`\%=12 
 \gdef\perCent{%}
 \gdef\DoubleperCent{%%}
}

\usepackage{xcolor,fancyvrb,varioref}
\usepackage{xltabular,pdflscape}
\usepackage{hvlogos} % for Wikipedia W
\usepackage{listings}
\usepackage{dtk-extern} % for Wikipedia W
\lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX}
\usepackage{ragged2e}
\usepackage{makeidx}\makeindex
\usepackage{hvindex}
\def\Lfile#1{\texttt{#1}\index{#1 file@\texttt{#1} file}}
\def\Lext#1{\texttt{.#1}\index{#1 file extension@\texttt{.#1} file extension}}
\def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}}
\def\Lenv#1{\texttt{#1}\index{#1 environment@\texttt{#1} environment}}
\def\Lpack#1{\texttt{#1}\index{#1 package@\texttt{#1} package}}
\def\Lprog#1{\texttt{#1}\index{#1 program@\texttt{#1} program}}
\def\Loption#1{\texttt{#1}\index{#1@\texttt{#1} package option}}
\def\Largb#1{\emph{\{#1\}}}

%\usepackage[bibstyle=dtk]{biblatex}
%\addbibresource{\jobname.bib}

\raggedbottom
\usepackage{url}
\usepackage[colorlinks,linktocpage]{hyperref}

\makeatletter% from: doc.sty
\newcommand*\GetFileInfo[1]{%
  \def\filename{#1}%
  \def\@tempb##1 ##2 ##3\relax##4\relax{%
    \def\filedate{##1}%
    \def\fileversion{##2}%
    \def\fileinfo{##3}}%
  \edef\@tempa{\csname ver@#1\endcsname}%
  \expandafter\@tempb\@tempa\relax? ? \relax\relax}
\makeatother

%\GetFileInfo{xltabular.sty}
\usepackage{xspace}

\newcommand\FF{\texttt{luafindfont}\xspace}

\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}} 

\setVersion{version = 0.04}%  can be automatically changed by perl

\setkeys{dtk}{cleanup=true,force}

\title{Program \texttt{luafindfont} \\--\\ \normalsize \luafindfontVersion\ (\today)}
\author{\shortstack{Herbert Voß\\\small \href{mailto:hvoss@tug.org}{hvoss@tug.org}}}
\date{}
\begin{document}
\maketitle
\thispagestyle{empty}
\enlargethispage{1cm}
\tableofcontents

\vfill
Thanks to: \\
Rolf Niepraschk;
\clearpage

\section{Introduction}
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:

\begin{verbatim}
H-MacBook:~ voss$ 
H-MacBook:~ voss$ luaotfload-tool --find=times
luaotfload | resolve : Font "times" found!
luaotfload | resolve : Resolved file name "/System/Library/Fonts/Times.ttc", subfont nr. 0
H-MacBook:~ voss
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}

But this 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
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
   1.  Times New Roman Bold Italic.ttf      timesnewroman     /Users/voss/Library/Fonts/Times/
   2.  Times New Roman Bold Italic.ttf      timesnewroman  /System/Library/Fonts/Supplemental/
   3.         Times New Roman Bold.ttf      timesnewroman  /System/Library/Fonts/Supplemental/
   4.         Times New Roman Bold.ttf      timesnewroman     /Users/voss/Library/Fonts/Times/
   5.       Times New Roman Italic.ttf      timesnewroman  /System/Library/Fonts/Supplemental/
   6.       Times New Roman Italic.ttf      timesnewroman     /Users/voss/Library/Fonts/Times/
   7.              Times New Roman.ttf      timesnewroman  /System/Library/Fonts/Supplemental/
   8.              Times New Roman.ttf      timesnewroman     /Users/voss/Library/Fonts/Times/
   9.                        Times.ttc              times               /System/Library/Fonts/
  10.             Times_Sans_Serif.ttf     timessansserif     /Users/voss/Library/Fonts/Times/
  11.      TimesNewRomanMTStd-Bold.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  12.  TimesNewRomanMTStd-BoldCond.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  13.    TimesNewRomanMTStd-BoldIt.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  14.      TimesNewRomanMTStd-Cond.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  15.    TimesNewRomanMTStd-CondIt.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  16.    TimesNewRomanMTStd-Italic.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  17.           TimesNewRomanMTStd.otf timesnewromanmtstd     /Users/voss/Library/Fonts/Times/
  18. TimesNewRomanPS-BoldItalicMT.otf  timesnewromanpsmt     /Users/voss/Library/Fonts/Times/
  19.       TimesNewRomanPS-BoldMT.otf  timesnewromanpsmt     /Users/voss/Library/Fonts/Times/
  20.            TimesNewRomanPSMT.otf  timesnewromanpsmt     /Users/voss/Library/Fonts/Times/
  21.      TimesNewRomanPSStd-Bold.otf timesnewromanpsstd     /Users/voss/Library/Fonts/Times/
  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}


\subsection{Syntax}

The \Index{syntax} is 

\verb|luafindfont [...] <font>| 

where \verb|[...]|  are optional \Index{argument}s, either in short or
long form which, of course, can be mixed:

\begin{verbatim}
  parameter handling
    -q,--quiet
    -h,--help
    -o,--otfinfo (default 0)
    -i,--info (default 0)
    -n,--nosymbolicnames
    -v...          Verbosity output
    -m,--max_string (default 90)
    <font> (string)  
\end{verbatim}

For example:

\begin{verbatim}
luafindfont times 
luafindfont palatino -o 3
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.
\end{enumerate}

\section{How it works}
\FF uses the data file \Lfile{luaotfloadtool-names.lua} which is created by \LuaTeX. If it is
missing it will be created by \FF itself. The name of the font should be in lowercase
characters and must not be the complete name. A \verb|time| for finding all fonts with
time in its names is sufficiant.

\section{Examples}

\begin{Verbatim}
bash-3.2$ luafindfont segoe
\end{Verbatim}

\VerbatimInput{Examples/exa01.txt}

\begin{Verbatim}
bash-3.2$ luafindfont -m 40 libertinus
\end{Verbatim}

\VerbatimInput{Examples/exa02.txt}


\begin{Verbatim}
bash-3.2$ luafindfont -i 9 sego
\end{Verbatim}

\VerbatimInput{Examples/exa04.txt}


\begin{landscape}
\begin{Verbatim}[fontsize=\small]
bash-3.2$ luafindfont -o 6 arial
\end{Verbatim}

\VerbatimInput[fontsize=\small]{Examples/exa03.txt}


\section{List of all fonts}
This possible with the symbolic fontname "*" instead of a real fontname:

\begin{Verbatim}[fontsize=\small]
bash-3.2$ luafindfont "*"
\end{Verbatim}

This list maybe really long and is shortend here!

\VerbatimInput[fontsize=\small]{Examples/exa05.txt}


\end{landscape}


\begin{Verbatim}[fontsize=\small]
bash-3.2$ luafindfont -n minion
\end{Verbatim}

\VerbatimInput[fontsize=\small]{Examples/exa06.txt}





\printindex

\end{document}