% \iffalse meta-comment
%
% File: lora.dtx
% Copyright 2026 by Dmitriy Nosachev
%
% 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
%
%<*driver>
\documentclass{l3doc}
\usepackage{lora}
\usepackage[style=numeric, backend=biber]{biblatex}
\addbibresource{lora.bib}
\usepackage{metalogo}
\usepackage[dvipsnames]{xcolor}
\hypersetup{
  linkcolor=MidnightBlue,
  citecolor=OliveGreen,
  urlcolor=NavyBlue,
  filecolor=Magenta
}
\begin{document}
  \RecordChanges
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
% \GetFileInfo{lora.sty}
% \title{\pkg{lora}---\LaTeX{} support of Lora font\\ by Olga Karpushina and Alexei Vanyashin}
% \date{\fileversion, \filedate}
% \author{Dmitriy Nosachev\thanks{\href{mailto:quartz64@gmail.com}{quartz64@gmail.com } } }
% \maketitle
% \begin{abstract}
%   Lora is a well-balanced contemporary serif typeface with roots in calligraphy, featuring brushed curves and driving wedge serifs.
%   This package provides \LaTeX{} support for it.
% \end{abstract}
% \tableofcontents
% \begin{documentation}
%
%\section{User manual}
%\label{sec:ug}
%
% 
%\subsection{Introduction}
%\label{sec:ug-intro}
%
% Lora is a contemporary serif typeface with a balanced design and
% calligraphic origins. This Unicode font family accommodates
% languages using the Latin and Cyrillic scripts (including their
% variants) and has the potential to be extended to support additional
% writing systems.
%
% Lora was created by Olga Karpushina and Alexei Vanyashin at Cyreal
% and launched in 2011 with contributions and assistance from
% Gayaneh Bagdasaryan. Font is licensed under the SIL Open Font
% License, Version 1.1.~\cite{cyreal}
%
% This package provides \LaTeX{} interface for the font.
% Since the font it in OTF format, you do need a Unicode
% engine like \XeTeX{} or \LuaTeX{} to use it.  
%
% I would like to express my deep gratitude to Boris Veytsman,
% the author of the \texttt{arsenal} package~\cite{arsenal}. I used his \texttt{.dtx}
% file (Documented LaTeX Source) as a template.
%
%\subsection{Package options}
%\label{sec:ug-options}
%
% \begin{variable}{default, rmdefault, scale, Scale}
%
% The following options are recognized:
%   \begin{description}
%   \item[default] whether to make Lora the main font of the
%     document, either |true| (the default) or |false|.
%    This option uses the \cs{setmainfont} macro, which utilizes
%    font settings from the \texttt{lora.fontspec} file.
%   \item[rmdefault] whether to make Lora the sans serif font of your
%     document, either |true| or |false| (the default).
%    This option is needed if you are using a sans-serif font
%    as the primary font.
%   \item[scale] the scale for the font, by default 1.0.  The option
%   |Scale| is a synonym.
%   \end{description}
% \end{variable}
%
%
%\subsection{Font features}
%\label{sec:ug-families}
%
% \begin{function}{\lorafamily, \textlora}
%   \begin{syntax}
%     \cs{lorafamily} \meta{text}
%     \cs{textlora}\Arg{text}
%   \end{syntax}
%   The font provides the commands \cs{lorafamily} and
%   \cs{textlora} for selecting the font.  Alternatively, the NFSS
%   commands \cs{fontfamily}|{lora}|\cs{selectfont} can be used to
%   select Lora family.
% \end{function}
%
% The font has normal and \textit{italic} shapes, as well as bolded
% \textbf{bold} and \textbf{\itshape bold italic}. They are selected
% by the standard \LaTeX{} commands. 
% 
% The font supports variable weight with values from 400 to 700.
% Each font file, |Lora.ttf| and |Lora-Italic.ttf|, contains four four
% named instances corresponding to different
% values of the weight axis:
% \begin{itemize}
%   \item Regular (\texttt{wght=400})
%   \item Medium (\texttt{wght=500})
%   \item SemiBold (\texttt{wght=600})
%   \item Bold (\texttt{wght=700})
% \end{itemize}
% 
% \begin{function}{\LoraMedium, \textloramed}
%   \begin{syntax}
%     \cs{LoraMedium} \meta{text}
%     \cs{textloramed}\Arg{text}
%   \end{syntax}
%   The font provides the commands \cs{LoraMedium} and
%   \cs{textloramed} for selecting the \textloramed{medium weight} variant.
% \end{function}
% 
% \begin{function}{\LoraSemiBold, \textlorasb}
%   \begin{syntax}
%     \cs{LoraSemiBold} \meta{text}
%     \cs{textlorasb}\Arg{text}
%   \end{syntax}
%   The font provides the commands \cs{LoraSemiBold} and
%   \cs{textlorasb} for selecting the \textlorasb{semi-bold} variant.
% \end{function}
% 
%\subsection{Defining a font with custom weight}
%\label{sec:custweight}
% 
% You can use any intermediate weight value between 400 and 700.
% In the example below, we define a new font family
% (and the corresponding text command) with a weight value
% of 450 for the regular font and a standard bold style.
% 
% \begin{verbatim}
% \newfontfamily\LoraSpecial{Lora}[
%   UprightFeatures    = { RawFeature = {+axis={wght=450 } } },
%   ItalicFeatures     = { RawFeature = {+axis={wght=450 } } },
%   ItalicFont         = Lora-Italic,
%   BoldFont           = Lora,
%   BoldItalicFont     = Lora-Italic,
%   BoldFeatures       = { RawFeature = { instance = { Bold } } },
%   BoldItalicFeatures = { RawFeature = { instance = { Bold Italic } } }
% ]
% 
% \DeclareTextFontCommand{\textloraspc}{\LoraSpecial}
% \end{verbatim}
%
%\subsection{Special symbols}
%\label{sec:chars}
%
% \begin{function}{
%   \texthryvnia,
%   \texttugrik,
%   \texttenge,
%   \textlira,
%   \textruble
% }
% The font has common currency characters, like \cs{textdollar}
% (\textdollar), \cs{textyen} (\textyen), \cs{textsterling}
% (\textsterling), \cs{texteuro} (\texteuro).  It also defines several
% less common currency characters:
% \begin{trivlist}
%   \item \cs{texthryvnia} (\texthryvnia),
%   \item \cs{texttugrik} (\texttugrik),
%   \item \cs{texttenge} (\texttenge),
%   \item \cs{textlira} (\textlira),\\
%   \item \cs{textruble} (\textruble).
% \end{trivlist}
% \end{function}
%
% \end{documentation}
% \clearpage
%
% \begin{implementation}
%
% \section{Implementation}
% \label{sec:impl}
%
%\subsection{Setting up}
%\label{sec:settingup}
%
% First, we declare who we are:
%    \begin{macrocode}
%<@@=lora>
%<*package>
\ProvidesExplPackage {lora}
{2026-09-16} {v1.0.3}
{Lora font by Olga Karpushina and Alexei Vanyashin}
%    \end{macrocode}
%
%\subsection{Options}
%\label{sec:options}
%
% \begin{variable}{
%   default,
%   rmdefault,
%   scale,
%   Scale,
%   \l_@@_default_bool,
%   \l_@@_rmdefault_bool,
%   \l_@@_scale_tl
% }
%    \begin{macrocode}
\keys_define:nn { lora }
{
  default .bool_set:N = \l_@@_default_bool,
  default .default:n = true,
  rmdefault .bool_set:N = \l_@@_rmdefault_bool,
  rmdefault .default:n = true,
  scale .tl_set:N = \l_@@_scale_tl,
  Scale .tl_set:N = \l_@@_scale_tl,
}

\keys_set:nn { lora }
{
  default=true,
  rmdefault=false,
  scale = 1.0,
}
%    \end{macrocode}
% \end{variable}
%
% Processing options
%    \begin{macrocode}
\IfFormatAtLeastTF { 2022-06-01 }
  { \ProcessKeyOptions [ lora ] }
  {
    \RequirePackage { l3keys2e }
    \ProcessKeysOptions { lora }
  }
%    \end{macrocode}
%
%\subsection{Setting up font}
%\label{sec:font}
%
%    \begin{macrocode}
\RequirePackage{ fontspec }

\defaultfontfeatures[ Lora ]
{
  Extension = .ttf,
  Ligatures = TeX,
  Scale     = \l_@@_scale_tl
}
%    \end{macrocode}
% \changes{v1.0.1}{2026/09/11}{Apply scale setting to all Lora variants.}
% \changes{v1.0.0}{2026/09/10}{Using named instances of fonts instead of manually setting axis values.}
%    \begin{macrocode}
\newfontfamily\lorafamily{ Lora }
[
  NFSSFamily         = lora,
  UprightFont        = Lora,
  UprightFeatures    = { RawFeature = { instance = { Regular } } },
  ItalicFont         = Lora-Italic,
  ItalicFeatures     = { RawFeature = { instance = { Regular Italic } } },
  BoldFont           = Lora,
  BoldItalicFont     = Lora-Italic,
  BoldFeatures       = { RawFeature = { instance = { Bold } } },
  BoldItalicFeatures = { RawFeature = { instance = { Bold Italic } } }
]

\newfontfamily\LoraMedium{ Lora }
[
  NFSSFamily         = loram,
  UprightFont        = Lora,
  UprightFeatures    = { RawFeature = { instance = { Medium } } },
  ItalicFont         = Lora-Italic,
  ItalicFeatures     = { RawFeature = { instance = { Medium Italic } } },
  BoldFont           = Lora,
  BoldItalicFont     = Lora-Italic,
  BoldFeatures       = { RawFeature = { instance = { Bold } } },
  BoldItalicFeatures = { RawFeature = { instance = { Bold Italic } } }
]

\newfontfamily\LoraSemiBold{ Lora }
[
  NFSSFamily         = lorasb,
  UprightFont        = Lora,
  UprightFeatures    = { RawFeature = { instance = { SemiBold } } },
  ItalicFont         = Lora-Italic,
  ItalicFeatures     = { RawFeature = { instance = { SemiBold Italic } } },
  BoldFont           = Lora,
  BoldItalicFont     = Lora-Italic,
  BoldFeatures       = { RawFeature = { instance = { Bold } } },
  BoldItalicFeatures = { RawFeature = { instance = { Bold Italic } } }
]
%    \end{macrocode}
%
% Checking whether we want the font to be default
% \changes{v1.0.2}{2026/09/15}{Added \texttt{lora.fontspec} file for \cs{setmainfont}.}
% \changes{v1.0.2}{2026/09/15}{Separate settings for \cs{setmainfont} and \cs{rmdefault}.}
%    \begin{macrocode}
\bool_if:NT \l_@@_default_bool
{
  \setmainfont{ lora }
}

\bool_if:NT \l_@@_rmdefault_bool
{
  \renewcommand{ \rmdefault } { lora }
}
%    \end{macrocode}
%
% \begin{macro}{\textlora, \textloramed, \textlorasb}
%    \begin{macrocode}
\DeclareTextFontCommand{ \textlora } { \lorafamily }
\DeclareTextFontCommand{ \textloramed } { \LoraMedium }
\DeclareTextFontCommand{ \textlorasb } { \LoraSemiBold }
%    \end{macrocode}
% \end{macro}
%
% Special characters, absent in the default
% \begin{macro}{
%   \texthryvnia,
%   \texttugrik,
%   \texttenge,
%   \textlira,
%   \textruble
% }
% Currency symbols
%    \begin{macrocode}
\DeclareUnicodeSymbol{ \texthryvnia }       { "20B4 }
\DeclareUnicodeSymbol{ \texttugrik }        { "20AE }
\DeclareUnicodeSymbol{ \texttenge }         { "20B8 }
\DeclareUnicodeSymbol{ \textlira }          { "20BA }
\DeclareUnicodeSymbol{ \textruble }         { "20BD }
%    \end{macrocode}
%   
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
% \end{implementation}
%
% \nocite{*}
% \printbibliography
%
%
%
% \PrintIndex
% \PrintChanges
