Debian Codegraph @

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

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