summaryrefslogtreecommitdiff
path: root/fonts/crimson/latex/crimson.sty
blob: af3ca3fc3f6bac6fc9082336cedb540da6960b4d (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
\ProvidesPackage{crimson}[%
   2017/03/16 (Bob Tennent)  Supports crimson fonts for all LaTeX engines. ] 

\RequirePackage{ifxetex,ifluatex,textcomp}

\newif\ifcrimson@otf
\ifxetex
  \crimson@otftrue
\else\ifluatex
  \crimson@otftrue
\else  % [pdf]LaTeX
  \crimson@otffalse
\fi\fi

\newcommand*{\Crimson@scale}{1}  
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\Crimson@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Crimson@scale}{#1}}

\newif\ifcrimson@semibold  \crimson@semiboldfalse

\DeclareOptionX{type1}{\crimson@otffalse}
\DeclareOptionX{semibold}{\crimson@semiboldtrue}
\DeclareOptionX{sb}{\crimson@semiboldtrue}
\DeclareOptionX{bold}{\crimson@semiboldfalse}

\ProcessOptionsX\relax

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

\ifcrimson@otf
  \def\crimson@boldstyle{Bold}
  \ifcrimson@semibold\def\crimson@boldstyle{Semibold}\fi

\else % type1

  \def\bfseries@rm{b}
  \ifcrimson@semibold\def\bfseries@rm{sb}\fi

  \def\mdseries@rm{m}
\fi


\ifcrimson@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
     Ligatures = TeX ,
     Scale = \Crimson@scale,
     Extension = .otf ,
  }
  \setmainfont
      [ UprightFont    = *-Roman ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\crimson@boldstyle , 
        BoldItalicFont = *-\crimson@boldstyle Italic ]
      {Crimson}
  \newfontfamily\crimson
      [ UprightFont    = *-Roman ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\crimson@boldstyle , 
        BoldItalicFont = *-\crimson@boldstyle Italic ]
      {Crimson}
  \newfontfamily\crimsonsemibold
      [ UprightFont    = *-Semibold ,
        ItalicFont     = *-SemiboldItalic ,
        BoldFont       = *-Semibold , 
        BoldItalicFont = *-SemiboldItalic ]
      {Crimson}

\else % type1

  \def\crimson@family{Crimson-TLF}
  \renewcommand*\rmdefault{\crimson@family}
  \newcommand*\crimson{\fontfamily{\crimson@family}\selectfont}
  \def\crimsonsemibold{\fontfamily{\crimson@family}\fontseries{sb}\selectfont}

\fi

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

\endinput