I am trying to run my application on Suse Linux and Motif 2.3 under locale fr_FR.UTF-8. If I specify a 10646 font, the characters all display as boxes, if I specify a 8859-1 font, the accented characters display as two bytes.
I tried writing a test program, and when there is no resource file it displays accented characters correctly. But if I add a resource file containing just:
*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso10646-1
Then the characters display as boxes. The test program is:
Widget toplevel;
XtAppContext appContext;
Widget form, label, text;
XmString s1,s2;
XmRendition rendition;
XmRenderTable rtable;
Arg args[14];
Cardinal n;
String fallback[] = {
"*label.labelString: compound_string(\"?????????_int\")",
"*label1.renderTable: one",
"*label2.renderTable: two",
"*label3.renderTable: three",
"*one.fontType: FONT_IS_FONTSET",
"*one.fontName: -*-*-medium-r-normal-*-14-*-*-*-*-*-*-*:",
"*two.fontType: FONT_IS_XFT",
"*two.fontName: Times",
"*two.fontSize: 10",
"*three.fontType: FONT_IS_FONTSET",
"*three.fontName: -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-*",
NULL
};
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaAppInitialize(&appContext, "App", NULL, 0, &argc, argv, fallback,
XmNtitle, "abcdef", NULL);
form = XtVaCreateWidget("form", xmFormWidgetClass, toplevel, NULL);
XtManageChild(form);
char string1[] = "ÀÇÊ";
s1 = XmStringCreate(string1, "one");
label = XtVaCreateManagedWidget("label1", xmLabelGadgetClass, form, XmNlabelString, s1, XmNtopAttachment, XmATTACH_FORM, NULL);
XtRealizeWidget(toplevel);
XtAppMainLoop(appContext);
Can anybody tell me what is happening? Ultimately I need to use a resource file to specify the fonts.
Thanks,
Keith Hafen
If you just want to set XFT font using resource file, for program which uses UTF8 encoding in strings, you can do
*renderTable: rt
*rt*fontType: FONT_IS_XFT
*rt*fontName: Sans
*rt*fontSize: 10
If you use UTF8 text, you have to use XFT fonts (the only way to display UTF8).
And XFT fonts can only be set using renderTable, not by fontList