Skip to content

Commit

Permalink
Cater for system installed fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
dham committed Feb 28, 2024
1 parent c85516e commit a701956
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
31 changes: 17 additions & 14 deletions ImperialLetterhead.cls
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,33 @@
\usepackage{fontspec} % Required for specifying custom fonts

\defaultfontfeatures{Ligatures=TeX} % To support LaTeX ligatures (e.g. `` and --)
\defaultfontfeatures{Path=Fonts/} % Specify the location of font files
% Use system fonts if available, otherwise look in the Fonts folder.
\IfFontExistsTF{Imperial Sans Text}{}{
\defaultfontfeatures{Path=Fonts/} % Specify the location of font files
}

% The default font family
\setmainfont{ImperialSansText}[
UprightFont=*-Regular.ttf,
BoldFont=*-Bold.ttf
\setmainfont{Imperial Sans Text}[
UprightFont=*-Regular,
BoldFont=*-Bold
]

% The monospace font used explicitly with \texttt{}/\ttfamily
\setmonofont{ImperialSansText}[
UprightFont=*-Regular.ttf,
BoldFont=*-Bold.ttf
\setmonofont{Imperial Sans Text}[
UprightFont=*-Regular,
BoldFont=*-Bold
]

\newfontfamily{\ImperialSansMedium}{ImperialSansText}[
UprightFont=*-Medium.ttf,
BoldFont=*-Bold.ttf,
\newfontfamily{\ImperialSansMedium}{Imperial Sans Text}[
UprightFont=*-Medium,
BoldFont=*-Bold,
]

% Define the other Imperial Sans font weights
\newfontface{\ImperialSansExtraBold}{ImperialSansText-Extrabold.ttf}
\newfontface{\ImperialSansExtraLight}{ImperialSansText-Extralight.ttf}
\newfontface{\ImperialSansSemiBold}{ImperialSansText-Semibold.ttf}
\newfontface{\ImperialSansLight}{ImperialSansText-Light.ttf}
\newfontface{\ImperialSansExtraBold}{Imperial Sans Text Extrabold}
\newfontface{\ImperialSansExtraLight}{Imperial Sans Text Extralight}
\newfontface{\ImperialSansSemiBold}{Imperial Sans Text Semibold}
\newfontface{\ImperialSansLight}{Imperial Sans Text Light}

%----------------------------------------------------------------------------------------
% HEADERS AND FOOTERS
Expand Down
21 changes: 12 additions & 9 deletions ImperialPoster.cls
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,23 @@
\usepackage{fontspec} % Required for specifying custom fonts

\defaultfontfeatures{Ligatures=TeX} % To support LaTeX ligatures (e.g. `` and --)
\defaultfontfeatures{Path=Fonts/} % Specify the location of font files
% Use system fonts if available, otherwise look in the Fonts folder.
\IfFontExistsTF{Imperial Sans Text}{}{
\defaultfontfeatures{Path=Fonts/} % Specify the location of font files
}

% The default font family
\setmainfont{ImperialSansText}[
UprightFont=*-Regular.ttf,
BoldFont=*-Bold.ttf
\setmainfont{Imperial Sans Text}[
UprightFont=*-Regular,
BoldFont=*-Bold
]

% Define the other Imperial Sans font weights
\newfontface{\ImperialSansExtraBold}{ImperialSansText-Extrabold.ttf}
\newfontface{\ImperialSansExtraLight}{ImperialSansText-Extralight.ttf}
\newfontface{\ImperialSansSemiBold}{ImperialSansText-Semibold.ttf}
\newfontface{\ImperialSansMedium}{ImperialSansText-Medium.ttf}
\newfontface{\ImperialSansLight}{ImperialSansText-Light.ttf}
\newfontface{\ImperialSansExtraBold}{Imperial Sans Text Extrabold}
\newfontface{\ImperialSansExtraLight}{Imperial Sans Text Extralight}
\newfontface{\ImperialSansSemiBold}{Imperial Sans Text Semibold}
\newfontface{\ImperialSansMedium}{Imperial Sans Text Medium}
\newfontface{\ImperialSansLight}{Imperial Sans Text Light}

% Both {\small <text>\par} and \smalltext{<text>} will have the same effect in the template, with the latter being easier to use and the former being a standard LaTeX command
\renewcommand{\small}{%
Expand Down

0 comments on commit a701956

Please sign in to comment.