Defined a length specific to frame title format

Used the \heightof{} command from the calc package to ensure that the
height used as a strut in the beamercolorbox is consistent.

The height is set to the height of the tallest character of the font in
a typeface independent manner, and also depending on whether the frame
title is set in small caps uppercase or regular case. This ensure that
the colorbox is always the height of the text plus 1.5ex above and
below the text independent of format, text size, ratio and typeface.
This commit is contained in:
tmgriffiths 2015-07-16 14:07:31 +10:00
parent f4ddb09ad7
commit 9afeab17fe
1 changed files with 13 additions and 7 deletions

View File

@ -75,13 +75,18 @@
\pgfkeys{
/metropolis/outer/frametitleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@frametitleformat}{},
regular/.code={%
\renewcommand{\@metropolis@frametitleformat}{}%
\setlength{\@metropolis@frametitlestrut}{\heightof{ABCDEFGHIJKLMNOPQRSTUVXYZ}}% Usually around 1.6ex but is font dependant
},
lowercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeLowercase}
},
\renewcommand{\@metropolis@frametitleformat}{\MakeLowercase}%
\setlength{\@metropolis@frametitlestrut}{\heightof{abcdefghijklmnopqrstuvxyz}}
},
uppercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeUppercase}
},
\renewcommand{\@metropolis@frametitleformat}{\MakeUppercase}%
\setlength{\@metropolis@frametitlestrut}{\heightof{ABCDEFGHIJKLMNOPQRSTUVXYZ}}% Usually around 1.6ex but is font dependant
},
}
% \end{macrocode}
% \end{macro}
@ -199,13 +204,14 @@
% progress bar.
%
% \begin{macrocode}
\newlength{\@metropolis@frametitlestrut}
\defbeamertemplate{frametitle}{plain}{%
\nointerlineskip
\begin{beamercolorbox}[%
wd=\paperwidth,
sep=1.5ex,
]{frametitle}
\insertframetitle\rule{0pt}{1ex}%
\insertframetitle\rule{0pt}{\@metropolis@frametitlestrut}%
\end{beamercolorbox}%
\vspace{\@metropolis@voffset}
}
@ -215,7 +221,7 @@
wd=\paperwidth,
sep=1.5ex,
]{frametitle}
\insertframetitle\rule{0pt}{1ex}%
\insertframetitle\rule{0pt}{\@metropolis@frametitlestrut}%
\end{beamercolorbox}%
\usebeamertemplate*{progress bar in head/foot}
\vspace{\@metropolis@voffset}