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, _Xconst  char  *string,  int
11              nchars,  int  *direction_return,  int  *font_ascent_return,  int
12              *font_descent_return, XCharStruct *overall_return);
13
14       int XTextExtents16(XFontStruct *font_struct, _Xconst  XChar2b  *string,
15              int  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,  _Xconst  char
19              *string,     int     nchars,    int    *direction_return,    int
20              *font_ascent_return,   int   *font_descent_return,   XCharStruct
21              *overall_return);
22
23       int  XQueryTextExtents16(Display *display, XID font_ID, _Xconst XChar2b
24              *string,    int    nchars,    int     *direction_return,     int
25              *font_ascent_return,   int   *font_descent_return,   XCharStruct
26              *overall_return);
27

ARGUMENTS

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

DESCRIPTION

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

DIAGNOSTICS

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

SEE ALSO

117       XLoadFont(3), XTextWidth(3)
118       Xlib - C Language X Interface
119
120
121
122X Version 11                     libX11 1.6.12                 XTextExtents(3)
Impressum