Solaris Trusted Extensions Developer's Guide

Translating the Window Label With the Font List

This example shows how to obtain the process sensitivity label and translate it to a string by using a font list and the pixel width. A label widget is created with the string for its label. The process sensitivity label equals the window sensitivity label. Therefore, no privileges are required.

When the final string is longer than the width, the string is clipped and the clipped indicator is used. Note that the X Window System label-translation interfaces clip to the specified number of pixels, while the label-clipping interfaces clip to the number of characters.


Note –

If your site uses a label_encodings file in a language other than English, the translation might not work on accent characters in the ISO standard above 128. The following example does not work for the Asian character set.


	retval = getplabel(&senslabel);

/* Create the font list and translate the label using it */
	italic = XLoadQueryFont(XtDisplay(topLevel),
		“-adobe-times-medium-i-*-*-14-*-*-*-*-*-iso8859-1”);
	fontlist = XmFontListCreate(italic, “italic”);
	xmstr = Xbsltos(XtDisplay(topLevel), &senslabel, width, fontlist, 
		LONG_WORDS);
/* Create a label widget using the font list and label text*/
	i=0;
	XtSetArg(args[i], XmNfontList, fontlist); i++;
	XtSetArg(args[i], XmNlabelString, xmstr); i++;
	label = XtCreateManagedWidget(“label”, xmLabelWidgetClass, 
		form, args, i);