Skip to content

Scale with FreeMono produces counter-intuitive effect with XeLaTeX, not so with LuaLaTeX #529

@jfbu

Description

@jfbu

Description

I load FreeMono with Scale=0.90001, the x-height is reported at 3.75304pt, which is a bit larger than the 3.753pt from \small with FreeMono loaded without Scale, so far so good, but the occupied (horizontal) space is actually smaller than what is observed with \small. This happens only with XeLaTeX.

Check/indicate

  • Relevant for XeTeX
  • Relevant for LuaTeX
  • Issue tracker has been searched for similar issues?
  • Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage[hmargin=1in]{geometry}
\usepackage{fontspec}
\setmainfont{FreeSerif.otf}
\setsansfont{FreeSans.otf}
\setmonofont{FreeMono.otf}

\begin{document}
\def\texte{ a bb ccc dddd eeeee fffffff ggggggg a dddd ccc ggggggg eeeee
  fffffff bb fffffff fffffff eeeee eeeee a a bb bb ggggggg ggggggg ccc ccc
  dddd dddd a bb ccc dddd eeeee fffffff ggggggg a dddd ccc ggggggg eeeee
  fffffff bb fffffff fffffff eeeee eeeee a a bb bb ggggggg ggggggg ccc ccc
  dddd dddd a bb ccc dddd eeeee fffffff ggggggg a dddd ccc ggggggg eeeee
  fffffff bb fffffff fffffff eeeee eeeee a a bb bb ggggggg ggggggg ccc ccc
  dddd dddd } 

% \texte

% \sffamily
% \texte

\makeatletter
\raggedright

\ttfamily
normal size (\edef\x{\strip@pt\dimexpr1ex\relax}1ex=\x pt)

\texte

\small small size (\edef\y{\strip@pt\dimexpr1ex\relax}1ex=\y pt)

\texte

\normalsize

Back to normal size. Ratio small/normal is \fpeval{\y/\x}.

\def\s{0.90001}

\fontspec{FreeMono.otf}[Scale=\s]\baselineskip\s\baselineskip

Now with FreeMono at scale \s. \edef\z{\strip@pt\dimexpr1ex\relax}1ex=\z pt

\texte

\end{document}

Further details

Screenshot with LuaLaTeX build (hard to perceive visually any difference between the two paragraphs)
Capture d’écran 2024-08-25 à 14 17 15

Screenshot with XeLaTeX build:
Capture d’écran 2024-08-25 à 14 16 32

Note how the last paragraph occupies only 5 lines. But in LuaLaTeX case the two paragraphs are (visually) exactly identical.

The issue here is not so much that a tiny change may end up into a big difference, this is a characteristic of TeX, but that the ex-height is reported bigger, so we expect the occupied space to be bigger but contrary to intuition the actual paragraph becomes shorter!

Is there a problem with space font dimens? Does Scale not do exactly what one could expect it to do? Why isn't the problem seen with LuaLaTeX?

As per the funny 0.90001, I tried of course first 0.9 but it it gives a ex-height slightly below my target of 3.753pt, so I increased a bit. (by the way it may not be possible to achieve exactly 3.753pt, I have not tried too seriously and I have not looked at what does Scale trigger exactly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions