Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to default font if Libertinus is unavailable #7

Merged
merged 1 commit into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2018-10-02 Ista Zahn <istazahn@gmail.com>

* inst/iqssDemo/beamerfontthemeiqss.sty: Fall back to default font
if Libertinus is unavailable

* inst/rmarkdown/templates/iqss/skeleton/beamerfontthemeiqss.sty:
Ditto

2018-09-27 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Release 0.0.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ These themes use additional (free) fonts you may need to install:

- [Metropolis](https://github.com/matze/mtheme) wants [Fira Sans](https://github.com/mozilla/Fira)
but can proceed with alternate fonts;
- [IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) really requires
- [IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) wants
[Libertinus](https://github.com/libertinus-fonts/libertinus), see the
[IQSS Beamer Theme](https://github.com/IQSS/iqss-beamer-theme) page for details.
- [Presento Theme](https://github.com/RatulSaha/presento) wants
Expand Down
49 changes: 45 additions & 4 deletions inst/iqssDemo/beamerfontthemeiqss.sty
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
\usefonttheme{professionalfonts}

\RequirePackage{fontspec}

\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmathfont{Libertinus Math}
\setmonofont{Libertinus Mono}
%% checkfont and iffontsavaiable copied from the metropolis theme
%% by Matthias Vo­gelge­sang.
% Checks if a font is installed; if not, |fontsnotfound| is increased.
\newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{%
\suppressfontnotfounderror=1%
\font\x = "#1" at 10pt
\selectfont
\ifx\x\nullfont%
\stepcounter{fontsnotfound}%
\fi%
\suppressfontnotfounderror=0%
}
% Resets the |fontsnotfound| counter and calls |\checkfont| for each font in
% the comma separated list in the first argument.
\newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}%
\ifnum\value{fontsnotfound}=0%
#2%
\else%
#3%
\fi%
}

\iffontsavailable{Libertinus Serif,%
Libertinus Sans,%
LibertinusMath,%
Libertinus Mono}%
{%
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmathfont{Libertinus Math}
\setmonofont{Libertinus Mono}
}{%
\PackageWarning{beamerthememeiqss}{%
Could not find Libertinus fonts.
Please install them from
https://github.com/libertinus-fonts/libertinus/releases
following the instructions at
https://github.com/IQSS/iqss-beamer-theme/blob/master/README.md%
}
}
49 changes: 45 additions & 4 deletions inst/rmarkdown/templates/iqss/skeleton/beamerfontthemeiqss.sty
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
\usefonttheme{professionalfonts}

\RequirePackage{fontspec}

\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmathfont{Libertinus Math}
\setmonofont{Libertinus Mono}
%% checkfont and iffontsavaiable copied from the metropolis theme
%% by Matthias Vo­gelge­sang.
% Checks if a font is installed; if not, |fontsnotfound| is increased.
\newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{%
\suppressfontnotfounderror=1%
\font\x = "#1" at 10pt
\selectfont
\ifx\x\nullfont%
\stepcounter{fontsnotfound}%
\fi%
\suppressfontnotfounderror=0%
}
% Resets the |fontsnotfound| counter and calls |\checkfont| for each font in
% the comma separated list in the first argument.
\newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}%
\ifnum\value{fontsnotfound}=0%
#2%
\else%
#3%
\fi%
}

\iffontsavailable{Libertinus Serif,%
Libertinus Sans,%
LibertinusMath,%
Libertinus Mono}%
{%
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmathfont{Libertinus Math}
\setmonofont{Libertinus Mono}
}{%
\PackageWarning{beamerthememeiqss}{%
Could not find Libertinus fonts.
Please install them from
https://github.com/libertinus-fonts/libertinus/releases
following the instructions at
https://github.com/IQSS/iqss-beamer-theme/blob/master/README.md%
}
}