% \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[UKenglish]{babel} \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} \usepackage{unicodefonttable} \fonttablesetup{missing-glyph-color=black!25, color=black!50} \usepackage{microtype} \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \RecordChanges \DocInput{\jobname.dtx} \end{document} % % \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, % } % % \changes{v0.1}{2023–09–09}{First public release} % \changes{v0.5}{2024–04–06}{Update Nerd Fonts to v3.2.0} % % \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 the font itself % and a convenient interface to load the font for the % \XeLaTeX{} and \LuaLaTeX{} 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/InconsolataLGC}{github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/InconsolataLGC} % } % This package provides the TrueType font files % and 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. % % \changes{v0.4}{2023-12-08}{Change variant to have bold-italic and italic glyphs, too} % Since version 0.4, \pkg{inconsolata-nerd-font} ships and uses the extended % version of the Inconsolata font, called \emph{InconsolataLGC}. % This variant also contains Hellenic and Cyrilic glyphs, as well as bold-italic % and italic variants. % % \subsection{License}\label{sec:doc-license} % % Permission is granted to copy, distribute, and/or modify this software under % the terms of the \LaTeX{} Project Public License~(LPPL), version~1.3c or % later~(\href{https://www.latex-project.org/lppl.txt}{https://www.latex-project.org/lppl.txt}). % The software has the status \enquote{maintained}. % % The font files bundled with the package (\texttt{InconsolataLGCNerdFont*.ttf}) % are licensed under the terms of the SIL Open Font License~(LPPL), % version~1.1~(\href{http://scripts.sil.org/OFL}{http://scripts.sil.org/OFL}). % % \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. % The macro 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. % The default value is |MatchLowercase| to match the height of the lower-case % character of the default main font of your document. % \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 six additional macros for convenience, % one pair of each variant of the font. % % \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}{\inconsolatanfmonofamily} % \begin{syntax} % \cs{inconsolatanfmonofamily} % \end{syntax} % A font family for the Inconsolata Nerd Font, % the mono variant provided by this package. % \end{function} % \begin{function}{\inconsolatanfpropofamily} % \begin{syntax} % \cs{inconsolatanfpropofamily} % \end{syntax} % A font family for the Inconsolata Nerd Font, % the propo 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} % \begin{function}{\textinconsolatanfmono} % \begin{syntax} % \cs{textinconsolatanfmono} \marg{text} % \end{syntax} % A convenience macro to typeset a short |text| using the mono % Inconsolata Nerd Font variant. % \end{function} % \begin{function}{\textinconsolatanfpropo} % \begin{syntax} % \cs{textinconsolatanfpropo} \marg{text} % \end{syntax} % A convenience macro to typeset a short |text| using the propo % 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. % % \section{Font Tables}\label{sec:doc-font-tables} % % \changes{v0.3}{2023-09-13}{Add font tables to the documentation.} % % This section provides character tables of the different font variants, % created using Frank Mittelbach's \pkg{unicodefonttable} package. % Thanks to Herbert Voß for his suggestion to add these. % % \subsection{Regular}\label{sec:doc-font-tables-regular} % % \displayfonttable{InconsolataLGCNerdFont-Regular.ttf} % % \subsection{Mono Regular}\label{sec:doc-font-tables-mono} % % \displayfonttable{InconsolataLGCNerdFontMono-Regular.ttf} % % \subsection{Proportional Regular}\label{sec:doc-font-tables-propo} % % \displayfonttable{InconsolataLGCNerdFontPropo-Regular.ttf} % % \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} {2024-04-06} {0.5} {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 = MatchLowercase, } \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 {InconsolataLGCNerdFont} \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 three fonts and commands for easier usage. % \begin{macro}{\inconsolatanffamily} % The defaut font accessible as a \LaTeX{} font family. % \begin{macrocode} \newfontfamily\inconsolatanffamily{InconsolataLGCNerdFont-Regular.ttf}[ BoldFont = InconsolataLGCNerdFont-Bold.ttf, BoldItalicFont = InconsolataLGCNerdFont-BoldItalic.ttf, ItalicFont = InconsolataLGCNerdFont-Italic.ttf, FakeStretch = {0.9}, NFSSFamily = inconsolatanf, Scale = \l_@@_scale_tl, ] % \end{macrocode} % \end{macro} % \begin{macro}{\inconsolatanfmonofamily} % \changes{v0.2}{2023–09–12}{Added macro} % The mono font variant, accessible as a \LaTeX{} font family. % \begin{macrocode} \newfontfamily\inconsolatanfmonofamily{InconsolataLGCNerdFontMono-Regular.ttf}[ BoldFont = InconsolataLGCNerdFontMono-Bold.ttf, BoldItalicFont = InconsolataLGCNerdFontMono-BoldItalic.ttf, ItalicFont = InconsolataLGCNerdFontMono-Italic.ttf, FakeStretch = {0.9}, NFSSFamily = inconsolatanfmono, Scale = \l_@@_scale_tl, ] % \end{macrocode} % \end{macro} % \begin{macro}{\inconsolatanfpropofamily} % \changes{v0.2}{2023–09–12}{Added macro} % The propo font variant, accessible as a \LaTeX{} font family. % \begin{macrocode} \newfontfamily\inconsolatanfpropofamily{InconsolataLGCNerdFontPropo-Regular.ttf}[ BoldFont = InconsolataLGCNerdFontPropo-Bold.ttf, BoldItalicFont = InconsolataLGCNerdFontPropo-BoldItalic.ttf, ItalicFont = InconsolataLGCNerdFontPropo-Italic.ttf, FakeStretch = {0.9}, NFSSFamily = inconsolatanfpropo, Scale = \l_@@_scale_tl, ] % \end{macrocode} % \end{macro} % \begin{macro}{\textinconsolatanf} % A macro to typeset text in the default font variant. % \begin{macrocode} \DeclareTextFontCommand{\textinconsolatanf}{\inconsolatanffamily} % \end{macrocode} % \end{macro} % \begin{macro}{\textinconsolatanfmono} % \changes{v0.2}{2023–09–12}{Added macro} % A macro to typeset text in the mono font variant. % \begin{macrocode} \DeclareTextFontCommand{\textinconsolatanfmono}{\inconsolatanffamilymono} % \end{macrocode} % \end{macro} % \begin{macro}{\textinconsolatanfpropo} % \changes{v0.2}{2023–09–12}{Added macro} % A macro to typeset text in the propo font variant. % \begin{macrocode} \DeclareTextFontCommand{\textinconsolatanfpropo}{\inconsolatanffamilypropo} % \end{macrocode} % \end{macro} % % Now we can actually load the font % \begin{macrocode} \setmonofont{\l_@@_font_name_tl}[ BoldFont = *-Bold, BoldItalicFont = *-BoldItalic, ItalicFont = *-Italic, Extension = .ttf, FakeStretch = {0.9}, Scale = \l_@@_scale_tl, UprightFont = *-Regular, ] % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \end{implementation} % % \PrintIndex % \PrintChanges