summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tuda-ci/tex/tudafonts.sty
blob: 9fb3ad0600597f4eceed2250864206fcbdca2d6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
%% This is file `tudafonts.sty' version 3.41 (2024-07-02),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2018--2024 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 Maintainers of this work are
%%   Marei Peischl <tuda-ci@peitex.de>
%%
%% The development respository can be found at
%% https://github.com/tudace/tuda_latex_templates
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\def\fileversion{3.41}
\def\filedate{2024-07-02}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tudafonts}
 [\filedate\space\fileversion\space
 font loading for TUDa-CI, TU Darmstadt's Corporate Design]

\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}
}

\def\ptxcd@sffamily@lining{\robototlf}

\let\accentfont\robotoslab
\DeclareTextFontCommand{\textaccent}{\accentfont}

%adjust LaTeX kerning to font
\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}

%%-----------------------------------------------------
\endinput