summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/roboto/roboto.sty
blob: 0b9e7f937f6e8794420df57406361eef9d8382ed (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{roboto}
    [2014/08/12 (Bob Tennent)  Supports Roboto fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifroboto@otf 
\ifxetex
  \roboto@otftrue
\else\ifluatex
  \roboto@otftrue
\else  % [pdf]LaTeX
  \roboto@otffalse
\fi\fi

\newif\ifroboto@default \roboto@defaultfalse

\newcommand*{\Roboto@scale}{1}
\newcommand*{\RobotoCondensed@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\Roboto@scale}{#1}\renewcommand*{\RobotoCondensed@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Roboto@scale}{#1}\renewcommand*{\RobotoCondensed@scale}{#1}}

\newif\ifroboto@light \roboto@lightfalse
\newif\ifroboto@thin \roboto@thinfalse
\newif\ifroboto@medium \roboto@mediumfalse
\newif\ifroboto@black \roboto@blackfalse
\newif\ifroboto@condensed \roboto@condensedfalse
\newif\ifroboto@slab  \roboto@slabfalse

\DeclareOptionX{default}{\roboto@defaulttrue}
\DeclareOptionX{sfdefault}{\roboto@defaulttrue}
\DeclareOptionX{type1}{\roboto@otffalse}
\DeclareOptionX{medium}{\roboto@mediumtrue\roboto@blackfalse}
\DeclareOptionX{bold}{\roboto@blackfalse\roboto@mediumfalse}
\DeclareOptionX{black}{\roboto@blacktrue\roboto@mediumfalse}
\DeclareOptionX{thin}{\roboto@thintrue\roboto@lightfalse}
\DeclareOptionX{light}{\roboto@lighttrue\roboto@thinfalse}
\DeclareOptionX{regular}{\roboto@lightfalse\roboto@thinfalse}
\DeclareOptionX{condensed}{\roboto@condensedtrue\roboto@thinfalse}
\DeclareOptionX{rm}{\roboto@slabtrue}

\ExecuteOptionsX{bold,regular}
\ProcessOptionsX\relax

\ifroboto@otf
  \def\roboto@boldstyle{Bold}
  \ifroboto@medium\def\roboto@boldstyle{Medium}\fi
  \ifroboto@black\def\roboto@boldstyle{Black}\fi
  \def\roboto@regstyle{Regular}
  \ifroboto@light\def\roboto@regstyle{Light}\fi
  \ifroboto@thin\def\roboto@regstyle{Thin}\fi

\else % type1

  \def\bfseries@sf{b}
  \ifroboto@medium\def\bfseries@sf{mb}\fi
  \ifroboto@black\def\bfseries@sf{k}\fi
  \def\mdseries@sf{m}
  \ifroboto@thin\def\mdseries@sf{t}
     \ifroboto@slab\def\mdseries@rm{t}\fi\fi
  \ifroboto@light\def\mdseries@sf{l}
     \ifroboto@slab\def\mdseries@rm{l}\fi\fi

\fi

\ifroboto@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
\fi

\ifroboto@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \Roboto@scale ,
        Extension = .ttf }
  \ifroboto@condensed
    \setsansfont
        [ UprightFont    = *-\roboto@regstyle ,
          ItalicFont     = *-\roboto@regstyle Italic ,
          BoldFont       = *-Bold , 
          BoldItalicFont = *-BoldItalic ]
        {RobotoCondensed}
  \else
    \setsansfont
        [ UprightFont    = *-\roboto@regstyle ,
          ItalicFont     = *-\roboto@regstyle Italic ,
          BoldFont       = *-\roboto@boldstyle , 
          BoldItalicFont = *-\roboto@boldstyle Italic ]
        {Roboto}
  \fi
  % grab current family in case of subsequent change:
  \let\robotofamily\sfdefault  
  \ifroboto@slab
    \setmainfont
        [ UprightFont    = *-\roboto@regstyle ,
          BoldFont       = *-Bold ]
        {RobotoSlab}
  \fi
  \ifroboto@default\renewcommand*\familydefault{\robotofamily}\fi
  \newfontfamily\roboto
        [ UprightFont    = *-\roboto@regstyle ,
          ItalicFont     = *-\roboto@regstyle Italic ,
          BoldFont       = *-\roboto@boldstyle , 
          BoldItalicFont = *-\roboto@boldstyle Italic ]
        {Roboto}
  \newfontfamily\robotocondensed
        [ UprightFont    = *-\roboto@regstyle ,
          ItalicFont     = *-\roboto@regstyle Italic ,
          BoldFont       = *-Bold , 
          BoldItalicFont = *-BoldItalic ]
        {RobotoCondensed}
  \newfontfamily\robotoslab
        [ UprightFont    = *-\roboto@regstyle ,
          BoldFont       = *-Bold ]
        {RobotoSlab}
\else % type1
  \def\robotofamily{Roboto-LF}
  \def\robotocondensedfamily{RobotoCondensed-LF}
  \def\robotoslabfamily{RobotoSlab-LF}
  \newcommand*\roboto{\fontfamily{\robotofamily}\selectfont}
  \newcommand*\robotocondensed{\fontfamily{\robotocondensedfamily}\selectfont}
  \newcommand*\robotoslab{\fontfamily{\robotoslabfamily}\selectfont}
  \def\sfdefault{\robotofamily}
  \ifroboto@condensed\def\sfdefault{\robotocondensedfamily}\fi  
  \ifroboto@default\edef\familydefault{\sfdefault}\edef\seriesdefault{\mdseries@sf}\fi
  \ifroboto@slab\edef\rmdefault{\robotoslabfamily}\fi
\fi

\ifroboto@otf
% turn off defaults in case other fonts are selected:
  \defaultfontfeatures{}
\fi

\endinput