Debian Codegraph @

texmf-dist/doc/latex/adjustbox/viewport2.tex

raw
1
2 \def\text{\sffamily\scalebox{10}{Xy}}
3 \sbox\mybox{\sffamily\color{black!25}\scalebox{10}{Xy}}
4 \def\HEIGHT{\ht\mybox}
5 \def\WIDTH{\wd\mybox}
6 \def\DEPTH{\dp\mybox}
7 \def\LLX{.15\WIDTH}
8 \def\LLY{\DEPTH-.15\HEIGHT}
9 \def\URX{.15\WIDTH}
10 \def\URY{.25\HEIGHT}
11 \begin{tikzpicture}[font=\sffamily,>=latex]
12 \draw [gray,thin]
13 (0,0) -- +(-3.5ex,0)
14 (0,\HEIGHT) -- +(-3.5ex,0)
15 (0,-\DEPTH) -- +(-3.5ex,0)
16 (\WIDTH,\HEIGHT) -- +(3.5ex,0)
17 (\WIDTH,-\DEPTH) -- +(3.5ex,0)
18 (0,-\DEPTH) -- +(0,-3.5ex)
19 (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
20 ;
21 \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
22 \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
23 \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
24 \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
25 \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
26 \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
27 \fill (-2.5ex,0) circle (.5pt);
28 \begin{scope}[blue]
29 \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
30 \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
31 \end{scope}
32 \begin{scope}[blue]
33 \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
34 \draw (\LLX,0) -- ([shift={(-\URX,0)}]\WIDTH,0);
35 \path [fill=white,draw] (\LLX,0) circle (1pt);
36 \end{scope}
37 \begin{scope}[blue!50!black] %,every node/.append style={inner sep=2pt}]
38 \draw [->] (\LLX,0) -- (\LLX,\LLY-\DEPTH) node [right,midway] {\scriptsize lly};
39 \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
40 \draw [->]
41 ([shift={(-\URX,0)}]\WIDTH,0) --
42 ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
43 node [right,midway] {\scriptsize ury}
44 ;
45 \draw [->]
46 ([shift={(0,-\URY)}]0,\HEIGHT) --
47 ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
48 node [above,midway] {\scriptsize urx}
49 ;
50 \end{scope}
51 \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
52 \path [fill=white,draw=black] (0,0) circle (1pt);
53 \path let
54 \p1 = (current bounding box.south west),
55 \p2 = (current bounding box.north east),
56 \p3 = (0,-\DEPTH),
57 \p4 = (\WIDTH,\HEIGHT)
58 in
59 (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
60 \end{tikzpicture}