% \iffalse meta-comment
%
% TUDa-CI -- Corporate Design for TU Darmstadt
% ----------------------------------------------------------------------------
%
%  Copyright (C) 2018--2026 by Marei Peischl <marei@peitex.de>
%
% ============================================================================
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008/05/04 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is
%   Marei Peischl <tuda-ci@peitex.de>
%
% The development repository can be found at
% https://github.com/tudace/tuda_latex_templates
% Please use the issue tracker for feedback!
%
% ============================================================================
%
% \fi
%
% \iffalse% no documentation on this
% \iffalse^^A Preparation for real docstrip documentation
%<driver>\ProvidesFile{tudafonts.dtx}
%<*package>
%<@@=ptxcd>
\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\ProvidesPackage{tudafonts}
%</package>
%<*driver|package>
  [2026-08-19 v4.08
    font setup for TUDa-CI, TU Darmstadt's Corporate Design]
%</driver|package>
%<*driver>
\typeout{***********************************************************}
\typeout{No documentation included in this file! Please see tuda-ci.pdf for more information.}
\typeout{***********************************************************}
\stop
%</driver>
%<*driver>^^A Preparation for real docstrip documentation
\providecommand*{\TUDaDocDTXfiles}{tudafonts.dtx}
\input{tuda-ci.dtx}
%</driver>
% \fi
%
% \changes{v4.00}{2025-01-26}{Converted to DTX file}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \GetFileInfo{tudafonts.dtx}
% \title{The \textsf{tudafonts} package}
% \author{Marei Peischl\thanks{Email: \href{mailto:tuda-ci@peitex.de}{tuda-ci@peitex.de}}}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
%
% \MaybeStop{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%    \begin{macrocode}
\expandafter\newif\csname if@ptxcd@T1\endcsname
\DeclareOption{T1}{\csname @ptxcd@T1true\endcsname}
\ProcessOptions\relax
\RequirePackage{iftex}
\RequirePackage{anyfontsize}
\ifPDFTeX
  \csname @ptxcd@T1true\endcsname
  %Fallback for older versions
  \expandafter\ifx\csname DeclareUnicodeCharacter\endcsname\relax
    \RequirePackage[utf8]{inputenc}
  \fi
  \expandafter\ifx\csname texteuro\endcsname\relax
    \RequirePackage{textcomp}
  \fi
  \DeclareUnicodeCharacter{20AC}{\texteuro}
\fi
\csname if@ptxcd@T1\endcsname
  \ifLuaTeX
    \RequirePackage[utf8]{luainputenc}
  \fi
  \RequirePackage{XCharter}%activates T1
  \PassOptionsToPackage{type1}{roboto}
  \PassOptionsToPackage{type1}{roboto-mono}
  %   Workaround for missing ligature replacements with roboto in T1
  \ifXeTeX
  \else
    \RequirePackage{microtype}
    \DisableLigatures{encoding = *, family=\sfdefault,shape = sc }
  \fi
\else
  \RequirePackage{fontspec}
  \setmainfont{XCharter}
\fi
\RequirePackage{roboto}
\csname if@ptxcd@T1\endcsname
  \newcommand\robotoblackspaced{%
    \robotoblack
    \lsstyle
  }
\else
  \newfontfamily\robotoblackspaced
  [ Numbers = {\roboto@figurealign,\roboto@figurestyle},
    UprightFont    = *-Black ,
    ItalicFont     = *-BlackItalic,
    LetterSpace=26,
    WordSpace=2.2
  ]
  {Roboto}
\fi
\IfFileExists{roboto-mono.sty}{
  \RequirePackage{roboto-mono}
}{
    \PackageWarningNoLine{tudafonts}{%
      The font package roboto-mono.sty could not be found.
      Probably your TeX-distribution is outdated.\MessageBreak
      For correct font setup either install it manually or update you distribution}
}
%    \end{macrocode}
%
% \begin{macro}{\ptxcd@sffamily@lining}
%    \begin{macrocode}
\def\ptxcd@sffamily@lining{\robototlf}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\let\accentfont\robotoslab
\DeclareTextFontCommand{\textaccent}{\accentfont}
%    \end{macrocode}
% adjust LaTeX Logo kerning to font
%    \begin{macrocode}
\DeclareRobustCommand{\LaTeX}{%
  {L\setbox\z@\hbox{\check@mathfonts \fontsize\sf@size\z@
        \math@fontsfalse\selectfont A}\kern-.57\wd\z@
      \sbox\tw@ T\vbox to \ht\tw@{\copy\z@ \vss}\kern-.2\wd\z@}%
    {%
      \ifdim\fontdimen1\font=\z@ \else \count\z@=\fontdimen5\font
        \multiply\count\z@ by 64\relax\divide\count\z@ by\p@
        \count\tw@=\fontdimen1\font \multiply\count\tw@ by\count\z@
        \divide\count\tw@ by 64\relax\divide\count\tw@ by\tw@
        \kern-\the\count\tw@ sp\relax\fi}%
  \TeX}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \Finale
% \fi^^A No documentation on this
\endinput
