Debian Codegraph @

tests/test-microtype.tex

raw
1 %%
2 %% This is file `test-microtype.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% microtype.dtx (with options: `test')
8 %%
9 %% ------------------------------------------------------------------------
10 %%
11 %% The `microtype' package
12 %% Subliminal refinements towards typographical perfection
13 %% Copyright (c) 2004--2011 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 %% http://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 `author-maintained'.
22 %%
23 %% This work consists of the files microtype.dtx and microtype.ins and the
24 %% derived files microtype.sty, microtype-pdftex.def, microtype-xetex.def,
25 %% microtype-luatex.def, microtype.lua and letterspace.sty.
26 %%
27 %% ------------------------------------------------------------------------
28 %% This file might be useful to test protrusion settings for a font.
29 %% You can do whatever you want with it.
30 %% ------------------------------------------------------------------------
31 %%
32 \documentclass{article}
33
34 %% Here you can specify the font you want to test, using
35 %% the commands \fontfamily, \fontseries and \fontshape.
36 %% Make sure to end all lines with a comment character!
37 \usepackage{fontspec}
38
39 \newcommand*\TestFont{%
40 \fontspec{EBGaramond}%
41 %% \fontseries{b}%
42 %% \fontshape{it}% sc, sl
43 }
44 \usepackage{lua-visual-debug}
45
46 \usepackage{ifthen}
47
48 \usepackage[verbose,expansion=alltext,stretch=50]{microtype}
49
50 \pagestyle{empty}
51 \setlength{\parindent}{0pt}
52 \newcommand*\crulefill{\cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill}
53 \newcommand*\testprotrusion[2][]{%
54 \ifthenelse{\equal{#1}{r}}{}{#2}%
55 lorem ipsum dolor sit amet,
56 \ifthenelse{\equal{#1}{r}}{\crulefill}{\leftarrowfill} #2
57 \ifthenelse{\equal{#1}{l}}{\crulefill}{\rightarrowfill}
58 you know the rest%
59 \ifthenelse{\equal{#1}{l}}{}{#2}%
60 \linebreak
61 {\fontencoding{\encodingdefault}%
62 \fontseries{\seriesdefault}%
63 \fontshape{\shapedefault}%
64 \selectfont
65 Here is the beginning of a line, \dotfill and here is its end}\linebreak
66 }
67 \newcommand*\showTestFont{\expandafter\stripprefix\meaning\TestFont}
68 \def\stripprefix#1>{}
69 \newcount\charcount
70 \begin{document}
71
72 \microtypesetup{expansion=false}
73
74 {\centering The font in this document is called by:\\
75 \texttt{\showTestFont}\par}\bigskip
76
77 \TestFont\selectfont
78 This line intentionally left empty\linebreak
79 %% A -- Z
80 \charcount=65
81 \loop
82 \testprotrusion{\char\charcount}
83 \advance\charcount 1
84 \ifnum\charcount < 91 \repeat
85 %% a -- z
86 \charcount=97
87 \loop
88 \testprotrusion{\char\charcount}
89 \advance\charcount 1
90 \ifnum\charcount < 123 \repeat
91 %% 0 -- 9
92 \charcount=48
93 \loop
94 \testprotrusion{\char\charcount}
95 \advance\charcount 1
96 \ifnum\charcount < 58 \repeat
97 %%
98 \testprotrusion[r]{,}
99 \testprotrusion[r]{.}
100 \testprotrusion[r]{;}
101 \testprotrusion[r]{:}
102 \testprotrusion[r]{?}
103 \testprotrusion[r]{!}
104 \testprotrusion[l]{\textexclamdown}
105 \testprotrusion[l]{\textquestiondown}
106 \testprotrusion[r]{)}
107 \testprotrusion[l]{(}
108 \testprotrusion{/}
109 \testprotrusion{\char`\\}
110 \testprotrusion{-}
111 \testprotrusion{\textendash}
112 \testprotrusion{\textemdash}
113 \testprotrusion{\textquoteleft}
114 \testprotrusion{\textquoteright}
115 \testprotrusion{\textquotedblleft}
116 \testprotrusion{\textquotedblright}
117 \testprotrusion{\quotesinglbase}
118 \testprotrusion{\quotedblbase}
119 \testprotrusion{\guilsinglleft}
120 \testprotrusion{\guilsinglright}
121 \testprotrusion{\guillemotleft}
122 \testprotrusion{\guillemotright}
123
124 \newpage
125 The following displays the current font stretched by 5\%,
126 normal, and shrunk by 5\%:
127
128 \bigskip
129 \newlength{\MTln}
130 \newcommand*\teststring
131 {ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789}
132 \settowidth{\MTln}{\teststring}
133 \microtypesetup{expansion=true}
134
135 \parbox{1.05\MTln}{\teststring\linebreak\\
136 \teststring}\par\bigskip
137 \parbox{0.95\MTln}{\teststring}
138
139 \end{document}
140 \endinput
141 %%
142 %% End of file `test-microtype.tex'.