<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% $Id: microtype-plain-tub.tex 634 2025-05-03 22:19:18Z karl $
% Public domain.
% This microtype-plain.tex file is a deficient and minimal
% implementation of microtype (font expansion and protrusion) for plain
% pdfTeX and plain LuaTeX.
%
% It operates only on the predefined \font control sequences \tenrm,
% \tensl, and \tenbf. (Not \tentt, since messing with typewriter can
% mess up code listings, etc.)
% 
% It uses iftex.sty to detect the engine, and assumes normal catcodes.
% 
% If anyone is interested in writing real support for microtype in
% plain, e.g., able to use the per-font configuration files in the
% microtype (LaTeX) package, that would be great.  Feel free to email
% tugboat@tug.org with code, questions, or suggestions, or just release it.

% expansion command differs between the engines.
\input iftex.sty
\ifluatex
  \adjustspacing=2
  \def\mtplntubfontexpand#1{%
    \mtplntubsetefcode#1\relax
    \expandglyphsinfont#1 20 20 1\relax}
\else
  \pdfadjustspacing=2
  \def\mtplntubfontexpand#1{%
    \mtplntubsetefcode#1\relax
    \pdffontexpand#1 20 20 1 autoexpand\relax}
\fi 

% From Thanh's efcode.tex distributed as part of pdfTeX.
% Argument is a \font control sequence, e.g., \tenrm.
\def\mtplntubsetefcode#1{%
    \efcode#1`\2=700
    \efcode#1`\3=700
    \efcode#1`\6=700
    \efcode#1`\8=700
    \efcode#1`\9=700
    \efcode#1`\A=500
    \efcode#1`\B=700
    \efcode#1`\C=700
    \efcode#1`\D=500
    \efcode#1`\E=700
    \efcode#1`\F=700
    \efcode#1`\G=500
    \efcode#1`\H=700
    \efcode#1`\K=700
    \efcode#1`\M=700
    \efcode#1`\N=700
    \efcode#1`\O=500
    \efcode#1`\P=700
    \efcode#1`\Q=500
    \efcode#1`\R=700
    \efcode#1`\S=700
    \efcode#1`\U=700
    \efcode#1`\W=700
    \efcode#1`\Z=700
    \efcode#1`\a=700
    \efcode#1`\b=700
    \efcode#1`\c=700
    \efcode#1`\d=700
    \efcode#1`\e=700
    \efcode#1`\g=700
    \efcode#1`\h=700
    \efcode#1`\k=700
    \efcode#1`\m=700
    \efcode#1`\n=700
    \efcode#1`\o=700
    \efcode#1`\p=700
    \efcode#1`\q=700
    \efcode#1`\s=700
    \efcode#1`\u=700
    \efcode#1`\w=700
    \efcode#1`\z=700
}

% enable for the basic ten-point fonts. Italics is too different.
\mtplntubfontexpand\tenrm
\mtplntubfontexpand\tensl
\mtplntubfontexpand\tenbf

%  protrusion, from Thanh's protcode.tex distributed as part of pdfTeX.
% This macro works with OT1 encoding only -- mostly ASCII,
% but assumes OT1 for quotes and dashes. See protcode.tex for more macros.
\def\mtplntubsetprotcode#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
}
\mtplntubsetprotcode\tenrm
% protrusion on slanted and bold seems potentially troublesome.

% See microtype-plain-test.tex for a test file.
</pre></body></html>