XListFonts(), XFreeFontNames(), XListFontsWithInfo(), XFreeFontInfo() - obtain or free font names and information
char **XListFonts (Display * display, char * pattern, int maxnames,
int * actual_count_return)
XFreeFontNames (char *list[])
char **XListFontsWithInfo (Display *display, char *pattern,
int maxnames, int *count_return,
XFontStruct **info_return)
XFreeFontInfo (char **names, XFontStruct *free_info, int actual_count)
The XListFonts(3) function returns an array of available font names (as controlled by the font search path; see XSetFontPath(3)) that match the string you passed to the pattern argument. The pattern string can contain any characters, but each asterisk (*) is a wildcard for any number of characters, and each question mark (?) is a wildcard for a single character. If the pattern string is not in the Host Portable Character Encoding the result is implementation dependent. Use of uppercase or lowercase does not matter. Each returned string is null-terminated. If the data returned by the server is in the Latin Portable Character Encoding, then the returned strings are in the Host Portable Character Encoding. Otherwise, the result is implementation dependent. If there are no matching font names, XListFonts(3) returns NULL. The client should call XFreeFontNames(3) when finished with the result to free the memory.
The XFreeFontNames(3) function frees the array and strings returned by XListFonts(3) or XListFontsWithInfo(3).
The XListFontsWithInfo(3) function returns a list of font names that match the specified pattern and their associated font information. The list of names is limited to size specified by maxnames. The information returned for each font is identical to what XLoadQueryFont(3) would return except that the per-character metrics are not returned. The pattern string can contain any characters, but each asterisk (*) is a wildcard for any number of characters, and each question mark (?) is a wildcard for a single character. If the pattern string is not in the Host Portable Character Encoding the result is implementation dependent. Use of uppercase or lowercase does not matter. Each returned string is null-terminated. If the data returned by the server is in the Latin Portable Character Encoding, then the returned strings are in the Host Portable Character Encoding. Otherwise, the result is implementation dependent. If there are no matching font names, XListFontsWithInfo(3) returns NULL.
To free only the allocated name array, the client should call XFreeFontNames(3). To free both the name array and the font information array, or to free just the font information array, the client should call XFreeFontInfo(3).
The XFreeFontInfo(3) function frees the font information array. To free an XFontStruct structure without closing the font, call XFreeFontInfo(3) with the names argument specified as NULL.
Xlib