-
Notifications
You must be signed in to change notification settings - Fork 12
/
ctrlfnt.3
180 lines (180 loc) · 3.21 KB
/
ctrlfnt.3
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
.Dd March 17, 2023
.Dt CTRLFNT 3
.Os
.Sh NAME
.Nm ctrlfnt_open ,
.Nm ctrlfnt_draw ,
.Nm ctrlfnt_width ,
.Nm ctrlfnt_height ,
.Nm ctrlfnt_free
.Nd Xft selection ownership and requesting helper functions
.Sh SYNOPSIS
.In X11/Xlib.h
.In X11/Xft/Xft.h
.In control/ctrlfnt.h
.Ft void
.Fo ctrlfnt_init
.Ft "void"
.Fc
.Ft "CtrlFontSet *"
.Fo ctrlfnt_open
.Fa "Display display"
.Fa "int screen"
.Fa "Visual *visual"
.Fa "Colormap colormap"
.Fa "const char *fontset_spec"
.Fa "double fontsize"
.Fc
.Ft int
.Fo ctrlfnt_draw
.Fa "CtrlFontSet *fontset"
.Fa "Picture picture"
.Fa "Picture src"
.Fa "XRectangle rectangle"
.Fa "cont char *text"
.Fa "int nbytes"
.Fc
.Ft int
.Fo ctrlfnt_width
.Fa "CtrlFontSet *fontset"
.Fa "cont char *text"
.Fa "int nbytes"
.Fc
.Ft int
.Fo ctrlfnt_height
.Fa "CtrlFontSet *fontset"
.Fc
.Ft void
.Fo ctrlfnt_free
.Fa "CtrlFontSet *fontset"
.Fc
.Ft void
.Fo ctrlfnt_term
.Ft "void"
.Fc
.Sh ARGUMENTS
.Bl -tag -width Ds
.It Fa display
Specifies the connection to the X server.
.It Fa colormap
Specifies the colormap to draw the string with.
.It Fa picture
Specifies the picture to draw the string on.
.It Fa fontset
Specifies the fontset created with
.Fn ctrlfnt_open .
.It Fa fontset_spec
Specifies the string specifying the fonts to be open.
.It Fa fontsize
Specifies the font size in points.
If equal to
.Ic 0.0 ,
use the default font size (equal to
.Ic 8.0
points).
.It Fa nbytes
Specifies the size of
.Fa text
in bytes.
.It Fa rectangle
Specifies the rectangle within the drawable to place the the drawn string in.
.It Fa screen
Specifies a X screen.
.It Fa src
Specifies the source picture containing the color to draw the string with.
.It Fa text
Specifies the string to draw.
.It Fa visual
Specifies the visual to draw the string with.
.El
.Sh DESCRIPTION
The
.Fn ctrlfnt_init
function initializes the fontconfig library.
.Pp
The
.Fn ctrlfnt_open
function opens the fonts specified in
.Fa fontset_spec
into a newly allocated
.Fa fontset
structure, and returns its address.
The open fonts will have size equal to
.Fa fontsize
in points.
The fontset is created for the given
.Fa display
and
.Fa screen ,
with the given
.Fa visual
and
.Fa colormap .
.Pp
The
.Fn ctrlfnt_draw
function uses
.Fa fontset
to draw the first
.Fa nbytes
of
.Fa text
in the given
.Fa picture
within the given
.Fa rectangle ,
using
.Fa src
as source color.
It returns the width of the drawn text, or
.Ic -1
if the text could not be drawn because of any error.
.Pp
The
.Fn ctrlfnt_width
function returns the width of the first
.Fa nbytes
of
.Fa text
if drawn by
.Fn ctrlfnt_draw
using the given
.Fa fontset ,
or
.Ic -1
if the width could not be computed.
(This function returns the same as
.Fn ctrlfnt_draw
without drawing anything).
.Pp
The
.Fn ctrlfnt_height
returns the height of the fonts in
.Fa fontset .
.Pp
the
.Fn ctrlfnt_free
frees the fonts open in
.Ft fontset .
.Pp
The
.Fn ctrlfnt_term
function terminates the fontconfig library.
.Sh RETURN VALUES
The
.Fn ctrlfnt_open
function returns NULL on error.
The
.Fn ctrlfnt_draw ,
.Fn ctrlfnt_width ,
and
.Fn ctrlfnt_height ,
functions return a value less than zero on error.
.Pp
If an error occurs, the functions write a string describing the error into standard output with
.Xr warnx 3 .
.Sh EXAMPLES
[...]
.Sh SEE ALSO
.Xr Xft 3 ,
.Xr X 7