for an issue with a LaTeX-Style (chess-problem-diagrams) I played around measuring the heights and depths of some chessfont.
I tried measuring by plain TeX means and by LaTeX means as follows:
plain-TeX:
Code: Select all
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\font\chessfont=fselch12
\setlength{\fboxsep}{0pt}
\setlength{\parindent}{0mm}
\setlength{\parskip}{2ex}
\newbox\cfb
\newlength{\cfbheight}
\newlength{\cfbdepth}
\newcounter{piece}
\setcounter{piece}{0}
\whiledo{\value{piece} < 108}{%
\setbox\cfb=\hbox{\chessfont\char\value{piece}}%
\cfbheight=\ht\cfb{}%
\cfbdepth=\dp\cfb{}%
\arabic{piece}: \fbox{\box\cfb}\ \ --- \ \ %
height: \the\cfbheight\ \ --- \ \ %
depth: \the\cfbdepth\par
\stepcounter{piece}%
}
\end{document}
LaTeX:
Code: Select all
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\font\chessfont=fselch12
\setlength{\fboxsep}{0pt}
\setlength{\parindent}{0mm}
\setlength{\parskip}{2ex}
\newsavebox{\chessfontbox}
\newlength{\chessfontheight}
\newlength{\chessfontdepth}
\newcounter{piece}
\setcounter{piece}{0}
\whiledo{\value{piece} < 108}{%
\savebox{\chessfontbox}{\chessfont\char\value{piece}}%
\settoheight{\chessfontheight}{\chessfontbox}%
\settodepth{\chessfontdepth}{\chessfontbox}%
\arabic{piece}: \fbox{\usebox{\chessfontbox}}\ \ --- \ \ %
height: \the\chessfontheight\ \ --- \ \ %
depth: \the\chessfontdepth\par
\stepcounter{piece}%
}
\end{document}
Why is there a different height when using \settoheight instead of plain-TeX \ht? (As the font is designed to be 12pt I assume that the plain-TeX result is the correct one.)
And for my final confusion: I tried to compile both using "lualatex" (instead of latex or pdflatex) in which case the height of the characters output as 6.66pt with a dept of 0.22pt when using the LaTeX method (\settoheight).
Is there anything wrong with my code?
Yours
Stefan
PS: First line of my log containing the pdfTeX version:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) (preloaded format=pdflatex 2024.12.22) 5 JAN 2025 19:11