GLXUSEXFONT() GLXUSEXFONT()
NAME
glXUseXFont - create bitmap display lists from an X font
C SPECIFICATION
void glXUseXFont( Font font,
int first,
int count,
int listBase )
delim $$
PARAMETERS
font Specifies the font from which character glyphs are to be taken.
first Specifies the index of the first glyph to be taken.
count Specifies the number of glyphs to be taken.
listBase Specifies the index of the first display list to be generated.
DESCRIPTION
glXUseXFont generates count display lists, named listBase through listBase+count-1, each containing a single glBitmap command. The parame-
ters of the glBitmap command of display list listBase+i are derived from glyph first+i. Bitmap parameters xorig, yorig, width, and height
are computed from font metrics as descent-1, -lbearing, rbearing-lbearing, and ascent+descent, respectively. xmove is taken from the
glyph's width metric, and ymove is set to zero. Finally, the glyph's image is converted to the appropriate format for glBitmap.
Using glXUseXFont may be more efficient than accessing the X font and generating the display lists explicitly, both because the display
lists are created on the server without requiring a round trip of the glyph data, and because the server may choose to delay the creation
of each bitmap until it is accessed.
Empty display lists are created for all glyphs that are requested and are not defined in font. glXUseXFont is ignored if there is no cur-
rent GLX context.
ERRORS
BadFont is generated if font is not a valid font.
GLXBadContextState is generated if the current GLX context is in display-list construction mode.
GLXBadCurrentWindow is generated if the drawable associated with the current context of the calling thread is a window, and that window is
no longer valid.
SEE ALSO
glBitmap, glXMakeCurrent
GLXUSEXFONT()
Check Out this Related Man Page
XQueryTextExtents() XQueryTextExtents()
Name
XQueryTextExtents - query the server for string and font metrics.
Synopsis
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;
Arguments
display Specifies a connection to an X server; returned from XOpenDisplay().
font_ID Specifies the appropriate font ID previously returned by XLoadFont(), or the GContext that specifies the font.
string Specifies the character string for which metrics are to be returned.
nchars Specifies the number of characters in string.
direction_return
Returns the direction the string would be drawn using the specified font. Either FontLeftToRight or FontRightToLeft.
font_ascent_return
Returns the maximum ascent for the specified font.
font_descent_return
Returns the maximum descent for the specified font.
overall_return
Returns the overall characteristics of the string. These are the sum of the width measurements for each character, the maximum
font_ascent_return and font_descent_return, the minimum lbearing added to the width of all characters up to the character with
the smallest lbearing, and the maximum rbearing added to the width of all characters up to the character with the largest rbear-
ing.
Description
XQueryTextExtents() returns the dimensions in pixels that specify the bounding box of the specified string of characters in the named font,
and the maximum ascent and descent for the entire font. This function queries the server and, therefore, suffers the round trip overhead
that is avoided by XTextExtents(), but XQueryTextExtents() does not require a filled XFontInfo structure stored on the client side. There-
fore, this function would be used when memory is precious, or when just a small number of text width calculations are to be done.
The returned font_ascent_return and font_descent_return should usually be used to calculate the line spacing, while the width, rbearing,
and lbearing members of overall_return should be used for horizontal measures. The total height of the bounding rectangle, good for any
string in this font, is font_ascent_return + font_descent_return.
overall_return.ascent is the maximum of the ascent metrics of all characters in the string. The overall_return.descent is the maximum of
the descent metrics. The overall_return.width is the sum of the character-width metrics of all characters in the string. The over-
all_return.lbearing is usually the lbearing of the first character in the string, and overall_return.rbearing is the rbearing of the last
character in the string plus the sum of the widths of all the characters up to but not including the last character. More technically,
here is the X protocol definition: For each character in the string, let W be the sum of the character-width metrics of all characters pre-
ceding it in the string, let L be the lbearing metric of the character plus W, and let R be the rbearing metric of the character plus W.
The overall_return.lbearing is the minimum L of all characters in the string, and the overall_return.rbearing is the maximum R.
For more information on drawing text, see Volume One, Chapter 6, Drawing Graphics and Text.
Structures
typedef struct {
short lbearing; /* origin to left edge of character */
short rbearing; /* origin to right edge of character */
short width; /* advance to next char's origin */
short ascent; /* baseline to top edge of character */
short descent; /* baseline to bottom edge of character */
unsigned short attributes; /* per char flags (not predefined) */
} XCharStruct;
Errors
BadFont
BadGC
See Also
XDrawImageString(), XDrawImageString16(), XDrawString(), XDrawString16(), XDrawText(), XDrawText16(), XQueryTextExtents16(), XTextEx-
tents(), XTextExtents16(), XTextWidth(), XTextWidth16().
Xlib - Text XQueryTextExtents()