Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XTextExtents(3X) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XLoadFont(3X)

XTextWidth(3X)




XTextExtents(3X) XTextExtents(3X)
NAME XTextExtents, XTextExtents16, XQueryTextExtents, XQueryTextExtents16 - compute and query text extents SYNOPSIS XTextExtents (font-struct, string, nchars, direction-return, font-ascent-return, font-descent-return, overall-return) XFontStruct *font-struct; char *string; int nchars; int *direction-return; int *font-ascent-return,*font-descent-return; XCharStruct *overall-return; XTextExtents16 (font-struct, string, nchars, direction-return, font-ascent-return, font-descent-return, overall-return) XFontStruct *font-struct; XChar2b *string; int nchars; int *direction-return; int *font-ascent-return,*font-descent-return; XCharStruct *overall-return; XQueryTextExtents (display, font-ID, string, nchars, direction-return, font-ascent-return, font-descent-return, overall-return) Display *display; XID font-ID; char *string; int nchars; int *direction-return; int *font-ascent-return,*font-descent-return; XCharStruct *overall-return; XQueryTextExtents16 (display, font-ID, string, nchars, direction-return, font-ascent-return, font-descent-return, overall-return) Display *display; XID font-ID; XChar2b *string; int nchars; int *direction-return; int *font-ascent-return,*font-descent-return; XCharStruct *overall-return DESCRIPTION The XTextExtents and XTextExtents16 functions compute text extents, perform the size computation locally and, thereby, avoid the round-trip overhead of XQueryTextExtents and XQueryTextExtents16. Both functions return an November, 1990 1



XTextExtents(3X) XTextExtents(3X)
XCharStruct structure, whose members are set to the values as follows. The ascent member is set to the maximum of the ascent metrics of all characters in the string. The descent member is set to the maximum of the descent metrics. The width member is set to the sum of the character-width metrics of all characters in the string. For each character in the string, let W be the sum of the character-width metrics of all characters preceding it in the string. Let L be the left-side-bearing metric of the character plus W. Let R be the right-side-bearing metric of the character plus W. The lbearing member is set to the minimum L of all characters in the string. The rbearing member is set to the maximum R. For fonts defined with linear indexing rather than 2-byte matrix indexing, each XChar2b structure is interpreted as a 16-bit number with byte1 as the most-significant byte. If the font has no defined default character, undefined charac- ters in the string are taken to have all zero metrics. The XQueryTextExtents and XQueryTextExtents16 functions re- turn the bounding box of the specified 8-bit and 16-bit character string in the specified font or the font contained in the specified graphic context. These functions query the X server and, therefore, suffer the round-trip overhead that is avoided by XTextExtents and XTextExtents16. Both functions return a XCharStruct structure, whose members are set to the values as follows. The ascent member is set to the maximum of the ascent metrics of all characters in the string. The descent member is set to the maximum of the descent metrics. The width member is set to the sum of the character-width metrics of all characters in the string. For each character in the string, let W be the sum of the character-width metrics of all characters preceding it in the string. Let L be the left-side-bearing metric of the character plus W. Let R be the right-side-bearing metric of the character plus W. The lbearing member is set to the minimum L of all characters in the string. The rbearing member is set to the maximum R. For fonts defined with linear indexing rather than 2-byte matrix indexing, each XChar2b structure is interpreted as a 16-bit number with byte1 as the most-significant byte. If the font has no defined default character, undefined charac- ters in the string are taken to have all zero metrics. Characters with all zero metrics are ignored. If the font has no defined default chararacter, the undefined characters in the string are also ignored. 2 November, 1990



XTextExtents(3X) XTextExtents(3X)
Arguments These functions accept the following arguments: font-ascent-return Returns the font ascent member. font-descent-return Returns the font descent member. direction-return Returns the value of the direction hint member: FontLeftToRight or FontRightToLeft. display Specifies the connection to the X server. font-ID Specifies either the font ID or the graphic context that contains the font. font-struct Specifies a pointer to the XFontStruct structure. nchars Specifies the number of characters in the character string. string Specifies the character string. November, 1990 3



XTextExtents(3X) XTextExtents(3X)
overall-return Returns the overall size in the specified XChar- Struct structure. ERRORS BadFont A value for a Font or GC argument does not name a defined font. BadGC A value for a GC argument does not name a defined graphic context. The XQueryTextExtents and XQueryTextExtents16 functions can generate BadFont and BadGC errors. SEE ALSO XLoadFont(3X), XTextWidth(3X)
Xlib - C Language Interface
4 November, 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026