bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

microtype for texinfo


From: Karl Berry
Subject: microtype for texinfo
Date: Sat, 17 Sep 2022 14:28:08 -0600

Hi Gavin. I've found that the microtype package for LaTeX
(https://ctan.org/pkg/microtype) helps significantly in eliminating
overfull lines without the need for rewriting text. (It also improves
the esthetic appearance of the typeset text.)

Therefore I suggest adding it to Texinfo. Maybe with a way to turn it
on/off within a document, just in case, although in practice, I have
found that I always want it.  It's most useful with the fonts used in
running text, not so much for titles and headings.

There are two main aspects to "microtypography", font expansion and
margin kerning (aka protrusion). I've found that it is the font
expansion part which is useful; it's available in LuaTeX and pdfTeX (not
XeTeX and not Knuth's original TeX). Although XeTeX supports margin
kerning, I've found that is not worth the trouble on its own and don't
recommend bothering with any XeTeX support.

Below is some code to enable both fontexpansion and margin kerning,
using plain.tex conventions. (This code is public domain -- I wrote it,
using other pd sources.) It can get much fancier, but so far this has
sufficed for me. It will need adjusting for texinfo.tex of course, but I
don't think you will find it difficult: administrivia like different
font control sequences, change the \mtpln prefix to \mttxi or some such,
different engine test, etc.

The code below does not change the typewriter font (\tentt for plain).
Although doing so would be extremely helpful for running text that
includes lots of typewriter, as Texinfo documents often do, it is
critical to then turn off microtype in typewriter displays like
@example. Otherwise the fixed-spacing alignment is visibly disturbed. I
think it would be worth doing this for Texinfo, if you have time and
energy for it.

The pdftex manual describes the primitives tersely. The microtype package
manual goes into tons of detail at every level, and has values for more
characters, etc., if desired. (Also values for additional fonts, but
that's not an issue for Texinfo.)
https://ctan.org/pkg/pdftex
https://ctan.org/pkg/microtype

Hope this is useful,
Karl

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input iftex.sty
\ifluatex
  \adjustspacing=2
  \def\mtplnfontexpand#1{%
    \expandglyphsinfont#1 20 20 1\relax}
\else
  \pdfadjustspacing=2
  \def\mtplnfontexpand#1{%
    \pdffontexpand#1 20 20 1 autoexpand\relax}
\fi 
\mtplnfontexpand\tenrm
\mtplnfontexpand\tensl
\mtplnfontexpand\tenbf

%  protrusion, from Thanh's protcode.tex.
\def\mtplnsetprotcode#1{%
    \rpcode#1`\!=200
    \rpcode#1`\,=700
    \rpcode#1`\-=700
    \rpcode#1`\.=700
    \rpcode#1`\;=500
    \rpcode#1`\:=500
    \rpcode#1`\?=200
    \lpcode#1`\`=700
    \rpcode#1`\'=700
    \lpcode#1 92=500  % ``
    \rpcode#1 34=500  % ''
    \rpcode#1 123=300 % --
    \rpcode#1 124=200 % ---
    \rpcode#1`\)=50
    \rpcode#1`\A=50
    \rpcode#1`\F=50
    \rpcode#1`\K=50
    \rpcode#1`\L=50
    \rpcode#1`\T=50
    \rpcode#1`\V=50
    \rpcode#1`\W=50
    \rpcode#1`\X=50
    \rpcode#1`\Y=50
    \rpcode#1`\k=50
    \rpcode#1`\r=50
    \rpcode#1`\t=50
    \rpcode#1`\v=50
    \rpcode#1`\w=50
    \rpcode#1`\x=50
    \rpcode#1`\y=50
    \lpcode#1`\(=50
    \lpcode#1`\A=50
    \lpcode#1`\J=50
    \lpcode#1`\T=50
    \lpcode#1`\V=50
    \lpcode#1`\W=50
    \lpcode#1`\X=50
    \lpcode#1`\Y=50
    \lpcode#1`\v=50
    \lpcode#1`\w=50
    \lpcode#1`\x=50
    \lpcode#1`\y=0
    %\adjustprotcode#1\relax
}
\mtplnsetprotcode\tenrm

%\hsize=2.2in
%\input story
%\bye



reply via email to

[Prev in Thread] Current Thread [Next in Thread]