From f960aba4ee56aabad24ab232a71e6673e00dc0db Mon Sep 17 00:00:00 2001 From: Johan Larsson Date: Thu, 11 Jan 2024 11:17:51 +0100 Subject: [PATCH] feat!: uncouple fira fonts from theme 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. --- demo/demo.tex | 9 ++- doc/molochtheme.dtx | 123 +--------------------------------- docker/Dockerfile | 3 - docker/getFiraFont.sh | 30 --------- src/beamerfontthememoloch.dtx | 108 ----------------------------- 5 files changed, 5 insertions(+), 268 deletions(-) delete mode 100755 docker/getFiraFont.sh diff --git a/demo/demo.tex b/demo/demo.tex index 8c2923a..9bf64d0 100644 --- a/demo/demo.tex +++ b/demo/demo.tex @@ -38,11 +38,10 @@ 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 diff --git a/doc/molochtheme.dtx b/doc/molochtheme.dtx index 26ce255..eb41dc8 100644 --- a/doc/molochtheme.dtx +++ b/doc/molochtheme.dtx @@ -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} @@ -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 @@ -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 @@ -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 @@ -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} @@ -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. diff --git a/docker/Dockerfile b/docker/Dockerfile index 28a0154..c76f0df 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,8 +12,5 @@ RUN apt-get install -qy \ wget \ build-essential -ADD ./getFiraFont.sh ./getFiraFont.sh -RUN ./getFiraFont.sh - WORKDIR /data VOLUME ["/data"] diff --git a/docker/getFiraFont.sh b/docker/getFiraFont.sh deleted file mode 100755 index d11e080..0000000 --- a/docker/getFiraFont.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -## cf from http://programster.blogspot.com/2014/05/ubuntu-14-desktop-install-fira-sans-and.html - -cd /tmp - -# install unzip just in case the user doesn't already have it. -apt-get install unzip -y - -# Fonts also available at: https://github.com/bBoxType/FiraSans -wget "https://bboxtype.com/downloads/Fira/Download_Folder_FiraSans_4301.zip" -wget "https://bboxtype.com/downloads/Fira/Fira_Mono_3_2.zip" - -unzip Download_Folder_FiraSans_4301.zip -unzip Fira_Mono_3_2.zip - -sudo mkdir -p /usr/share/fonts/truetype/FiraSans -sudo mkdir -p /usr/share/fonts/opentype/FiraSans - -cp Download_Folder_FiraSans_4301/Fonts/Fira_Sans_TTF_4301/*/*/*.ttf \ - /usr/share/fonts/truetype/FiraSans/ -cp Download_Folder_FiraSans_4301/Fonts/Fira_Sans_OTF_4301/*/*/*.otf \ - /usr/share/fonts/opentype/FiraSans/ -cp Fira_Mono_3_2/Fonts/FiraMono_WEB_32/*.ttf /usr/share/fonts/truetype/FiraSans -cp Fira_Mono_3_2/Fonts/FiraMono_OTF_32/*.otf /usr/share/fonts/truetype/FiraSans - -rm Download_Folder_FiraSans_4301.zip Fira_Mono_3_2.zip -rm -rf Download_Folder_FiraSans_4301 Fira_Mono_3_2 - -fc-cache -fv diff --git a/src/beamerfontthememoloch.dtx b/src/beamerfontthememoloch.dtx index 848a023..7e225b8 100644 --- a/src/beamerfontthememoloch.dtx +++ b/src/beamerfontthememoloch.dtx @@ -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}