Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 4 tasks
jfbu opened this issue Aug 25, 2024 · 0 comments
Open
1 of 4 tasks

Comments

@jfbu
Copy link
Contributor

jfbu commented Aug 25, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant