Daylight v4.9
Release Date: 1 February 2008

Name

dw_font - font support for widgets

C Prototype

#include <X11/Xlib.h>
#include <xview/xview.h>
#include "dw_xv_widget.h"

char *dw_font_default();
Menu dw_font_menu(void (*cb)(), void *clientdata);

Description

There is no "Font Widget" per se; these two functions provide a widget-related task of allowing the user to specify fonts to be used with X-Windows.

Fonts are always a problem with X because (a) X demands full font names for portability, (b) the font resides on the X-server's machine, typically not the machine running the program, and (c) X does not require that any particular font is available. X-workstation vendors have come up with clever solutions to this problem, but they are not generally usable because they are non-standard.

The Daylight Widgets use the dw_font*() functions to solve this problem in a portable, albeit pedantic, manner. The string-valued option FONT_DEFAULT is used to specify the full name of the font desired as a default (which is returned by dw_font_default()). Five families of fonts may be user defined; family names are defined by options FONT_FAMILY_1 .. FONT_FAMILY_5. Each family has up to five members which are specified in options FONT_1.1, FONT_1.2, .. FONT_5.5. Font member options are in the form "shortname|fullname". The function dw_font_menu() returns an XView Menu object which contains the font family names as menu items and the corresponding font shortnames in pullright menus. The MENU_CLIENT_DATA for each menu is set to a specified value (so different sets of font buttons can be distinguished). Each menu item has its MENU_NOTIFY_PROC set as in the dw_font_menu() call and its MENU_CLIENT_DATA set to a pointer to a full font name. When the user selects a menu item, the callback is called with the full name of the selected font.

Daylight supplies default font options which are available on most servers as well as several specific ones (Sun, SGI, Macintosh). These choices can be modified by users with unusual requirements or preferences.

dw_font_default(void) => char *fullname

Return the full name of the default font.

dw_font_menu(void (cb)(), void *clientdata) => Menu

Return an XView Menu containing 25 Menu_items in 5 pullright menus as described above. The Menu's MENU_CLIENT_DATA is set to clientdata; the Menu_item's MENU_NOTIFY_PROC to cb() and their MENU_CLIENT_DATA to a pointer to a full font name.

OPTIONS:

FONT_DEFAULT

Full name of desired default font.

FONT_FAMILY_1 .. FONT_FAMILY_5

User consumable font family names.

FONT_1.1 .. FONT_5.5

Strings containing "shortname|fullname" for alternate fonts. The shortname is used in the menu, the full name is delivered to the calling program as the MENU_CLIENT_DATA of the Menu_item in a MENU_NOTIFY callback.

Return Value

No error messages are generated by this widget.

Release 4.2 is the first release of this widget. The 4.3 Font Widget is functionally identical to the 4.2 version.

Bugs

None known, except that it's too bad that such a utility is needed.

Related Topics

Daylight Widget User's Guide
Daylight Widget Programmer's Guide