XLoadFont(3X) XLoadFont(3X)
NAME
XLoadFont, XQueryFont, XLoadQueryFont, XFreeFont,
XGetFontProperty, XUnloadFont - load or unload fonts
SYNOPSIS
Font XLoadFont(display, name)
Display *display;
char *name;
XFontStruct *XQueryFont(display, font_ID)
Display *display;
XID font_ID;
XFontStruct *XLoadQueryFont(display, name)
Display *display;
char *name;
XFreeFont(display, font_struct)
Display *display;
XFontStruct *font_struct;
Bool XGetFontProperty(font_struct, atom, value_return)
XFontStruct *font_struct;
Atom atom;
unsigned long *value_return;
XUnloadFont(display, font)
Display *display;
Font font;
ARGUMENTS
atom Specifies the atom for the property name you
want returned.
display Specifies the connection to the X server.
font Specifies the font.
font_ID Specifies the font ID or the GContext ID.
font_struct
Specifies the storage associated with the
font.
gc Specifies the GC.
name Specifies the name of the font, which is a
null-terminated string.
value_return
Returns the value of the font property.
- 1 -
XLoadFont(3X) XLoadFont(3X)
DESCRIPTION
The XLoadFont function loads the specified font and
returns its associated font ID. The name should be ISO
Latin-1 encoding; uppercase and lowercase do not
matter. If XLoadFont was unsuccessful at loading the
specified font, a BadName error results. Fonts are not
associated with a particular screen and can be stored
as a component of any GC. When the font is no longer
needed, call XUnloadFont.
XLoadFont can generate BadAlloc and BadName errors.
The XQueryFont function returns a pointer to the
XFontStruct structure, which contains information
associated with the font. You can query a font or the
font stored in a GC. The font ID stored in the
XFontStruct structure will be the GContext ID, and you
need to be careful when using this ID in other
functions (see XGContextFromGC). To free this data,
use XFreeFontInfo.
XLoadQueryFont can generate a BadAlloc error.
The XLoadQueryFont function provides the most common
way for accessing a font. XLoadQueryFont both opens
(loads) the specified font and returns a pointer to the
appropriate XFontStruct structure. If the font does
not exist, XLoadQueryFont returns NULL.
The XFreeFont function deletes the association between
the font resource ID and the specified font and frees
the XFontStruct structure. The font itself will be
freed when no other resource references it. The data
and the font should not be referenced again.
XFreeFont can generate a BadFont error.
Given the atom for that property, the XGetFontProperty
function returns the value of the specified font
property. XGetFontProperty also returns False if the
property was not defined or True if it was defined. A
set of predefined atoms exists for font properties,
which can be found in <X11/Xatom.h>. This set contains
the standard properties associated with a font.
Although it is not guaranteed, it is likely that the
predefined font properties will be present.
The XUnloadFont function deletes the association
between the font resource ID and the specified font.
The font itself will be freed when no other resource
references it. The font should not be referenced
again.
- 2 -
XLoadFont(3X) XLoadFont(3X)
XUnloadFont can generate a BadFont error.
DIAGNOSTICS
BadAlloc The server failed to allocate the requested
resource or server memory.
BadFont A value for a Font or GContext argument does
not name a defined Font.
BadName A font or color of the specified name does
not exist.
SEE ALSO
XListFonts(3X11), XSetFontPath(3X11)
Xlib Programming Manual
- 3 -