summaryrefslogtreecommitdiff
path: root/fonts/ibarra/latex/ibarra.sty
blob: 6ea51c8cec135e4b1f2980d567f6834b8e1f2867 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ibarra}
    [2023/04/18 (Bob Tennent)  Supports IbarraRealNova Real Nova fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifibarra@ttf 
\ifxetex
  \ibarra@ttftrue
\else\ifluatex
  \ibarra@ttftrue
\else  % [pdf]LaTeX
  \ibarra@ttffalse
\fi\fi

\newif\ifibarra@default \ibarra@defaultfalse
\newif\ifibarra@semi \ibarra@semifalse
\newif\ifibarra@lining \ibarra@liningtrue
\newcommand*{\IbarraRealNova@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\IbarraRealNova@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\IbarraRealNova@scale}{#1}}

\DeclareOptionX{lining}{\ibarra@liningtrue}
\DeclareOptionX{oldstyle}{\ibarra@liningfalse}
\DeclareOptionX{type1}{\ibarra@ttffalse}
\DeclareOptionX{semibold}{\ibarra@semitrue}

\ProcessOptionsX\relax

\ifibarra@ttf
  \def\ibarra@boldstyle{Bold}
  \ifibarra@semi\def\ibarra@boldstyle{SemiBold}\fi
  \ifibarra@lining
    \def\ibarra@figurestyle{}
  \else
    \def\ibarra@figurestyle{OldStyle}
  \fi

\else % type1

  \def\bfseries@rm{b}
  \def\mdseries@rm{m}
  \ifibarra@semi\def\bfseries@rm{sb}\fi
  \ifibarra@lining
    \def\ibarra@figurestyle{LF}
  \else
    \def\ibarra@figurestyle{OsF}
  \fi
\fi

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

\ifibarra@ttf
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \IbarraRealNova@scale ,
        Extension = .ttf }
  \setmainfont
      [ Numbers = {\ibarra@figurestyle}, 
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\ibarra@boldstyle , 
        BoldItalicFont = *-\ibarra@boldstyle Italic ]
      {IbarraRealNova}
  % grab current family in case of subsequent change:
  \let\ibarrafamily\rmdefault  
  \newfontfamily\ibarra
      [ Numbers = {\ibarra@figurestyle}, 
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-\ibarra@boldstyle , 
        BoldItalicFont = *-\ibarra@boldstyle Italic ]
      {IbarraRealNova}
  \newfontfamily\ibarraSemiBold
      [ Numbers = {\ibarra@figurestyle},
        UprightFont    = *-SemiBold ,
        ItalicFont     = *-SemiBoldItalic ,
        BoldFont       = *-SemiBold , 
        BoldItalicFont = *-SemiBoldItalic ]
      {IbarraRealNova}
  \DeclareTextFontCommand{\oldstylenums}{\addfontfeatures{Numbers={OldStyle}}}
  \DeclareTextFontCommand{\liningnums}{\addfontfeatures{Numbers={}}}
\else % type1
  \def\ibarrafamily{IbarraRealNova-\ibarra@figurestyle}
  \def\ibarra{\fontfamily{\ibarrafamily}\selectfont}
  \renewcommand*\rmdefault{\ibarrafamily}
  \def\ibarraSemiBold{\fontfamily{\ibarrafamily}\fontseries{sb}\selectfont}
  \DeclareTextFontCommand{\oldstylenums}{\fontfamily{IbarraRealNova-OsF}\selectfont}
  \DeclareTextFontCommand{\liningnums}{\fontfamily{IbarraRealNova-LF}\selectfont}
\fi

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

\endinput