summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/clearsans/ClearSans.sty
blob: 5e8641b30b34738472e86f4d8bffc8cc944f2359 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ClearSans}
    [2014/03/16 (Bob Tennent)  Supports Clear-Sans fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifclear@ttf 
\ifxetex
  \clear@ttftrue
\else\ifluatex
  \clear@ttftrue
\else  % [pdf]LaTeX
  \clear@ttffalse
\fi\fi

\newif\ifclear@default \clear@defaultfalse
\newif\ifclear@medium  \clear@mediumfalse

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

\DeclareOptionX{sfdefault}{\clear@defaulttrue}
\DeclareOptionX{type1}{\clear@ttffalse}
\DeclareOptionX{medium}{\clear@mediumtrue}
\DeclareOptionX{regular}{\clear@mediumfalse}

\ProcessOptionsX\relax

\ifclear@ttf
  \def\clear@boldstyle{Bold}
  \ifclear@medium\def\clear@boldstyle{Medium}\fi

\else % type1

  \def\bfseries@sf{b}
  \def\mdseries@sf{m}
  \ifclear@medium\def\bfseries@sf{mb}\fi
\fi

\ifclear@ttf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
\fi

\ifclear@ttf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \ClearSans@scale ,
        Extension = .ttf }
  \setsansfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\clear@boldstyle , 
        BoldItalicFont = *-\clear@boldstyle Italic ]
      {ClearSans}
  % grab current family in case of subsequent change:
  \let\clearfamily\sfdefault  
  \ifclear@default\renewcommand*\familydefault{\clearfamily}\fi
  \newfontfamily\clear
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\clear@boldstyle , 
        BoldItalicFont = *-\clear@boldstyle Italic 
      ]
      {ClearSans}
  \newfontfamily\clearlight
      [ UprightFont    = *-Light ,
        BoldFont       = *-\clear@boldstyle , 
        BoldItalicFont = *-\clear@boldstyle Italic ,
      ]
      {ClearSans}
  \newfontfamily\clearthin
      [ UprightFont    = *-Thin ,
        BoldFont       = *-\clear@boldstyle , 
        BoldItalicFont = *-\clear@boldstyle Italic 
      ]
      {ClearSans}
\else % type1
  \def\clearfamily{ClearSans-LF}
  \newcommand*\clear{\fontfamily{\clearfamily}\selectfont}
  \def\sfdefault{\clearfamily}
  \ifclear@default\edef\familydefault{\sfdefault}\edef\seriesdefault{\mdseries@sf}\fi
  \newcommand*\clearlight{\fontfamily{ClearSansLight-LF}\selectfont}
  \newcommand*\clearthin{\fontfamily{ClearSansThin-LF}\selectfont}
\fi

\DeclareTextFontCommand{\textsfl}{\clearlight}
\DeclareTextFontCommand{\textsft}{\clearthin}

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

\endinput