Пример #1
0
/*
 * Given two positions, find the distance between them.
 */
static void
FindDistance(
		Widget w,
		XawTextPosition fromPos,	/* First position. */
		int fromx,	/* Horizontal location of first position. */
		XawTextPosition toPos,	/* Second position. */
		int *resWidth,	/* Distance between fromPos and resPos. */
		XawTextPosition * resPos,	/* Actual second position used. */
		int *resHeight)	/* Height required. */
{
    MultiSinkObject sink = (MultiSinkObject) w;
    Widget source = XawTextGetSource(XtParent(w));

    XawTextPosition inx, lastPos;
    wchar_t c;
    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
    XawTextBlock blk;

    /* we may not need this */
    lastPos = GETLASTPOS;
    XawTextSourceRead(source, fromPos, &blk, (int) (toPos - fromPos));
    *resWidth = 0;
    for (inx = fromPos; inx != toPos && inx < lastPos; inx++) {
	if (inx - blk.firstPos >= blk.length)
	    XawTextSourceRead(source, inx, &blk, (int) (toPos - fromPos));
	c = ((wchar_t *) blk.ptr)[inx - blk.firstPos];
	*resWidth += CharWidth(w, fromx + *resWidth, c);
	if (c == _Xaw_atowc(XawLF)) {
	    inx++;
	    break;
	}
    }
    *resPos = inx;
    *resHeight = ext->max_logical_extent.height;
}
Пример #2
0
/*******************************************************************************
 GetBufferFromTextEdit
 Description : This function will return the last word in the editor
               from the cursor
 *******************************************************************************/
static char * GetBufferFromTextEdit(
 Widget w)
{
   XawTextBlock text_return;
   XawTextPosition length;
   char *buffer;

   Widget source = XawTextGetSource(w);
   XawTextPosition NewPos,EndPos = XawTextGetInsertionPoint(w);

   /* ================================================ */
   /*  If Cursor is at the begining return empty       */
   /*  string,orther while move the cursor backward    */
   /*  until it hits the space then read and return    */
   /*  the last word.                                  */
   /* ================================================ */

   if(EndPos == 0)
    return("");
   NewPos = EndPos - 1;
   XawTextSourceRead(source,NewPos,&text_return,1);
   while((text_return.ptr[0] != ' ') && (NewPos != 0))
    {
      NewPos--;      
      XawTextSourceRead(source,NewPos,&text_return,1);
    }
   if(NewPos != 0)
    NewPos++;
   XawTextSourceRead(source,NewPos,&text_return,EndPos - NewPos);
   buffer = (char *)malloc(text_return.length + 1);
   strncpy(buffer,text_return.ptr,text_return.length);
   buffer[text_return.length] = 0;
   return(buffer);
}
Пример #3
0
static void
FindPosition(
		Widget w,
		XawTextPosition fromPos,	/* Starting position. */
		int fromx,	/* Horizontal location of starting position. */
		int width,	/* Desired width. */
		Boolean stopAtWordBreak,	/* Whether the resulting
						   position should be at a word
						   break.  */
		XawTextPosition * resPos,	/* Resulting position. */
		int *resWidth,	/* Actual width used. */
		int *resHeight)	/* Height required. */
{
    MultiSinkObject sink = (MultiSinkObject) w;
    Widget source = XawTextGetSource(XtParent(w));

    XawTextPosition lastPos, inx, whiteSpacePosition = 0;
    int lastWidth = 0, whiteSpaceWidth = 0;
    Boolean whiteSpaceSeen;
    wchar_t c;
    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
    XawTextBlock blk;

    lastPos = GETLASTPOS;

    XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
    *resWidth = 0;
    whiteSpaceSeen = FALSE;
    c = 0;
    for (inx = fromPos; *resWidth <= width && inx < lastPos; inx++) {
	lastWidth = *resWidth;
	if (inx - blk.firstPos >= blk.length)
	    XawTextSourceRead(source, inx, &blk, BUFSIZ);
	c = ((wchar_t *) blk.ptr)[inx - blk.firstPos];
	*resWidth += CharWidth(w, fromx + *resWidth, c);

	if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB)) &&
	    *resWidth <= width) {
	    whiteSpaceSeen = TRUE;
	    whiteSpacePosition = inx;
	    whiteSpaceWidth = *resWidth;
	}
	if (c == _Xaw_atowc(XawLF)) {
	    inx++;
	    break;
	}
    }
    if (*resWidth > width && inx > fromPos) {
	*resWidth = lastWidth;
	inx--;
	if (stopAtWordBreak && whiteSpaceSeen) {
	    inx = whiteSpacePosition + 1;
	    *resWidth = whiteSpaceWidth;
	}
    }
    if (inx == lastPos && c != _Xaw_atowc(XawLF))
	inx = lastPos + 1;
    *resPos = inx;
    *resHeight = ext->max_logical_extent.height;
}
static void
FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
	     Bool stopAtWordBreak, XawTextPosition *resPos, int *resWidth,
	     int *resHeight)
{
    MultiSinkObject sink = (MultiSinkObject)w;
    TextWidget ctx = (TextWidget)XtParent(w);
    Widget source = ctx->text.source;
    XFontSet fontset = sink->multi_sink.fontset;
    XawTextPosition idx, pos, whiteSpacePosition = 0;
    int i, lastWidth, whiteSpaceWidth, rWidth;
    Boolean whiteSpaceSeen;
    wchar_t c;
    XFontSetExtents *ext = XExtentsOfFontSet(fontset);
    XawTextBlock blk;

    pos = XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
    rWidth = lastWidth = whiteSpaceWidth = 0;
    whiteSpaceSeen = False;
    c = 0;

    for (i = 0, idx = fromPos; rWidth <= width; i++, idx++) {
	if (i >= blk.length) {
	    i = 0;
	    pos = XawTextSourceRead(source, pos, &blk, BUFSIZ);
	    if (blk.length == 0)
		break;
	}
	c = ((wchar_t *)blk.ptr)[i];
	lastWidth = rWidth;
	rWidth += CharWidth(sink, fontset, fromx + rWidth, c);

	if (c == _Xaw_atowc(XawLF)) {
	    idx++;
	    break;
	}
	else if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB))
		 && rWidth <= width) {
	    whiteSpaceSeen = True;
	    whiteSpacePosition = idx;
	    whiteSpaceWidth = rWidth;
	}
    }

    if (rWidth > width && idx > fromPos) {
	idx--;
	rWidth = lastWidth;
	if (stopAtWordBreak && whiteSpaceSeen) {
	    idx = whiteSpacePosition + 1;
	    rWidth = whiteSpaceWidth;
	}
    }

    if (idx >= ctx->text.lastPos && c != _Xaw_atowc(XawLF))
	idx = ctx->text.lastPos + 1;

    *resPos = idx;
    *resWidth = rWidth;
    *resHeight = ext->max_logical_extent.height;
}
Пример #5
0
/* used for one line text input widgets */
void Gtweolaction (Widget w, XEvent *evp, char **app, unsigned int *anp) {
    Gwidget_t *widget;
    Widget ww;
    XawTextBlock tb;
    int ret, fi, li, n, i;

    widget = findwidget ((unsigned long) w, G_TEXTWIDGET);
    li = XawTextGetInsertionPoint (w) - 1;
    ww = XawTextGetSource (w);
    tb.firstPos = 0, tb.ptr = "\n", tb.format = FMT8BIT, tb.length = 1;
    fi = XawTextSourceSearch (ww, li, XawsdLeft, &tb);
    if (fi == XawTextSearchError)
        fi = 0;
    else
        fi++;
    n = li - fi;
    Gbufp[(Gbufi = 0)] = '\000';
    while (Gbufi != n) {
        ret = XawTextSourceRead (ww, fi, &tb, n - Gbufi) - fi;
        for (i = 0; i < ret; i++)
            Gbufp[Gbufi++] = tb.ptr[i];
    }
    Gbufp[Gbufi] = '\000';
    if (n >= 0 && WTU->func)
        (*WTU->func) (widget - &Gwidgets[0], Gbufp);
}
/*
 * Given two positions, find the distance between them
 */
static void
FindDistance(Widget w, XawTextPosition fromPos, int fromx,
	     XawTextPosition toPos, int *resWidth,
	     XawTextPosition *resPos, int *resHeight)
{
    MultiSinkObject sink = (MultiSinkObject)w;
    XFontSet fontset = sink->multi_sink.fontset;
    TextWidget ctx = (TextWidget)XtParent(w);
    Widget source = ctx->text.source;
    XawTextPosition idx, pos;
    wchar_t c;
    XFontSetExtents *ext = XExtentsOfFontSet(fontset);
    XawTextBlock blk;
    int i, rWidth;

    pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos);
    rWidth = 0;
    for (i = 0, idx = fromPos; idx < toPos; i++, idx++) {
	if (i >= blk.length) {
	    i = 0;
	    XawTextSourceRead(source, pos, &blk, toPos - pos);
	    if (blk.length == 0)
		break;
	}
	c = ((wchar_t *)blk.ptr)[i];
	rWidth += CharWidth(sink, fontset, fromx + rWidth, c);
	if (c == _Xaw_atowc(XawLF)) {
	    idx++;
	    break;
	}
    }

    *resPos = idx;
    *resWidth = rWidth;
    *resHeight = ext->max_logical_extent.height;
}
Пример #7
0
/*******************************************************************************
          Name:        CompletionEditCallback
          Description: Called when Completion is selected form File menu
                       in the editor.
          Arguments:  w - menu item that was selected
                       client_data - dialog window or edit window
                       call_data - not used
          Returns:     None
*******************************************************************************/
void CompletionEditCallback(
  Widget w,
  XtPointer client_data, 
  XtPointer call_data)
{
  int NumberOfMatches,i,length;
  Boolean tempFlag;
  struct symbolMatch *matches;
  extern char* GetCommandString(); 
  XawTextBlock text;
  char *matchString = NULL;
  Widget source = XawTextGetSource((Widget)client_data);
  XawTextPosition CurrentPosition,EndPosition;

  /* ================================================== */
  /* Free the memory of completionString before assign  */
  /* it to the new string.                              */
  /* ================================================== */

  if(completionString != NULL)
   {
     free(completionString);
     completionString = NULL;
   }
  
  /* =================================================== */
  /* Get the beginning and ending positions of the       */
  /* selection. If there is no selection get the last    */
  /* word from the cursor.                               */
  /* ====================================================*/
  
  XawTextGetSelectionPos((Widget)client_data,&CurrentPosition,&EndPosition);
  if(CurrentPosition == EndPosition)  /* No selection was made */
   {
     matchString = GetBufferFromTextEdit((Widget)client_data);
     length = strlen(matchString);
   }
  else
   {
      XawTextSourceRead(source,CurrentPosition,&text,EndPosition - CurrentPosition);
      XawTextUnsetSelection((Widget)client_data);
      XawTextSetInsertionPoint((Widget)client_data,EndPosition);
      matchString = text.ptr;
      length = text.length;
   }

  /* ======================================= */
  /* Determine if the word can be matched.   */
  /* ======================================= */

  matchString = GetCommandCompletionString(matchString,length);
  if(matchString == NULL)
   {
     XBell(XtDisplay(toplevel),100);
     return;
   }
  completionString = (char*)malloc(strlen(matchString) + 1);
  strcpy(completionString,matchString);
  matches = FindSymbolMatches(completionString,&NumberOfMatches,NULL);
  if(NumberOfMatches == 0)
   {
     XBell(XtDisplay(toplevel),100);
     return;
   }
  else if (NumberOfMatches == 1)
   {
      length = strlen(completionString);
      text.firstPos = 0;
      text.length  = strlen(&(matches->match->contents[length]));   
      text.ptr  = &(matches->match->contents[length]);
      XawTextReplace((Widget)client_data,
                        XawTextGetInsertionPoint((Widget)client_data),
                        XawTextGetInsertionPoint((Widget)client_data),&text);
      XawTextSetInsertionPoint((Widget)client_data,
                     XawTextGetInsertionPoint((Widget)client_data) + text.length);

   }
  else
   {
      DisplayMatchedList((Widget)client_data,matches);
   }
}
Пример #8
0
int GTgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
    Dimension width, height;
    XawTextEditType mode;
    XawTextBlock tb;
    Widget w;
    int rtn, ai;
    long fi, li;

    for (ai = 0; ai < attrn; ai++) {
        RESETARGS;
        switch (attrp[ai].id) {
        case G_ATTRSIZE:
            ADD2ARGS (XtNwidth, &width);
            ADD2ARGS (XtNheight, &height);
            XtGetValues (widget->w, argp, argn);
            attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
            break;
        case G_ATTRBORDERWIDTH:
            ADD2ARGS (XtNborderWidth, &width);
            XtGetValues (widget->w, argp, argn);
            attrp[ai].u.i = width;
            break;
        case G_ATTRTEXT:
            w = XawTextGetSource (widget->w);
            tb.firstPos = 0, tb.ptr = NULL, tb.format = FMT8BIT, tb.length = 0;
            rtn = XawTextSourceRead (w, 0, &tb, 30000);
            if (rtn > Gbufn + 1) {
                Gbufp = Marraygrow (Gbufp, (long) (rtn + 1) * BUFSIZE);
                Gbufn = rtn + 1;
            }
            for (Gbufi = 0; Gbufi < rtn; Gbufi++)
                Gbufp[Gbufi] = tb.ptr[Gbufi];
            Gbufp[Gbufi++] = '\000';
            attrp[ai].u.t = &Gbufp[0];
            break;
        case G_ATTRAPPENDTEXT:
            Gerr (POS, G_ERRCANNOTGETATTR, "appendtext");
            return -1;
        case G_ATTRSELECTION:
            w = XawTextGetSource (widget->w);
            XawTextGetSelectionPos (widget->w, &fi, &li);
            tb.firstPos = 0, tb.ptr = NULL, tb.format = FMT8BIT, tb.length = 0;
            rtn = XawTextSourceRead (w, fi, &tb, li - fi);
            if (li - fi > Gbufn + 1) {
                Gbufp = Marraygrow (Gbufp, (long) (rtn + 1) * BUFSIZE);
                Gbufn = rtn + 1;
            }
            for (Gbufi = 0; Gbufi < li - fi; Gbufi++)
                Gbufp[Gbufi] = tb.ptr[Gbufi];
            Gbufp[Gbufi++] = '\000';
            attrp[ai].u.t = &Gbufp[0];
            break;
        case G_ATTRMODE:
            ADD2ARGS (XtNeditType, &mode);
            XtGetValues (widget->w, argp, argn);
            if (mode == XawtextAppend)
                attrp[ai].u.t = "oneline";
            else if (mode == XawtextEdit)
                attrp[ai].u.t = "input";
            else if (mode == XawtextRead)
                attrp[ai].u.t = "output";
            else {
                panic (POS, "GTgetwidgetattr", "unexpected text mode");
                return -1;
            }
            break;
        case G_ATTRWINDOWID:
            sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w));
            attrp[ai].u.t = &Gbufp[0];
            break;
        case G_ATTRNEWLINECB:
            attrp[ai].u.func = WTU->func;
            break;
        case G_ATTRUSERDATA:
            attrp[ai].u.u = widget->udata;
            break;
        default:
            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
            return -1;
        }
    }
    return 0;
}
Пример #9
0
/*
 * This function does not know about drawing more than one line of text.
 */
static void
DisplayText(
	       Widget w,
	       Position x,
	       Position y,
	       XawTextPosition pos1,
	       XawTextPosition pos2,
	       Boolean highlight)
{
    MultiSinkObject sink = (MultiSinkObject) w;
    Widget source = XawTextGetSource(XtParent(w));
    wchar_t buf[BUFSIZ];
    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);

    int j, k;
    XawTextBlock blk;
    GC gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc;
    GC invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc;

    if (!sink->multi_sink.echo)
	return;

    y = (Position) (y + abs(ext->max_logical_extent.y));
    for (j = 0; pos1 < pos2;) {
	pos1 = (int) XawTextSourceRead(source, pos1, &blk, (int) (pos2 - pos1));
	for (k = 0; k < blk.length; k++) {
	    if (j >= BUFSIZ) {	/* buffer full, dump the text. */
		x = (Position) (x + PaintText(w, gc, x, y, buf, j));
		j = 0;
	    }
	    buf[j] = ((wchar_t *) blk.ptr)[k];
	    if (buf[j] == _Xaw_atowc(XawLF))
		continue;

	    else if (buf[j] == _Xaw_atowc(XawTAB)) {
		Position temp = 0;
		Dimension width;

		if ((j != 0)
		    && ((temp = (Position) PaintText(w, gc, x, y, buf, j)
			) == 0))
		    return;

		x = (Position) (x + temp);
		width = (Dimension) CharWidth(w, x, _Xaw_atowc(XawTAB));
		XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
			       invgc, (int) x,
			       (int) y - abs(ext->max_logical_extent.y),
			       (unsigned int) width,
			       (unsigned int) ext->max_logical_extent.height);
		x = (Position) (x + width);
		j = -1;
	    } else if (XwcTextEscapement(sink->multi_sink.fontset,
					 &buf[j], 1) == 0) {
		if (sink->multi_sink.display_nonprinting)
		    buf[j] = _Xaw_atowc('@');
		else
		    buf[j] = _Xaw_atowc(' ');
	    }
	    j++;
	}
    }
    if (j > 0)
	(void) PaintText(w, gc, x, y, buf, j);
}
/*
 * The following procedure manages the "insert" cursor
 */
static void
InsertCursor(Widget w, int x, int y, XawTextInsertState state)
{
    MultiSinkObject sink = (MultiSinkObject)w;
    XFontSet fontset = sink->multi_sink.fontset;
    Widget ctx = XtParent(w);
    XawTextPosition position = XawTextGetInsertionPoint(ctx);

    if (XtIsRealized(ctx)) {
	int fheight, fdiff;
	XawTextBlock block;
	wchar_t c;
	XawTextPosition selection_start, selection_end;
	Boolean has_selection;
	XFontSetExtents *ext = XExtentsOfFontSet(fontset);

	XawTextGetSelectionPos((Widget)ctx, &selection_start, &selection_end);
	has_selection = selection_start != selection_end;

	fheight = ext->max_logical_extent.height;
	fdiff = fheight - abs(ext->max_logical_extent.y);

	if ((sink->multi_sink.cursor_position != position || state == XawisOff)
	    && !has_selection && sink->multi_sink.laststate != XawisOff) {
	    wchar_t *ochar;

	    (void)XawTextSourceRead(XawTextGetSource(ctx),
				    sink->multi_sink.cursor_position,
				    &block, 1);
	    if (!block.length)
		ochar = NULL;
	    else {
		c = ((wchar_t *)block.ptr)[0];
		if (c == _Xaw_atowc(XawLF))
		    ochar = NULL;
		else if (c == _Xaw_atowc(XawTAB))
		    ochar = wspace;
		else
		    ochar = (wchar_t *)block.ptr;
	    }

	    if (!ochar)
		_XawTextSinkClearToBackground(w, sink->multi_sink.cursor_x,
					      (sink->multi_sink.cursor_y - 1 -
					      fheight), CharWidth(sink, fontset,
								  0, wspace[0]),
					      fheight);
	    else {
		if (XwcTextEscapement(sink->multi_sink.fontset, ochar, 1) != 0)
		    DisplayText(w, sink->multi_sink.cursor_x,
				sink->multi_sink.cursor_y - 1 - fheight,
				sink->multi_sink.cursor_position,
				sink->multi_sink.cursor_position + 1,
				False);
		else
		    PaintText(w, sink->multi_sink.normgc,
			      sink->multi_sink.cursor_x,
			      sink->multi_sink.cursor_y - 1 - fdiff,
			      ochar, 1,
			      ctx->core.background_pixmap != XtUnspecifiedPixmap);
	    }
	}

	if (!has_selection && state != XawisOff) {
	    wchar_t *nchar;
	    Boolean focus = ((TextWidget)ctx)->text.hasfocus;

	    (void)XawTextSourceRead(XawTextGetSource(ctx),
				    position, &block, 1);
	    c = ((wchar_t *)block.ptr)[0];
	    if (!block.length || c == _Xaw_atowc(XawLF)
		|| c == _Xaw_atowc(XawTAB))
		nchar = wspace;
	    else
		nchar = (wchar_t *)block.ptr;

	    if (focus) {
		if (XwcTextEscapement(sink->multi_sink.fontset, nchar, 1) != 0)
		    XwcDrawImageString(XtDisplay(ctx), XtWindow(ctx),
				       fontset, sink->multi_sink.invgc,
				       x, (y - 1 - fdiff), nchar, 1);
		else
		    DisplayText(w, x, y - 1 - fheight,
				position, position + 1, True);
	    }
	    else
		XDrawRectangle(XtDisplay(ctx), XtWindow(ctx),
			       sink->multi_sink.xorgc ?
			       sink->multi_sink.xorgc : sink->multi_sink.normgc,
			       x, y - 1 - fheight,
			       CharWidth(sink, fontset, 0, *nchar) - 1,
			       fheight - 1);
	  }
      }

    sink->multi_sink.cursor_x = x;
    sink->multi_sink.cursor_y = y;
    sink->multi_sink.laststate = state;
    sink->multi_sink.cursor_position = position;
}
/*
 * This function does not know about drawing more than one line of text
 */
static void
DisplayText(Widget w, int x, int y,
	    XawTextPosition pos1, XawTextPosition pos2, Bool highlight)
{
    TextWidget ctx = (TextWidget)XtParent(w);
    MultiSinkObject sink = (MultiSinkObject)w;
    XFontSet fontset = sink->multi_sink.fontset;
    Widget source = XawTextGetSource(XtParent(w));
    wchar_t buf[256];
    XFontSetExtents *ext = XExtentsOfFontSet(fontset);
    int j, k;
    XawTextBlock blk;
    GC gc, invgc, tabgc;
    int max_x;
    Bool clear_bg;

    if (!sink->multi_sink.echo || !ctx->text.lt.lines)
	return;

    max_x = (int)XtWidth(ctx) - ctx->text.r_margin.right;
    clear_bg = !highlight && ctx->core.background_pixmap != XtUnspecifiedPixmap;

    gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc;
    invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc;

    if (highlight && sink->multi_sink.xorgc)
	tabgc = sink->multi_sink.xorgc;
    else
	tabgc = invgc;

    y += abs(ext->max_logical_extent.y);
    for (j = 0; pos1 < pos2;) {
	pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1);
	for (k = 0; k < blk.length; k++) {
	    if ((unsigned) j >= (sizeof(buf) / sizeof(wchar_t)) - 1) {
		/* buffer full, dump the text */
		if ((x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
		    return;
		j = 0;
	    }
	    buf[j] = ((wchar_t *)blk.ptr)[k];
	    if (buf[j] == _Xaw_atowc(XawLF))
		continue;

	    else if (buf[j] == _Xaw_atowc(XawTAB)) {
		unsigned int width;

		if (j != 0 &&
		    (x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
		    return;

		width = CharWidth(sink, fontset, x, _Xaw_atowc(XawTAB));
		if (clear_bg)
		    _XawTextSinkClearToBackground(w,
					x, y - abs(ext->max_logical_extent.y),
					width, ext->max_logical_extent.height);
		else
		    XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
				   tabgc, x,
				   y - abs(ext->max_logical_extent.y),
				   width,
				   ext->max_logical_extent.height);
		x += width;
		j = -1;
	    }
	    else if (XwcTextEscapement(sink->multi_sink.fontset, &buf[j], 1)
		     == 0) {
		if (sink->multi_sink.display_nonprinting)
		    buf[j] = _Xaw_atowc('@');
		else
		    buf[j] = _Xaw_atowc(XawSP);
	    }
	    j++;
	}
    }

    if (j > 0)
	(void)PaintText(w, gc, x, y, buf, j, clear_bg);
}