| 1 |
%% |
| 2 |
%% This is file `microtype-show.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% microtype.dtx (with options: `show') |
| 8 |
%% |
| 9 |
%% ------------------------------------------------------------------------ |
| 10 |
%% |
| 11 |
%% The `microtype' package |
| 12 |
%% Subliminal refinements towards typographical perfection |
| 13 |
%% Copyright (c) 2004--2026 R Schlicht <[email protected]> |
| 14 |
%% |
| 15 |
%% This work may be distributed and/or modified under the conditions of the |
| 16 |
%% LaTeX Project Public License, either version 1.3c of this license or (at |
| 17 |
%% your option) any later version. The latest version of this license is in: |
| 18 |
%% https://www.latex-project.org/lppl.txt, and version 1.3c or later is part |
| 19 |
%% of all distributions of LaTeX version 2005/12/01 or later. |
| 20 |
%% |
| 21 |
%% This work has the LPPL maintenance status `maintained'. |
| 22 |
%% |
| 23 |
%% This work consists of the files microtype.dtx, microtype-utf.dtx and |
| 24 |
%% microtype.ins and the derived files microtype.sty, microtype-pdftex.def, |
| 25 |
%% microtype-luatex.def, microtype-xetex.def, microtype.lua, letterspace.sty |
| 26 |
%% and microtype-show.sty. |
| 27 |
%% |
| 28 |
%% ------------------------------------------------------------------------ |
| 29 |
%% This companion package offers various commands that might be helpful |
| 30 |
%% when creating protrusion settings. See the documentation in microtype's |
| 31 |
%% User manual, section 10, and the examples in test-microtype.tex. |
| 32 |
%% ------------------------------------------------------------------------ |
| 33 |
%% |
| 34 |
\NeedsTeXFormat{LaTeX2e} |
| 35 |
\ProvidesPackage |
| 36 |
{microtype-show} |
| 37 |
[2026/03/01 v3.2d |
| 38 |
Visual debugging for the microtype package |
| 39 |
(RS)] |
| 40 |
\RequirePackage{iftex} |
| 41 |
\ifetex\else |
| 42 |
\PackageError{microtype-show} |
| 43 |
{This package only works with e-TeX}{Use e-TeX} |
| 44 |
\fi |
| 45 |
\ifxetex |
| 46 |
\PackageError{microtype-show} |
| 47 |
{This package only works with pdfTeX or luaTeX}{Don't use XeTeX} |
| 48 |
\fi |
| 49 |
\PackageWarning{microtype-show}{DO NOT USE THIS PACKAGE FOR REAL DOCUMENTS\@gobble} |
| 50 |
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{microtype}} |
| 51 |
\ProcessOptions\relax |
| 52 |
\PassOptionsToPackage{verbose}{microtype} |
| 53 |
\RequirePackage{microtype,graphicx,xcolor} |
| 54 |
\newif\ifShowGlyphIndex |
| 55 |
\newif\ifShowMissingGlyphs |
| 56 |
\newcommand*\GlyphScaleFactor{2} |
| 57 |
\newcommand*\Showbaselinecolor{\color{black!40}} |
| 58 |
\newcommand*\Showposcolor{\color{green!50}} |
| 59 |
\newcommand*\Shownegcolor{\color{red!50}} |
| 60 |
\ifluatex |
| 61 |
\def\MTS@printtext#1{{\usefont{TU}{lmr}{m}{n}#1}} |
| 62 |
\else |
| 63 |
\def\MTS@printtext#1{{\usefont{T1}{cmr}{m}{n}#1}} |
| 64 |
\fi |
| 65 |
\def\MTS@show@index#1{\ifShowGlyphIndex{\tiny$_{#1}% |
| 66 |
% \ifluatex^{\mathrm{% |
| 67 |
% \MT@lua{tex.print(luaotfload.aux.name_of_slot(tonumber([[#1]])))}}}\fi |
| 68 |
$}\fi\space} |
| 69 |
\def\MTS@crulefill{\leaders\hrule height \dimexpr1ex/2+.4pt depth -\dimexpr1ex/2\hfill} |
| 70 |
\g@addto@macro\MT@setupfont{\MTS@Prot\MTS@Char} |
| 71 |
\let\MTS@Prot\relax |
| 72 |
\let\MTS@Char\relax |
| 73 |
\def\MTS@setup{% |
| 74 |
\fboxsep=0pt |
| 75 |
\fboxrule=.1pt |
| 76 |
\raggedright |
| 77 |
\let\MTS@glyphlist\@gobble |
| 78 |
\def\MT@feat{pr}% |
| 79 |
} |
| 80 |
\newcommand*\ShowProtrusion{% |
| 81 |
\begingroup |
| 82 |
\MTS@setup |
| 83 |
\let\MTS@Prot\MTS@Prot@do |
| 84 |
\def\MT@cat{c}% |
| 85 |
\selectfont |
| 86 |
} |
| 87 |
\def\MTS@Prot@do{% |
| 88 |
\MT@ltx@pickupfont |
| 89 |
\let\MT@pr@split@val\MTS@pr@split@val |
| 90 |
\let\MT@load@list\MTS@load@list |
| 91 |
\let\MT@set@pr@prefixes@\MTS@set@pr@prefixes@ |
| 92 |
\MTS@show@pr |
| 93 |
\endgroup |
| 94 |
\aftergroup\selectfont |
| 95 |
} |
| 96 |
\newcommand*\ShowCharacterInheritance{% |
| 97 |
\begingroup |
| 98 |
\MTS@setup |
| 99 |
\let\MTS@Char\MTS@Char@do |
| 100 |
\def\MT@cat{inh}% |
| 101 |
\selectfont |
| 102 |
} |
| 103 |
\def\MTS@Char@do{% |
| 104 |
\MT@ltx@pickupfont |
| 105 |
\let\MT@set@pr@prefixes@\MTS@set@pr@prefixes@ |
| 106 |
\MTS@show@inheritance |
| 107 |
\endgroup |
| 108 |
\aftergroup\selectfont |
| 109 |
} |
| 110 |
\newcommand*\ShowProtrusionLineGlyph[1]{% |
| 111 |
{\MTS@setup |
| 112 |
\MTS@showprotrusionline{`#1}}% |
| 113 |
} |
| 114 |
\newcommand*\ShowProtrusionLineIndex[1]{% |
| 115 |
{\MTS@setup |
| 116 |
\MTS@showprotrusionline{#1}}% |
| 117 |
} |
| 118 |
\def\MTS@showprotrusionline#1{% |
| 119 |
\edef\MTS@lpcode{\number\lpcode\font#1}% |
| 120 |
\edef\MTS@rpcode{\number\rpcode\font#1}% |
| 121 |
\char#1% |
| 122 |
lorem ipsum dolor sit amet, \MTS@crulefill\ % |
| 123 |
\MTS@printtext{\ifnum\MTS@lpcode=\z@\Showbaselinecolor\fi[\MTS@lpcode]} |
| 124 |
\fbox{\char#1}\MTS@show@index{\number#1} |
| 125 |
\MTS@printtext{\ifnum\MTS@rpcode=\z@\Showbaselinecolor\fi[\MTS@rpcode]} |
| 126 |
\MTS@crulefill\ you know the rest% |
| 127 |
\char#1\par |
| 128 |
\ShowDummyLine |
| 129 |
} |
| 130 |
\newcommand*\ShowDummyLine{% |
| 131 |
{\fontencoding{\encodingdefault}\fontseries{\seriesdefault}\fontshape{\shapedefault}% |
| 132 |
\selectfont\noindent |
| 133 |
here is the beginning of a line, \dotfill and here is its end}\par |
| 134 |
} |
| 135 |
\newcommand*\ShowProtrusionAll{% |
| 136 |
{\MTS@setup |
| 137 |
\MTS@lede{}% |
| 138 |
\MT@do@font{\iffontchar\font\@tempcnta\MTS@showprotrusionline{\@tempcnta}\fi}}% |
| 139 |
} |
| 140 |
\newcommand*\ShowProtrusionDefined{% |
| 141 |
{\MTS@setup |
| 142 |
\MTS@lede{defined}% |
| 143 |
\let\MTS@first\@gobble |
| 144 |
\let\MTS@second\@firstofone |
| 145 |
\MT@do@font{% |
| 146 |
\MTS@firstorsecond |
| 147 |
\MTS@temp{% |
| 148 |
\iffontchar\font\@tempcnta\MTS@showprotrusionline{\@tempcnta}\else |
| 149 |
\MT@warning@nl{Glyph \the\@tempcnta\space is missing in font |
| 150 |
\MessageBreak\font@name}% |
| 151 |
\fi}}}% |
| 152 |
} |
| 153 |
\newcommand*\ShowProtrusionMissing{% |
| 154 |
{\MTS@setup |
| 155 |
\MTS@lede{missing}% |
| 156 |
\let\MTS@first\@firstofone |
| 157 |
\let\MTS@second\@gobble |
| 158 |
\MT@do@font{% |
| 159 |
\MTS@firstorsecond |
| 160 |
\iffontchar\font\@tempcnta\MTS@temp{\MTS@showprotrusionline{\@tempcnta}}\fi}}% |
| 161 |
} |
| 162 |
\def\MTS@lede#1{% |
| 163 |
\selectfont |
| 164 |
\edef\MTS@font{\expandafter\string\font@name}% |
| 165 |
\MTS@printtext{All glyphs \MT@ifempty{#1}{in}{#1 in protrusion list for} |
| 166 |
font \texttt{\MTS@font}:}\par |
| 167 |
\ShowDummyLine |
| 168 |
} |
| 169 |
\def\MTS@firstorsecond{% |
| 170 |
\let\MTS@temp\MTS@first |
| 171 |
\ifnum\lpcode\font\@tempcnta=\z@ \else |
| 172 |
\let\MTS@temp\MTS@second |
| 173 |
\fi |
| 174 |
\ifnum\rpcode\font\@tempcnta=\z@ \else |
| 175 |
\let\MTS@temp\MTS@second |
| 176 |
\fi |
| 177 |
} |
| 178 |
\newdimen\MTS@charwd |
| 179 |
\newdimen\MTS@lp@ |
| 180 |
\newdimen\MTS@rp@ |
| 181 |
\def\MTS@show@char@pr#1{% |
| 182 |
\xdef\MTS@glyphlist{\MTS@glyphlist,#1}% |
| 183 |
\scalebox{\GlyphScaleFactor}{\strut\escapechar`\\ |
| 184 |
\MTS@charwd=\fontcharwd\MT@font#1\relax |
| 185 |
{\Showbaselinecolor\vrule width \dimexpr\MTS@charwd+.3em\relax height 1sp depth 0pt}% |
| 186 |
\hskip-\dimexpr\MTS@charwd+.15em\relax |
| 187 |
{\ifdim\MTS@lp@<\z@\Shownegcolor\else\Showposcolor\fi |
| 188 |
\vrule width \ifdim\MTS@lp@<\z@ -\fi\MTS@lp@ height 1em depth .2em}% |
| 189 |
\hskip\dimexpr\MTS@charwd\ifdim\MTS@lp@>\z@-\MTS@lp@\fi |
| 190 |
\ifdim\MTS@rp@>\z@-\MTS@rp@\fi\relax |
| 191 |
{\ifdim\MTS@rp@<\z@\Shownegcolor\else\Showposcolor\fi |
| 192 |
\vrule width \ifdim\MTS@rp@<\z@ -\fi\MTS@rp@ height 1em depth .2em}% |
| 193 |
\hskip-\dimexpr\MTS@charwd+\fboxrule\ifdim\MTS@rp@<\z@-\MTS@rp@\fi\relax |
| 194 |
\fbox{\char#1}}\,% |
| 195 |
\MTS@show@index{#1}% |
| 196 |
} |
| 197 |
\def\MTS@show@char#1{\scalebox{\GlyphScaleFactor}{% |
| 198 |
\strut\fbox{\char#1}}\MTS@show@index{#1}} |
| 199 |
\def\MTS@show@char@x#1{\xdef\MTS@glyphlist{\MTS@glyphlist,#1}\MTS@show@char{#1}} |
| 200 |
\def\MTS@show@missing{% |
| 201 |
\MT@ifdefined@c@T\MT@pr@inh@name{% |
| 202 |
\MTS@lp@=\z@ \MTS@rp@=\z@ |
| 203 |
\par \MTS@printtext{Glyphs not included in configuration (with defined heirs):}% |
| 204 |
\MT@do@font{% |
| 205 |
\edef\MT@temp{\the\@tempcnta}% |
| 206 |
\MT@ifdefined@n@T{MT@inh@\MT@pr@inh@name @\MT@temp @}{% |
| 207 |
\MT@exp@one@n\MT@in@clist\MT@temp\MTS@glyphlist |
| 208 |
\ifMT@inlist@\else \newline |
| 209 |
\llap{\MTS@show@char@pr{\MT@temp} \MTS@printtext{=} }% |
| 210 |
\MT@exp@cs\MT@map@tlist@c |
| 211 |
{MT@inh@\MT@pr@inh@name @\the\@tempcnta @}% |
| 212 |
\MTS@show@char@x |
| 213 |
\fi |
| 214 |
}% |
| 215 |
}% |
| 216 |
}% |
| 217 |
\MTS@show@missing@ |
| 218 |
} |
| 219 |
\def\MTS@show@missing@{% |
| 220 |
\par \MTS@printtext{Other glyphs not in configuration:}\newline |
| 221 |
\MT@do@font{% |
| 222 |
\edef\MT@temp{\the\@tempcnta}% |
| 223 |
\MT@exp@one@n\MT@in@clist\MT@temp\MTS@glyphlist |
| 224 |
\ifMT@inlist@\else |
| 225 |
\MTS@show@char\MT@temp |
| 226 |
\fi |
| 227 |
}% |
| 228 |
} |
| 229 |
\def\MTS@show@inheritance{% |
| 230 |
\MT@get@inh@list |
| 231 |
\MTS@printtext{Character inheritance for font `\texttt{\MT@@font}':}\\ |
| 232 |
\MT@ifdefined@c@TF\MT@listname{% |
| 233 |
\MTS@printtext{First matching list is for `\texttt{\@tempa}':\\ |
| 234 |
\texttt{\MT@listname}:}\par\leavevmode |
| 235 |
\MT@do@font{% |
| 236 |
\MT@ifdefined@n@T{MT@inh@\MT@listname @\the\@tempcnta @}{% |
| 237 |
\newline |
| 238 |
\xdef\MTS@glyphlist{\MTS@glyphlist,\the\@tempcnta}% |
| 239 |
\llap{\MTS@show@char{\the\@tempcnta}\MTS@printtext{= }}% |
| 240 |
\MT@exp@cs\MT@map@tlist@c |
| 241 |
{MT@inh@\MT@listname @\the\@tempcnta @}% |
| 242 |
\MTS@show@char@x |
| 243 |
}% |
| 244 |
}% |
| 245 |
\MT@ifdefined@n@T{MT@inh@\MT@listname @prefixes}{% |
| 246 |
\par \MTS@printtext{(with prefixes:)}% |
| 247 |
\@tempcntb=\z@ |
| 248 |
\let\MTS@show@char@pr\MTS@show@char@x |
| 249 |
\MT@set@pr@prefixheirs}% |
| 250 |
\ifShowMissingGlyphs\MTS@show@missing@\fi |
| 251 |
}{% |
| 252 |
\MTS@printtext{NOT DEFINED}% |
| 253 |
}% |
| 254 |
\par |
| 255 |
} |
| 256 |
\def\MTS@show@pr |
| 257 |
{% |
| 258 |
\MTS@printtext{Protrusion settings for font `\texttt{\MT@@font}':}\\ |
| 259 |
\MT@if@list@exists{% |
| 260 |
\MTS@printtext{First matching list is for `\texttt{\@tempa}':\\\texttt{\MT@pr@c@name}}% |
| 261 |
\MT@get@opt |
| 262 |
\MT@reset@pr@codes |
| 263 |
\MT@get@inh@list |
| 264 |
\MT@set@inputenc{c}% |
| 265 |
\MT@load@list\MT@pr@c@name |
| 266 |
\MT@set@listname |
| 267 |
\MT@let@cn\@tempc{MT@pr@c@\MT@pr@c@name}% |
| 268 |
\expandafter\MT@set@codes\@tempc,\relax,% |
| 269 |
\vrule width 4cm height .5pt \\ |
| 270 |
\MTS@printtext{End of list `\texttt{\MT@pr@c@name}'}\\[.5em] |
| 271 |
\MT@ifdefined@c@T\MT@pr@inh@name{% |
| 272 |
\MT@ifdefined@n@T{MT@inh@\MT@pr@inh@name @prefixes}{% |
| 273 |
\par \MTS@printtext{(with prefixes:)}% |
| 274 |
\@tempcntb=\z@ |
| 275 |
\MT@set@pr@prefixheirs |
| 276 |
}}% |
| 277 |
\ifShowMissingGlyphs\MTS@show@missing\fi |
| 278 |
}% |
| 279 |
{\MTS@printtext{NOT DEFINED}% |
| 280 |
\MT@reset@pr@codes |
| 281 |
}\par |
| 282 |
} |
| 283 |
\def\MTS@pr@split@val#1,#2\relax |
| 284 |
{\def\@tempb{#1}% |
| 285 |
\MT@ifempty\@tempb |
| 286 |
{\MTS@lp@=\z@ \let\MTS@lpcode\@empty}% |
| 287 |
{\MT@scale@to@em |
| 288 |
\MTS@lp@=\dimexpr\@tempcntb em/1000\relax\relax |
| 289 |
\edef\MTS@lpcode{[\@tempb] \the\@tempcntb/\the\MTS@lp@}% |
| 290 |
}% |
| 291 |
\def\@tempb{#2}% |
| 292 |
\MT@ifempty\@tempb |
| 293 |
{\MTS@rp@=\z@ \let\MTS@rpcode\@empty}% |
| 294 |
{\MT@scale@to@em |
| 295 |
\MTS@rp@=\dimexpr\@tempcntb em/1000\relax\relax |
| 296 |
\edef\MTS@rpcode{[\@tempb] \the\@tempcntb/\the\MTS@rp@}% |
| 297 |
}% |
| 298 |
\llap{\MTS@show@char@pr\MT@char\quad}% |
| 299 |
\parbox[b][][b]{3.5cm}{\MTS@printtext{% |
| 300 |
\footnotesize\makebox[.4cm][l]{L:} \MT@ifempty{\MTS@lpcode}{---}{\MTS@lpcode}\\ |
| 301 |
\makebox[.4cm][l]{R:} \MT@ifempty{\MTS@rpcode}{---}{\MTS@rpcode}}}% |
| 302 |
\parbox[t][][t]{\dimexpr\textwidth-3.5cm}{% |
| 303 |
\MT@ifdefined@c@T\MT@pr@inh@name{% |
| 304 |
\MT@ifdefined@n@T{MT@inh@\MT@pr@inh@name @\MT@char @}{% |
| 305 |
\MT@exp@cs\MT@map@tlist@c |
| 306 |
{MT@inh@\MT@pr@inh@name @\MT@char @}% |
| 307 |
\MTS@show@char@pr |
| 308 |
}% |
| 309 |
}% |
| 310 |
}\newline |
| 311 |
} |
| 312 |
\def\MTS@set@pr@prefixes@#1#2#3#4% |
| 313 |
{% |
| 314 |
\MTS@lp@=\z@ \MTS@rp@=\z@ |
| 315 |
\ifnum#1=\@tempcntb \else |
| 316 |
\par\leavevmode |
| 317 |
\llap{\MTS@show@char@pr{#1} \MTS@printtext{=} }% |
| 318 |
\fi |
| 319 |
\@tempcnta=\z@ |
| 320 |
\ifnum#3>\z@ |
| 321 |
\@tempcnta=\numexpr |
| 322 |
(\fontcharwd\MT@font#2-\fontcharwd\MT@font#1)% |
| 323 |
*#3/\MT@dimen@six\relax |
| 324 |
\fi |
| 325 |
\MTS@lp@=\dimexpr\numexpr\lpcode\MT@font#1+\@tempcnta\relax em/1000\relax |
| 326 |
\@tempcnta=\z@ |
| 327 |
\ifnum#4>\z@ |
| 328 |
\@tempcnta=\numexpr |
| 329 |
(\fontcharwd\MT@font#2-\fontcharwd\MT@font#1)% |
| 330 |
*#4/\MT@dimen@six\relax |
| 331 |
\fi |
| 332 |
\MTS@rp@=\dimexpr\numexpr\rpcode\MT@font#1+\@tempcnta\relax em/1000\relax |
| 333 |
\MTS@show@char@pr{#2}% |
| 334 |
\@tempcntb=#1\relax |
| 335 |
} |
| 336 |
\def\MTS@load@list#1% |
| 337 |
{\edef\@tempa{#1}% |
| 338 |
\MT@let@cn\@tempb{MT@\MT@feat @c@\@tempa @load}% |
| 339 |
\MT@ifstreq\@tempa\@tempb{% |
| 340 |
\MT@error{\@nameuse{MT@abbr@\MT@feat} list `\@tempa' cannot load itself}{}% |
| 341 |
}{% |
| 342 |
\ifx\@tempb\relax |
| 343 |
:\par\medskip\leavevmode |
| 344 |
\else |
| 345 |
\MT@ifdefined@n@TF{MT@\MT@feat @c@\@tempb}{% |
| 346 |
\MTS@printtext{, loading \texttt{\@tempb}}% |
| 347 |
\MT@vinfo{... : First loading \@nameuse{MT@abbr@\MT@feat} list `\@tempb'}% |
| 348 |
\begingroup |
| 349 |
\MT@load@list\@tempb |
| 350 |
\endgroup |
| 351 |
\edef\MT@curr@list@name{% |
| 352 |
`\@tempb'}% |
| 353 |
\MT@let@cn\@tempc{MT@\MT@feat @c@\@tempb}% |
| 354 |
\expandafter\MT@set@codes\@tempc,\relax,% |
| 355 |
\vrule width 4cm height .5pt \\ |
| 356 |
\MTS@printtext{End of list \texttt{\MT@curr@list@name}}% |
| 357 |
\par\medskip\leavevmode |
| 358 |
}{% |
| 359 |
\MT@error{\@nameuse{MT@abbr@\MT@feat} list `\@tempb' undefined.\MessageBreak |
| 360 |
Cannot load it from list `\@tempa'}{}% |
| 361 |
}% |
| 362 |
\fi |
| 363 |
}% |
| 364 |
} |
| 365 |
\endinput |
| 366 |
%% |
| 367 |
%% End of file `microtype-show.sty'. |