Home | Software Map | Motif Forums | Bug Home sponsored by ICS 
Bugzilla Bug
  1451
     Query page      Enter new bug
Bug#:1451 Platform: Version:
Product: OS: Reporter:arahne@arahne.si
Status: CLOSED Priority: Cc:
Resolution: FIXED Severity: Component:
Assigned To: openmotif-devel@motifzone.net Target Milestone:
URL:
Summary:
Attachments: 06/17/09 05:34Patch
Create a new attachment (proposed patch, testcase, etc.)
Bug 1451 depends on: Show dependency tree
Show dependency graph
Bug 1451 blocks:
Votes for bug 1451:    Vote for this bug

Additional Comments:


Leave as CLOSED FIXED
Reopen bug

View Bug Activity Format For Printing
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
This is Mr. Samsa: the Open Motif bug system using Bugzilla. For more information about what Bugzilla is and what it can do, see mozilla.org's bug pages.
New | Query | bug # | Reports | New account | Log in