Generally, all internationalized programs expecting to draw localized text using Xlib are required to use an XmFontSet() for specifying the locale-dependent fonts. Specific fonts within a font set should be specified using XLFD naming conventions without the charset field specified. The resource name for an XFontset is *fontSet. Refer to "Localized Resources" for a list of font resources.
Applications directly using Xlib to render text (as opposed to using XmString functions or widgets) may take advantage of the string-to-fontSet converter provided by Xt. For example, the following code fragment shows how to obtain a fontset when using Xt and when not using Xt:
/* pardon the double negative... means "If using Xt..." */ #ifndef NO_XT typedef struct { XFontSet fontset; char *foo; } ApplicationData, *ApplicationData r; static XtResource my_resources[] = { { XtNfontSet, XtCFontSet, XtRFontSet, sizeof (XFontSet), XtOffset (ApplicationDataPtr, fontset), XtRString, "*-18-*"}} #endif /* NO_XT */ ... #ifdef NO_XT fontset = XCreateFontSet (dpy, "*-18-*", &missing_charsets, &num_missing_charsets. &default_string); if (num_missing_charsets > 0) { (void) fprintf(stderr, "&s: missing charsets.\n", program_name); XFreeStringList(missing_charsets); } #else XtGetApplicationResources(toplevel, &data, my_resources, XtNumber(my_resources), NULL, 0); fontset = data.fontset; #endif /* NO_XT */