1XTextExtents(3)                 XLIB FUNCTIONS                 XTextExtents(3)
2
3
4

NAME

6       XTextExtents,  XTextExtents16, XQueryTextExtents, XQueryTextExtents16 -
7       compute or query text extents
8

SYNTAX

10       int XTextExtents(XFontStruct *font_struct, char  *string,  int  nchars,
11              int     *direction_return,    int    *font_ascent_return,    int
12              *font_descent_return, XCharStruct *overall_return);
13
14       int  XTextExtents16(XFontStruct  *font_struct,  XChar2b  *string,   int
15              nchars,  int  *direction_return,  int  *font_ascent_return,  int
16              *font_descent_return, XCharStruct *overall_return);
17
18       int XQueryTextExtents(Display *display, XID font_ID, char *string,  int
19              nchars,  int  *direction_return,  int  *font_ascent_return,  int
20              *font_descent_return, XCharStruct *overall_return);
21
22       int XQueryTextExtents16(Display *display, XID font_ID, XChar2b *string,
23              int  nchars, int *direction_return, int *font_ascent_return, int
24              *font_descent_return, XCharStruct *overall_return);
25

ARGUMENTS

27       direction_return
28                 Returns the value of the direction hint or FontRightToLeft).
29
30       display   Specifies the connection to the X server.
31
32       font_ID   Specifies either the font ID or the GContext ID that contains
33                 the font.
34
35       font_ascent_return
36                 Returns the font ascent.
37
38       font_descent_return
39                 Returns the font descent.
40
41       font_struct
42                 Specifies the XFontStruct structure.
43
44       nchars    Specifies the number of characters in the character string.
45
46       string    Specifies the character string.
47
48       overall_return
49                 Returns  the overall size in the specified XCharStruct struc‐
50                 ture.
51

DESCRIPTION

53       The XTextExtents and XTextExtents16 functions perform the size computa‐
54       tion  locally and, thereby, avoid the round-trip overhead of XQueryTex‐
55       tExtents and XQueryTextExtents16.  Both functions return an XCharStruct
56       structure, whose members are set to the values as follows.
57
58       The  ascent  member  is set to the maximum of the ascent metrics of all
59       characters in the string.  The descent member is set to the maximum  of
60       the descent metrics.  The width member is set to the sum of the charac‐
61       ter-width metrics of all characters in the string.  For each  character
62       in  the  string, let W be the sum of the character-width metrics of all
63       characters preceding it in the string.  Let L be the  left-side-bearing
64       metric of the character plus W.  Let R be the right-side-bearing metric
65       of the character plus W.  The lbearing member is set to the  minimum  L
66       of  all  characters  in  the string.  The rbearing member is set to the
67       maximum R.
68
69       For fonts defined with linear indexing rather than 2-byte matrix index‐
70       ing,  each  XChar2b  structure  is  interpreted as a 16-bit number with
71       byte1 as the most significant byte.  If the font has no defined default
72       character,  undefined  characters  in  the string are taken to have all
73       zero metrics.
74
75       The XQueryTextExtents  and  XQueryTextExtents16  functions  return  the
76       bounding  box of the specified 8-bit and 16-bit character string in the
77       specified font or the font contained in the specified GC.  These  func‐
78       tions query the X server and, therefore, suffer the round-trip overhead
79       that is avoided by XTextExtents  and  XTextExtents16.   Both  functions
80       return  a XCharStruct structure, whose members are set to the values as
81       follows.
82
83       The ascent member is set to the maximum of the ascent  metrics  of  all
84       characters  in the string.  The descent member is set to the maximum of
85       the descent metrics.  The width member is set to the sum of the charac‐
86       ter-width  metrics of all characters in the string.  For each character
87       in the string, let W be the sum of the character-width metrics  of  all
88       characters  preceding it in the string.  Let L be the left-side-bearing
89       metric of the character plus W.  Let R be the right-side-bearing metric
90       of  the  character plus W.  The lbearing member is set to the minimum L
91       of all characters in the string.  The rbearing member  is  set  to  the
92       maximum R.
93
94       For fonts defined with linear indexing rather than 2-byte matrix index‐
95       ing, each XChar2b structure is interpreted  as  a  16-bit  number  with
96       byte1 as the most significant byte.  If the font has no defined default
97       character, undefined characters in the string are  taken  to  have  all
98       zero metrics.
99
100       Characters  with  all  zero  metrics  are  ignored.  If the font has no
101       defined default_char, the undefined characters in the string  are  also
102       ignored.
103
104       XQueryTextExtents  and  XQueryTextExtents16  can  generate  BadFont and
105       BadGC errors.
106

DIAGNOSTICS

108       BadFont   A value for a Font or  GContext  argument  does  not  name  a
109                 defined Font.
110
111       BadGC     A value for a GContext argument does not name a defined GCon‐
112                 text.
113

SEE ALSO

115       XLoadFont(3), XTextWidth(3)
116       Xlib - C Language X Interface
117
118
119
120X Version 11                     libX11 1.6.9                  XTextExtents(3)
Impressum