summaryrefslogtreecommitdiff
path: root/fonts/librebodoni/latex/LibreBodoni.sty
blob: 0017f079ead9411b6a4981b71984f320df423ebf (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
\ProvidesPackage{LibreBodoni}[%
   2016/01/12 (Bob Tennent)  Supports LibreBodoni fonts for all LaTeX engines. ] 

\RequirePackage{ifxetex,ifluatex,textcomp}

\newif\iflibrebodoni@otf
\ifxetex
  \librebodoni@otftrue
\else\ifluatex
  \librebodoni@otftrue
\else  % [pdf]LaTeX
  \librebodoni@otffalse
\fi\fi

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

\DeclareOptionX{type1}{\librebodoni@otffalse}

\ProcessOptionsX\relax

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

\iflibrebodoni@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
     Ligatures = TeX ,
     Extension = .otf ,
  }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ]
      {LibreBodoni}
  \newfontfamily\librebodoni
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ]
      {LibreBodoni}
  \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
  \providecommand\infigures{\addfontfeatures{VerticalPosition=ScientificInferior}}


\else % type1

  \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \providecommand\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}

  \fa@naming@exception{figures}{{inferior}{proportional}}{Inf}
  \fa@naming@exception{figures}{{inferior}{tabular}}{Inf}
  \providecommand\infigures{\@nomath\infigures\fontfigurestyle{inferior}\selectfont}

  \def\librebodonifamily{LibreBodoni-TLF}
  \renewcommand*\rmdefault{\librebodonifamily}
  \newcommand*\librebodoni{\fontfamily{\librebodonifamily}\selectfont}

\fi
\DeclareTextFontCommand{\textsu}{\sufigures}
\DeclareTextFontCommand{\textin}{\infigures}

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

\endinput