[lucida] Scaling the Lucida font

Bruno Voisin bvoisin at icloud.com
Wed May 4 20:40:31 CEST 2022


> On 4 May 2022, at 16:23, Raúl Martínez <rm.tech at mac.com> wrote:
> 
> But there’s an issue still open that I thought about after posting my query. The issue is that the document class specifies the font size, either as an option or by default. It’s not clear to me how font scaling plays with the font-size specification by the document class.

The basic idea is actually quite simple:

- On one hand there is the document class (.cls or .clo), which defines the standard font sizes such as \normalsize, \small, \large, etc. This is where the [10pt], [11pt] and [12pt] options come into play. This is not related to any specific font, and there is no scaling involved.

- On the other hand there are the font definition files (.fd), which associate these standard sizes with specific fonts in specific sizes, scaled or not.

The implementation, however, is all but simple.

Let's assume you write say (from lucida-sample.tex):

	\documentclass[11pt]{article}
	\usepackage[T1]{fontenc}
	\usepackage{textcomp}
	\usepackage[altbullet]{lucidabr}

First comes the "class" part.

The [11pt] option calls

	/usr/local/texlive/2022/texmf-dist/tex/latex/base/size11.clo

which says

	\renewcommand\normalsize{%
	   \@setfontsize\normalsize\@xipt{13.6}%
	[...]
	\DeclareRobustCommand\small{%
	   \@setfontsize\small\@xpt\@xiipt
	[...]
	\DeclareRobustCommand\footnotesize{%
	   \@setfontsize\footnotesize\@ixpt{11}%
	[...]
	\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
	\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt}
	\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}}
	\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}}
	\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
	\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}}
	\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}}

Given

	/usr/local/texlive/2022/texmf-dist/tex/latex/base/latex.ltx

has defined

	\def\@vpt{5}
	\def\@vipt{6}
	\def\@viipt{7}
	\def\@viiipt{8}
	\def\@ixpt{9}
	\def\@xpt{10}
	\def\@xipt{10.95}
	\def\@xiipt{12}
	\def\@xivpt{14.4}
	\def\@xviipt{17.28}
	\def\@xxpt{20.74}
	\def\@xxvpt{24.88}

this means

	\normalize	font size 10.95 pt	line spacing 13.6 pt
	\small		font size 10 pt		line spacing 12 pt
	\footnotesize	font size 9 pt		line spacing 11 pt
	\scriptize	font size 8 pt		line spacing 9.5 pt
	\tiny		font size 6 pt		line spacing 7 pt
	\large		font size 12 pt		line spacing 14 pt
	\Large		font size 14.4 pt	line spacing 18 pt
	\LARGE		font size 17.28 pt	line spacing 22 pt
	\huge		font size 20.74 pt	line spacing 25 pt
	\Huge		font size 24.88 pt	line spacing 30 pt

(the odd non-entire font sizes come from the early days of TeX, when fonts were bitmaps and sizes above 10 pt were created in advance at 1.2-multiples of 10: 10 * sqrt(1.2), 1.2, 1.2^2, 1.2^3, etc.).

Now comes the really tricky part: the "font" stuff. 

Given \usepackage[T1]{fontenc} makes T1 encoding the default, and given

	/usr/local/texlive/texmf-local/tex/latex/lucidabr/lucidabr.sty

says

	\renewcommand{\rmdefault}{hlh}

this calls

	/usr/local/texlive/texmf-local/tex/latex/lucida/t1hlh.fd

which says

	\DeclareLucidaFontShape{T1}{hlh}{m}{n}{ hlhr8t }{}

The default in lucidabr.sty is [lucidascale], namely

	\DeclareOption{lucidascale}{%
	 \def\DeclareLucidaFontShape#1#2#3#4#5#6{%
	 \DeclareFontShape{#1}{#2}{#3}{#4}{%
	  <-5.5>s*[1.04]#5%
	  <5.5-6.5>s*[1.02]#5%
	  <6.5-7.5>s*[.99]#5%
	  <7.5-8.5>s*[.97]#5%
	  <8.5-9.5>s*[.96]#5%
	  <9.5-10.5>s*[.95]#5%
	  <10.5-11.5>s*[.94]#5%
	  <11.5-13>s*[.93]#5%
	  <13-15.5>s*[.92]#5%
	  <15.5-18.5>s*[.91]#5%
	  <18.5-22.5>s*[.9]#5%
	  <22.5->s*[.89]#5%
	  }{#6}}}

Accordingly the above means

	for font sizes below 5.5, use the font metrics hlhr8t.tfm scaled by 1.04
	for font sizes between 5.5 and 6.5, use the font metrics hlhr8t.tfm scaled by 1.02
	etc.

And finally the even trickier part:

	/usr/local/texlive/texmf-local/fonts/tfm/bh/lucida/hlhb8t.tfm

is a virtual font metrics, which

	/usr/local/texlive/texmf-local/fonts/vf/bh/lucida/hlhr8t.vf

defines in terms of the actual metrics

	/usr/local/texlive/texmf-local/fonts/tfm/bh/lucida/hlhr8r.tfm

Then

	/usr/local/texlive/texmf-local/fonts/map/dvips/lucida/lucida.map

writes

	hlhr8r LucidaBright " TeXBase1Encoding ReEncodeFont " <8r.enc <lbr.pfb

telling that the metrics hlhr8r.tfm (i) corresponds to the Type 1 file

	/usr/local/texlive/texmf-local/fonts/type1/bh/lucida/lbr.pfb

containing the PostScript font named LucidaBright, and (ii) reencodes it to the TeXBase1Encoding defined in

	/usr/local/texlive/2022/texmf-dist/fonts/enc/dvips/base/8r.enc

Such is the joy of Type 1 fonts in classical (La)TeX!

Fortunately there are now OpenType fonts and XeTeX and LuaTeX, which together with the immensely convenient and powerful fontspec and unicode-math packages make things much much much easier.

The above is much better explained in the LaTeX Companion, by Frank Mittelbach and others. Frank, together with Rainer Schöpf, introduced the above font selection design, originally known as NFSS (New Font Selection Scheme), in 1989. This led to the replacement of the original version of LaTeX, 2.09, by LaTeX 2ε in 1994.

The LaTeX Companion is currently in its second edition, which is an invaluable resource for all things LaTeX. See

	https://www.latex-project.org/help/books/

Franck has been working for some time on a 3rd edition, which is scheduled for release next year. Don't believe the sites that allow pre-order already or give a release date, like

	https://www.lehmanns.de/shop/mathematik-informatik/38861146-9780134658940-the-latex-companion-3e
	https://www.pearson.com/store/p/latex-companion-the-tools-and-techniques-for-computing-typesetting/P100000261198/9780134658940

The second link, in particular, announces a release on May 5th, 2023, but that shouldn't be trusted. See

	https://tex.stackexchange.com/questions/612573/the-latex-companion-3rd-edition

Bruno




More information about the lucida mailing list.