1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <Xft/Xft.h>
#include <Xm/Text.h>
int main (int argc, char *argv[])
{
XtAppContext app;
XtSetLanguageProc(nullptr, nullptr, nullptr);
Widget toplevel = XtVaOpenApplication(&app, "Xft TextField",
nullptr, 0,
&argc, argv, nullptr, sessionShellWidgetClass, nullptr);
XftFont* font = XftFontOpenName(XtDisplay(toplevel),
DefaultScreen(toplevel), "URW Palladio L:style=Roman:size=17"
);
if (!font)
return EXIT_FAILURE;
Arg args[32];
int n = 0;
XtSetArg (args[n], XmNvalue, "Hello, world!"); n++;
XtSetArg (args[n], XmNfontType, XmFONT_IS_XFT); n++;
XtSetArg (args[n], XmNfont, font); n++;
XtSetArg (args[n], XmNxftFont, font); n++;
Widget text_w = XmCreateText (toplevel, (char*)"", args, n);
XtManageChild (text_w);
XtRealizeWidget (toplevel);
XtAppMainLoop (app);
} |
Partager