%% $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{findfont}\xspace}

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

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

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

\title{Program \texttt{findfont} \\--\\ \normalsize \findfontVersion\ (\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.

\subsection{Syntax}

The \Index{syntax} is 

\verb|findfont [...] <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)
    -v...          Verbosity output
    -m,--max_string (default 90)
    <font> (string)  
\end{verbatim}

For example:

\begin{verbatim}
findfont times 
findfont palatino -o 3
findfont -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$ findfont segoe
\end{Verbatim}

\VerbatimInput{Examples/exa01.txt}

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

\VerbatimInput{Examples/exa02.txt}


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

\VerbatimInput{Examples/exa04.txt}


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

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

\end{landscape}

\printindex

\end{document}
