5

In texlive 2015 strike through for roboto font is a bit too high for lower case letters. I think the reason might be, that the unit 1ex for this font differs roughly by a factor 2 from what I would expect. I found, that I can redefine ex with \fontdimen5\font, however it seems to just change the value for the current font size.

\documentclass{article}
\usepackage[sfdefault]{roboto}
\usepackage{calc}
\usepackage[normalem]{ulem}

\begin{document}

\sout{hello world}

\newlength{\totalheightofex}
\setlength{\totalheightofex}{\totalheightof{x}}
Height of x \the\totalheightofex

\newlength{\oneex}
\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\fontdimen5\font=5.34pt
\sout{hello world}

\setlength{\totalheightofex}{\totalheightof{x}}
Height of x \the\totalheightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\large{
\sout{hello world}

\setlength{\totalheightofex}{\totalheightof{x}}
Height of x \the\totalheightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex
}
\end{document}

Output of pdflatex in texlive 2015

I guess, it would be possible to define a custom strikeout, but I would prefer to change the ex unit. Any suggestions?

2
  • I forgot to tell that Bob Tennent, the maintainer of the package, is usually very prompt in fixing bugs; you can reach him by email, the address is in the README file: mirrors.ctan.org/fonts/roboto/README
    – egreg
    Sep 9, 2015 at 11:36
  • Problem solved! See addition to answer! :-)
    – egreg
    Sep 18, 2015 at 8:35

1 Answer 1

4

It's clearly a bug in the font metric files, I think it's a regression because the parameters were good in TeX Live 2014. However, the fonts were changed in the transition to TeX Live 2015 (see Why does the Roboto font look different when used with the LaTeX package?) and the new metric files are faulty. You can somewhat cure it by changing the command executed each time a font of the family is loaded, so it sets correctly the x-height.

\documentclass{article}
\usepackage[sfdefault]{roboto}
\usepackage[normalem]{ulem}

\AtBeginDocument{\normalfont % force loading of the fd file
  % reset the x-height at each call of a font
  \expandafter\gdef\csname\encodingdefault+Roboto-LF\endcsname{%
    \fontdimen5\font=\fontcharht\font`x }%
  % also for the normal font
  \fontdimen5\font=\fontcharht\font`x
}

\newlength{\heightofex}
\newlength{\oneex}

\begin{document}

\sout{hello world}

\settoheight{\heightofex}{x}
Height of x \the\heightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\large
\sout{hello world}

\settoheight{\heightofex}{x}
Height of x \the\heightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\end{document}

However it's a kludge and the font metric information should be fixed in the TFM files by the package maintainer.

enter image description here


UPDATE: Problem solved!

With today's (2015-09-18) update to TeX Live, containing roboto revision 38386, the following document

\documentclass{article}
\usepackage[sfdefault]{roboto}
\usepackage[normalem]{ulem}

\newlength{\heightofex}
\newlength{\oneex}

\begin{document}

\sout{hello world}

\settoheight{\heightofex}{x}
Height of x \the\heightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\large
\sout{hello world}

\settoheight{\heightofex}{x}
Height of x \the\heightofex

\setlength{\oneex}{1ex}
Height of 1ex \the\oneex

\end{document}

produces

enter image description here

The height of ‘x’ is not the same as 1ex, but this is the font designer's choice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .