summaryrefslogtreecommitdiff
path: root/fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx')
-rw-r--r--fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx345
1 files changed, 345 insertions, 0 deletions
diff --git a/fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx b/fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx
new file mode 100644
index 0000000000..d276f8eb12
--- /dev/null
+++ b/fonts/inconsolata-nerd-font/inconsolata-nerd-font.dtx
@@ -0,0 +1,345 @@
+% \iffalse meta-comment
+%
+% File: inconsolata-nerd-font.dtx Copyright (C) 2023 Stephan Lukasczyk
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+% This file is part of the "inconsolata-nerd-font bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% The released version of this bundle is available from CTAN.
+%
+% ------------------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/stephanlukasczyk/inconsolata-nerd-font
+%
+% for those people who are interested.
+%
+% ------------------------------------------------------------------------------
+%
+%<*driver>
+\documentclass{l3doc}
+\usepackage{libertinus-otf}
+\usepackage{hvlogos}
+% The next line is needed so that \GetFileInfo will be able to pick up version
+% data.
+\usepackage{inconsolata-nerd-font}
+\begin{document}
+ \RecordChanges
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \DoNotIndex{
+% \endinput,
+% \ExplFileDate,
+% \ExplLoaderFileDate,
+% \fmtversion,
+% \l_keys_choice_tl,
+% \keys_define:nn,
+% \keys_set:nn,
+% \MessageBreak,
+% \PackageError,
+% \ProcessKeyOptions,
+% \ProcessKeysOptions,
+% \providecommand,
+% \@ifl@t@r,
+% \@ifpackagelater,
+% \@ifundefined,
+% \tl_clear:N,
+% \tl_if_empty:NTF,
+% \tl_if_eq:NnTF,
+% \tl_new:N,
+% \tl_put_right:Nn,
+% \tl_set:Nn,
+% \tl_set_eq:NN,
+% }
+%
+% \GetFileInfo{inconsolata-nerd-font.sty}
+%
+% \title{^^A
+% \pkg{inconsolata-nerd-font}---Support package to use the Inconsolata^^A
+% Nerd Font TrueType fonts^^A
+% }
+%
+% \author{^^A
+% Stephan Lukasczyk^^A
+% \thanks{^^A
+% E-mail: \href{mailto:stephan@dante.de}{stephan@dante.de}^^A
+% }
+% }
+%
+% \date{\fileversion, \filedate}
+%
+% \maketitle
+%
+% \begin{abstract}
+% Inconsolata is a monospaced font designed by Raph Levien.
+% It is already available via the \pkg{inconsolata} package.
+% However, that package provides a pretty old version of the font;
+% Additionally, the Nerd Font project extended the font by a huge amount of
+% additional glyphs.
+% This package provides a convenient interface to load the font for the
+% \XeTeX{} and \LuaTeX{} engines.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \begin{documentation}
+%
+% \section{User Manual}\label{sec:doc}
+%
+% The Inconsolata font is a monospaced font designed by Raph Levien.
+% Its current version is available from the Google Fonts project.\footnote{%
+% \href{https://github.com/googlefonts/Inconsolata}{github.com/googlefonts/Inconsolata}
+% }
+% There exists an extension of this font by the Nerd Font project,\footnote{%
+% \href{https://www.nerdfonts.com/}{www.nerdfonts.com/}
+% }
+% which adds a huge amount of additional glyphs,
+% especially useful for developers,
+% to the original font.
+% The extended version is available from GitHub.\footnote{
+% \href{https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Inconsolata}{github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Inconsolata}
+% }
+% This package provides a convenient way to use the font
+% with the \XeTeX{} or \LuaTeX{} engines.
+%
+% This user guide gives a brief introduction into the possibilities
+% provided by the \pkg{inconsolata-nerd-font} package.
+%
+% \subsection{Helper Macros}\label{sec:doc-helper}
+%
+% The following macro is not strictly part of the package.
+% It is actually defined by recent \LaTeX{} kernels.
+% However, to make the package compatible with older kernels, too,
+% we provide it if it is not yet defined.
+%
+% The macro's purpose is to check whether the used \LaTeX{} format
+% is at least from the given date
+% and allows to execute code depending on the result of the check.
+% \begin{function}{\IfFormatAtLeastTF}
+% \begin{syntax}
+% \cs{IfFormatAtLeastTF} \marg{date} \marg{true} \marg{false}
+% \end{syntax}
+% We define this macro to execute code depending on the \LaTeX{} format date.
+% It is only defined if it is not already part of the \LaTeX{} kernel,
+% which it is for recent versions of the kernel.
+% \end{function}
+%
+% \subsection{Package Arguments}\label{sec:doc-arguments}
+%
+% The \pkg{inconsolata-nerd-font} package provides the following
+% load-time options.
+% \begin{variable}{variant}
+% \begin{syntax}
+% variant = \meta{choice}
+% \end{syntax}
+% Specifies which variant of the font shall be used, must be one of
+% |default|, |mono|, or |propo|, where |default| is the default value.
+%
+% The |mono| variant is limited to only mono-spaced characters,
+% the |default| variant provides bigger icons (around 1.5 times the width of a
+% normal character),
+% the |propo| variant provides proportional symbols,
+% which might be suitable, e.g., for presentations.
+% \end{variable}
+%
+% \begin{variable}{scale, Scale}
+% \begin{syntax}
+% scale = \marg{factor}
+% Scale = \marg{factor}
+% \end{syntax}
+% Set the scaling of the font.
+% See the \pkg{fontspec} documentation for more details.
+% \end{variable}
+%
+% \subsection{Font Macros}\label{sec:doc-macros}
+%
+% While the package sets the default mono-spaced font
+% to the selected variant of the Inconsolata Nerd Font,
+% the package provides two additional macros for convenience.
+%
+% \begin{function}{\inconsolatanffamily}
+% \begin{syntax}
+% \cs{inconsolatanffamily}
+% \end{syntax}
+% A font family for the Inconsolata Nerd Font,
+% the default variant provided by this package.
+% \end{function}
+%
+% \begin{function}{\textinconsolatanf}
+% \begin{syntax}
+% \cs{textinconsolatanf} \marg{text}
+% \end{syntax}
+% A convenience macro to typeset a short |text| using the default
+% Inconsolata Nerd Font variant.
+% \end{function}
+%
+% The following sentence uses the \cs{textinconsolatanf}
+% to typeset the words \enquote{an example} using Inconsolata Nerd Font:
+% Just \textinconsolatanf{an example} sentence.
+%
+% \end{documentation}
+%
+% \clearpage
+%
+% \begin{implementation}
+%
+% \section{Implementation}\label{impl:pkg}
+%
+% Start the \pkg{DocStrip} guards.
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention): only
+% internal matrial in this \emph{module} should be used directly.
+% \begin{macrocode}
+%<@@=slcd_inf>
+% \end{macrocode}
+% Load only the essential support (\pkg{expl3}) \enquote{up-front}, and only
+% if required.
+% \begin{macrocode}
+\@ifundefined{ExplLoaderFileDate}
+ { \RequirePackage{expl3} }
+ {}
+% \end{macrocode}
+% Make sure that the version of \pkg{l3kernel} in use is sufficiently new.
+% We use \cs{ExplFileDate} as \cs{@ifpackagelater} does not work for
+% pre-loaded \pkg{expl3} in the absence of the package.
+% \begin{macrocode}
+\@ifl@t@r\ExplLoaderFileDate{2020-01-09}
+ {}
+ {%
+ \PackageError{inconsolata-nerd-font}{Support package expl3 too old}
+ {%
+ You need to update your installation of the bundles 'l3kernel' and
+ 'l3packages'.\MessageBreak
+ Loading~inconsolata-nerd-font~will~abort!%
+ }%
+ \endinput
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\IfFormatAtLeastTF}
+% This macro is not present in older kernels, thus we use the \LaTeXe{}
+% mechanism as this is correct for this case.
+% \begin{macrocode}
+\providecommand \IfFormatAtLeastTF { \@ifl@t@r \fmtversion }
+% \end{macrocode}
+% \end{macro}
+%
+% Identify the package and give the overall version information.
+% \begin{macrocode}
+\ProvidesExplPackage {inconsolata-nerd-font} {2023-09-09} {0.1}
+ {Support package to use the Inconsolata Nerd Font TrueType fonts}
+% \end{macrocode}
+%
+% \subsection{Options}\label{sec:impl-options}
+%
+% Define the options for the package.
+% \begin{variable}{
+% variant,
+% scale,
+% Scale,
+% \l_@@_variant_tl,
+% \l_@@_scale_tl,
+% }
+% \begin{macrocode}
+\tl_new:N \l_@@_variant_tl
+
+\keys_define:nn { inconsolatanerdfont }
+ {
+ variant .choices:nn = { default, mono, propo } {
+ \tl_set_eq:NN \l_@@_variant_tl \l_keys_choice_tl
+ },
+
+ scale .tl_set:N = \l_@@_scale_tl,
+ Scale .tl_set:N = \l_@@_scale_tl,
+ }
+
+\keys_set:nn { inconsolatanerdfont }
+ {
+ variant = default,
+ scale = 0.9,
+ }
+\tl_clear:N \l_@@_variant_tl
+% \end{macrocode}
+% \end{variable}
+%
+% Process the options
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2022-06-01 }
+ { \ProcessKeyOptions [ inconsolatanerdfont ] }
+ {
+ \RequirePackage { l3keys2e }
+ \ProcessKeysOptions { inconsolatanerdfont }
+ }
+% \end{macrocode}
+% and set up the default variant if it was not yet chosen
+% \begin{macrocode}
+\tl_if_empty:NT \l_@@_variant_tl
+ {
+ \tl_set:Nn \l_@@_variant_tl { default }
+ }
+% \end{macrocode}
+%
+% \subsection{Load the Font}\label{sec:impl-load}
+%
+% We require the \pkg{fontspec} package.
+% \begin{macrocode}
+\RequirePackage{fontspec}
+% \end{macrocode}
+%
+% Define and set a helper variable for the respective font name suffix
+% \begin{macrocode}
+\tl_new:N \l_@@_font_name_tl
+\tl_set:Nn \l_@@_font_name_tl {InconsolataNerdFont}
+\tl_if_eq:NnTF \l_@@_variant_tl { mono }
+ { \tl_put_right:Nn \l_@@_font_name_tl {Mono} }
+ {
+ \tl_if_eq:NnT \l_@@_variant_tl { propo }
+ { \tl_put_right:Nn \l_@@_font_name_tl {Propo} }
+ }
+% \end{macrocode}
+%
+% Define a font family for the font and a command for esiere usage
+% \begin{macro}{\inconsolatanffamily, \textinconsolatanf}
+% \begin{macrocode}
+\newfontfamily\inconsolatanffamily{InconsolataNerdFont-Regular.ttf}[
+ BoldFont = InconsolataNerdFont-Bold.ttf,
+ FakeStretch = {0.9},
+ NFSSFamily = inconsolatanf,
+ Scale = \l_@@_scale_tl,
+]
+\DeclareTextFontCommand{\textinconsolatanf}{\inconsolatanffamily}
+% \end{macrocode}
+% \end{macro}
+%
+% Now we can actually load the font
+% \begin{macrocode}
+\setmonofont{\l_@@_font_name_tl}[
+ BoldFont = *-Bold,
+ Extension = .ttf,
+ FakeStretch = {0.9},
+ Scale = \l_@@_scale_tl,
+ UprightFont = *-Regular,
+]
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
+% \PrintChanges \ No newline at end of file