Skip to content

Commit

Permalink
feat!: uncouple fira fonts from theme
Browse files Browse the repository at this point in the history
This commit removes all special logic related to the fira fonts and leaves it up
to the user to set up the fonts as they please.
  • Loading branch information
jolars committed Jan 11, 2024
1 parent d5317d4 commit f960aba
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 268 deletions.
9 changes: 4 additions & 5 deletions demo/demo.tex
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ \section{Introduction}

Enable the theme by loading

\begin{verbatim} \documentclass{beamer}
\usetheme{moloch}\end{verbatim}

Note, that you have to have Mozilla's \emph{Fira Sans} font and XeTeX
installed to enjoy this wonderful typography.
\begin{verbatim}
\documentclass{beamer}
\usetheme{moloch}
\end{verbatim}
\end{frame}
\begin{frame}[fragile]{Sections}
Sections group slides of the same topic
Expand Down
123 changes: 1 addition & 122 deletions doc/molochtheme.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,6 @@
\onehalfspacing

\usepackage{etoolbox}
\usepackage{ifxetex}
\usepackage{ifluatex}

\ifboolexpr{bool {xetex} or bool {luatex}}{
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}

\newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{%
\suppressfontnotfounderror=1%
\font\x = "#1" at 10pt
\selectfont
\ifx\x\nullfont%
\stepcounter{fontsnotfound}%
\fi%
\suppressfontnotfounderror=0%
}

\newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}%
\ifnum\value{fontsnotfound}=0%
#2%
\else%
#3%
\fi%
}
\iffontsavailable{Fira Sans Light,%
Fira Sans Light Italic,%
Fira Sans,%
Fira Sans Italic}{%
\setmainfont[BoldFont={Fira Sans}]{Fira Sans Light}%
}{%
\iffontsavailable{Fira Sans Light OT,%
Fira Sans Light Italic OT,%
Fira Sans OT,%
Fira Sans Italic OT}{%
\setmainfont[BoldFont={Fira Sans OT}]{Fira Sans Light OT}%
}{%
\typeout{%
Could not find Fira Sans fonts. Creating documentation%
with standard fonts.%
}
}
}
\iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont{Fira Mono}%
}{%
\iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
\setmonofont{Fira Mono OT}%
}{%
\typeout{%
Could not find Fira Sans fonts. Creating documentation%
with standard monospaced fonts.%
}
}
}
}{
\typeout{%
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts.%
}
}

\usepackage{enumitem}
\setlist[itemize]{noitemsep}
Expand Down Expand Up @@ -170,14 +107,6 @@ for anyone to use. It tries to minimize noise and maximize space for content;
the only visual flourish it offers is an (optional) progress bar added to each
slide or to the section slides.

By default, \themename uses
\href{https://www.mozilla.org/en-US/styleguide/products/firefox-os/typeface/}
{Fira Sans}, a gorgeous typeface commissioned by Mozilla and designed by
\href{http://www.carrois.com/fira-3-1/}{Carrois}. For best results, you will
need the Fira typeface installed and use \XeLaTeX\ to typeset your slides.
However, \themename can also be used with other typefaces and \LaTeX{} build
systems.

\themename's codebase is maintained on \href{https://github.com/matze/mtheme}
{GitHub}. If you have issues, find mistakes in the manual or want to help make
the theme even better, please get in touch there. The
Expand Down Expand Up @@ -211,10 +140,6 @@ Mac\TeX\ on OS X also provides a graphical interface for |tlmgr| called
For any other distribution please refer to its documentation on how to update
your packages.

To get the most out of the theme you should also install the |Fira| fonts.
However, this is not mandatory; \themename also works with the standard fonts.


\subsection{Installing from GitHub}

If you want to use the cutting-edge development version of \themename, you can
Expand Down Expand Up @@ -288,17 +213,6 @@ The following code shows a minimal example of a Beamer presentation using
\end{itemize}
\end{multicols}

For best results, we recommend installing the fonts
\href{https://github.com/mozilla/Fira}{|Fira Sans|} and |Fira Mono|
and compiling with \themename using \XeLaTeX\ or \LuaTeX.
These are optional dependencies; \themename is compatible with (e.g.)
pdf\LaTeX\ and will fall back to standard fonts if |Fira Sans| or |Fira Mono|
is not installed.

The packaged name of |Fira Sans| is |Fira Sans OT| in some Linux
distributions; this case is automatically handled by \themename.


\subsection{Pandoc}

To use this theme with \href{http://johnmacfarlane.net/pandoc/}{Pandoc}-based
Expand Down Expand Up @@ -440,41 +354,6 @@ For low-light situations \themename it might be helpful to use the
\end{lstlisting}


\subsection{Font Customization}

The default font for \themename is |Fira|. This can be easily changed using
the standard font selection commands of the \textsf{fontspec} package. So if
you prefer, for example, the \href{http://font.ubuntu.com}{|Ubuntu|} font family, just add the following two commands after loading the \themename theme.

\begin{lstlisting}
\setsansfont{Ubuntu}
\setmonofont{Ubuntu Mono}
\end{lstlisting}

If you are expecting to present in a large room or with an underpowered
projector, you may want to change the font to a heavier weight of Fira to
maximize readability.

\begin{lstlisting}
\setsansfont[BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
\end{lstlisting}


\subsubsection{Old style figures}

The regular \textsf{fontspec} mechanism for changing glyph appearance applies
also to this theme. If you want to have old style figures in the text but
regular lined figures for math, you could add the following to your preamble:

\begin{lstlisting}
\usefonttheme{professionalfonts} % required for mathspec
\usepackage{mathspec}
\setsansfont[BoldFont={Fira Sans},
Numbers={OldStyle}]{Fira Sans Light}
\setmathsfont(Digits)[Numbers={Lining, Proportional}]{Fira Sans Light}
\end{lstlisting}


\subsection{Commands}

\subsubsection{Standout frames}
Expand Down Expand Up @@ -548,7 +427,7 @@ slides in the appendix.
\label{sec:titleformats}

Be aware that not every font supports small caps, so the |smallcaps| or
|allsmallcaps| options may not work if you use a font other than |Fira Sans|.
|allsmallcaps| options may not work for all fonts.
In particular, the Computer Modern sans-serif typeface, which is used when
\themename is compiled with pdf\LaTeX, does not have a small-caps variant.

Expand Down
3 changes: 0 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ RUN apt-get install -qy \
wget \
build-essential

ADD ./getFiraFont.sh ./getFiraFont.sh
RUN ./getFiraFont.sh

WORKDIR /data
VOLUME ["/data"]
30 changes: 0 additions & 30 deletions docker/getFiraFont.sh

This file was deleted.

108 changes: 0 additions & 108 deletions src/beamerfontthememoloch.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -36,114 +36,6 @@
\RequirePackage{pgfopts}
% \end{macrocode}
%
%
%
% \subsubsection{Load Fira fonts}
%
% If the presentation is compiled with Xe\LaTeX{} or Lua\LaTeX{}, the fontspec
% package is loaded and we search for the |Fira| fonts.
%
% \begin{macrocode}
\ifboolexpr{bool {xetex} or bool {luatex}}{
\@ifpackageloaded{fontspec}{
\PassOptionsToPackage{no-math}{fontspec}
}{
\RequirePackage[no-math]{fontspec}
}
% \end{macrocode}
%
% \begin{macro}{\checkfont}
% Checks if a font is installed; if not, |fontsnotfound| is increased.
% \begin{macrocode}
\newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{%
\suppressfontnotfounderror=1%
\font\x = "#1" at 10pt
\selectfont
\ifx\x\nullfont%
\stepcounter{fontsnotfound}%
\fi%
\suppressfontnotfounderror=0%
}

% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\iffontsavailable}
% Resets the |fontsnotfound| counter and calls |\checkfont| for each font in
% the comma separated list in the first argument.
% \begin{macrocode}
\newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}%
\ifnum\value{fontsnotfound}=0%
#2%
\else%
#3%
\fi%
}
% \end{macrocode}
% \end{macro}
%
% We search for regular, italic, light, light italic, mono, and mono bold
% fonts under the default |Fira Sans| and |Fira Mono| names. If this fails,
% the suffix OT --- used by some Linux distributions --- will be tried. If this
% also fails, a warning will be displayed and the standard fonts will be used.
%
% \begin{macrocode}
\iffontsavailable{Fira Sans Light,%
Fira Sans Light Italic,%
Fira Sans,%
Fira Sans Italic}%
{%
\setsansfont[ItalicFont={Fira Sans Light Italic},%
BoldFont={Fira Sans},%
BoldItalicFont={Fira Sans Italic}]%
{Fira Sans Light}%
}{%
\iffontsavailable{Fira Sans Light OT,%
Fira Sans Light Italic OT,%
Fira Sans OT,%
Fira Sans Italic OT}%
{%
\setsansfont[ItalicFont={Fira Sans Light Italic OT},%
BoldFont={Fira Sans OT},%
BoldItalicFont={Fira Sans Italic OT}]%
{Fira Sans Light OT}%
}{%
\PackageWarning{beamerthememoloch}{%
Could not find Fira Sans fonts%
}
}
}
\iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}%
}{%
\iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
\setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}%
}{%
\PackageWarning{beamerthememoloch}{%
Could not find Fira Mono fonts%
}
}
}
\AtBeginEnvironment{tabular}{%
\addfontfeature{Numbers={Monospaced}}%
}
}{%
\PackageWarning{beamerthememoloch}{%
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
}
}
% \end{macrocode}
%
% This concludes the portion of the code which is only run when compiled with
% Xe\LaTeX{} or Lua\LaTeX{}. The remainder of this package applies regardless
% of the compiling engine.
%
%
%
% \subsubsection{General font definitions}
%
% \begin{macrocode}
Expand Down

0 comments on commit f960aba

Please sign in to comment.