%% $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-, 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.06}% 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: \\ Gerhard Bachmaier; 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, where can it be found. For example: \begin{Verbatim}[frame=lines,label=luaotfload-tool] 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 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}[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 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 [...] | where \verb|[...]| are optional \Index{argument}s, either in short or long form which, of course, can be mixed: \begin{Verbatim}[frame=lines,label=Parameter] parameter handling -h,--help -o,--otfinfo (default 0) -i,--info (default 0) -n,--nosymbolicnames -v... Verbosity output -m,--max_string (default 90) (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{-m }: 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 and in the middle of the long name there will be \ldots, representing the missing characters. \item \texttt{-o }: 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 }: 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} \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. \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} 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}