File: objects.tex

package info (click to toggle)
freetype 2.13.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,384 kB
  • sloc: ansic: 153,848; cpp: 13,981; python: 5,909; sh: 4,486; xml: 1,439; makefile: 676; perl: 340; awk: 142; javascript: 82
file content (164 lines) | stat: -rw-r--r-- 3,963 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
% objects.tex
%
% written 2022 by Werner Lemberg <wl@gnu.org>


% This file contains graphics used for the 'FreeType Design' documentation,
% part 2, 'Public Objects and Classes', and part 3, 'Internal Objects and
% Classes'.


% Here is one possibility to convert this LaTeX file to both PNG and SVG
% formats.
%
%   xelatex objects.tex
%
%   pdftoppm -png -f 1 -l 2 -r 120 objects.pdf objects
%   optipng objects-*.png
%
%   for i in 1 2; do
%     pdf2svg objects.pdf objects-$i.svg $i
%   done


\documentclass[tikz,
               svgnames, % for xcolor
               border=3mm]{standalone}

\usepackage{libertinus}

\usetikzlibrary{
  arrows.meta,
  calc,
  positioning
}


% Node styles.
\tikzset{
%
  % For normal lines.
  line/.style={
    line width=1pt},
%
  % For thin lines.
  thin line/.style={
    line width=0.5pt},
%
  % For the relation 'A has B'.
  has/.style={
    thin line,
    {Kite[length=12pt,
          width=6pt,
          inset=4pt]}-},
%
  % For the relation 'a child of A has B'.
  child has/.style={
    thin line,
    {Kite[open,
          length=12pt,
          width=6pt,
          inset=4pt]}-},
%
  % For boxes in general.
  box/.style={
    line,
    draw,
    inner xsep=5mm,
    inner ysep=3mm},
%
  % For boxes in the legend.
  legend box/.style={
    thin line,
    draw}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

% Basic object relationship.

\begin{tikzpicture}
  \node[box] (F) {FT\_Face};
  \node[box] (L) [above=1cm of F] {FT\_Library};
  \node[box] (G) [below left=0.5cm and 1cm of F]{FT\_GlyphSlot};
  \node[box] (S) [below=1.5cm of F] {FT\_Size};
  \node[box] (C) [below right=0.5cm and 1cm of F]{FT\_CharMap};

  \draw[child has] (L) -- (F)
    node[above right, at end] {0..*};
  \draw[has] (F.190) -- (G)
    node[above left, at start] {1}
    node[above left, at end] {1};
  \draw[has] (F) -- (S)
    node[below right, at start] {1}
    node[above right, at end] {0..*};
  \draw[has] (F.-10) -- (C)
    node[above right, at start] {1}
    node[above right, at end] {0..*};

  \begin{scope}[blue,
                font=\scriptsize,
                arrows={[scale=0.7]}]
    \node[anchor=north west,
          above=3cm of C] (L) {legend:};

    \node[legend box,
          below=0mm of L] (A1) {A};
    \node[legend box,
          right=0.5cm of A1,
          label={right:\ means \textit{A has B}}] (B1) {B};
    \draw[has] (A1) -- (B1);

    \node[legend box,
          below=1ex of A1] (A2) {A};
    \node[legend box,
          right=0.5cm of A2,
          label={right:\ means \textit{a child of A has B}}] (B2) {B};
    \draw[child has] (A2) -- (B2);
  \end{scope}
\end{tikzpicture}


% Detailed object relationship.

\begin{tikzpicture}
  \node[box] (F) {FT\_Face};
  \node[box] (M) [above right=1cm and -1.5cm of F] {FT\_Module};
  \node[box] (L) [above=1cm of M] {FT\_Library};
  \node[box] (Mem) [left=1cm of L] {FT\_Memory};
  \node[box] (Str) [left=1cm of F] {FT\_Stream};
  \node[box] (G) [below left=1.3cm and -1cm of F]{FT\_GlyphSlot};
  \node[box] (S) [below right=1cm and 0cm of F] {FT\_Size};
  \node[box] (C) [above right=-0.5cm and 1.3cm of F]{FT\_CharMap};

  \draw[has] (L) -- (Mem);
  \draw[has] (L) -- (M)
    node[above right, at end] {0..*};
  \draw[has] (M) -- (F)
    node[above left=0mm and -1mm, at end] {0..*};
  \draw[has] (F) -- (Str);
  \draw[has] (F.210) -- (G);
  \draw[has] (F.-30) -- (S)
    node[above right=0mm and -1mm, at end] {0..*};
  \draw[has] (F.10) -- (C)
    node[above left, at end] {0..*};

  \begin{scope}[blue,
                font=\scriptsize,
                arrows={[scale=0.7]}]
    \node[anchor=north west,
          above=3cm of C] (L) {legend:};

    \node[legend box,
          below=0mm of L] (A1) {A};
    \node[legend box,
          right=0.5cm of A1,
          label={right:\ means \textit{A has B}}] (B1) {B};
    \draw[has] (A1) -- (B1);
  \end{scope}
\end{tikzpicture}

\end{document}