Manual pages › X Window and screen libraries (3X)
XLoadFont(3X)
load or unload fonts
From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.
NAME
XLoadFont, XQueryFont, XLoadQueryFont, XFreeFont, XGet-FontProperty, XUnloadFont - load or unload fonts
SYNTAX
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 XWIN 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.
XWIN 3.0 Last change: 9/1/88 .ie t
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 XLoad- Font was unsuccessful at loading the specified font, a Bad- Name error results. Fonts are not associated with a partic- ular 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, XLoad- QueryFont 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 func- tion returns the value of the specified font property. XGet- FontProperty 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.
XUnloadFont can generate a BadFont error.
XWIN 3.0 Last change: 9/1/88 .ie t
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 - C Language X Interface
XWIN 3.0 Last change: 9/1/88 .ie t
XWIN 3.0 Last change: 9/1/88 .ie t