Query page
Enter new bug
| Description: |
Opened: 2008-09-03 07:21 |
XmStringDrawImage does not work correcly with XFT fonts, it clears too big area
in the background. As a result, multiline text is draw incorrectly.
XmStringDrawImage should behave in the same way for XFT fonts or for normal
fonts, just with the difference of AA fonts. Otherwise older applications, which
use XmStringDraw, and have been retrofitted with XFT will break.
This is the test case:
/* compile with cc -I/usr/X11R6/include xftbug.c -lXm */
#include <Xm/XmAll.h>
String fallback[] = {
"*renderTable: rt",
"*rt*fontType: FONT_IS_XFT",
// "*rt*fontType: FONT_IS_FONT", /* uncomment this line to test behavior
without XFT */
"*rt*fontName: Times",
"*rt*fontSize: 20",
NULL
};
Widget drawW;
Widget labelW;
XmRenderTable renderT;
void exposeNowCB(Widget w, XtPointer clientData, XtPointer callData)
{
XmString str;
str = XmStringCreateLocalized("My oh my,\nmulti line gets
overwritten.\nXmDrawStringImage background\nbounding box is too big!");
XmStringDrawImage(XtDisplay(drawW), XtWindow(drawW), renderT, str,
XDefaultGC(XtDisplay(drawW), XDefaultScreen(XtDisplay(drawW))), 20, 50, 300,
XmALIGNMENT_BEGINNING, XmLEFT_TO_RIGHT, NULL);
XmStringFree(str);
}
int main(int argc, char *argv[])
{
Widget toplevel;
Arg al[10];
Cardinal ac;
XtAppContext app;
XmString str;
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtAppInitialize(&app, "test", NULL, 0, &argc, argv, fallback,
NULL, 0);
ac = 0;
drawW = XtCreateManagedWidget("da", xmDrawingAreaWidgetClass, toplevel, al, ac);
XtSetArg(al[ac], XmNlabelType, XmSTRING); ac++;
str = XmStringCreateLocalized("I am being used so we can get the render table");
XtSetArg(al[ac], XmNlabelString, str); ac++;
labelW = XtCreateManagedWidget("label", xmLabelWidgetClass, toplevel, al, ac);
XmStringFree(str);
XtRealizeWidget(toplevel);
XtVaSetValues(toplevel, XmNwidth, 500, XmNheight, 300, NULL);
XtVaGetValues(labelW, XmNrenderTable, &renderT, NULL);
XtAddCallback(drawW, XmNexposeCallback, exposeNowCB, NULL);
XtAppMainLoop(app);
}
------- Additional Comments From Ihor Hayvuk 2009-06-17 05:34 -------
Created an attachment (id=244)
Patch
------- Additional Comments From Ihor Hayvuk 2009-06-17 05:35 -------
Fixed as proposed in CVS HEAD and openmotif_2_3 branches.
Query page
Enter new bug