# HG changeset patch # User Claus Gittinger # Date 1014805407 -3600 # Node ID 6ac2b6c8fbd85c5a3c73060f73cb9fea27a61e56 # Parent 62e5a818d37831f7c996c6055c3a69613f4bb070 primDrawBits - additional msb argument diff -r 62e5a818d378 -r 6ac2b6c8fbd8 XWorkstation.st --- a/XWorkstation.st Tue Feb 26 14:06:07 2002 +0100 +++ b/XWorkstation.st Wed Feb 27 11:23:27 2002 +0100 @@ -3125,35 +3125,35 @@ && __isExternalAddress(aDrawableId) && __bothSmallInteger(x0, y0) && __bothSmallInteger(x1, y1)) { - Display *dpy = myDpy; - int ix0, iy0, ix1, iy1; - gc = __GCVal(aGCId); - win = __WindowVal(aDrawableId); - - ix0 = __intVal(x0); - iy0 = __intVal(y0); - ix1 = __intVal(x1); - iy1 = __intVal(y1); - - /* attention: coordinates in X are shorts and wrap; clamp here. */ - if (ix0 > 0x7FFF) ix0 = 0x7FFF; - else if (ix0 < -0x8000) ix0 = -0x8000; - if (iy0 > 0x7FFF) iy0 = 0x7FFF; - else if (iy0 < -0x8000) iy0 = -0x8000; - if (ix1 > 0x7FFF) ix1 = 0x7FFF; - else if (ix1 < -0x8000) ix1 = -0x8000; - if (iy1 > 0x7FFF) iy1 = 0x7FFF; - else if (iy1 < -0x8000) iy1 = -0x8000; - - ENTER_XLIB(); - if ((ix0 == ix1) && (iy0 == iy1)) { - /* little bit shorter X-lib message (better with slow connections...) */ - XDrawPoint(dpy, win, gc, ix0, iy0); - } else { - XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1); - } - LEAVE_XLIB(); - RETURN ( self ); + Display *dpy = myDpy; + int ix0, iy0, ix1, iy1; + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); + + ix0 = __intVal(x0); + iy0 = __intVal(y0); + ix1 = __intVal(x1); + iy1 = __intVal(y1); + + /* attention: coordinates in X are shorts and wrap; clamp here. */ + if (ix0 > 0x7FFF) ix0 = 0x7FFF; + else if (ix0 < -0x8000) ix0 = -0x8000; + if (iy0 > 0x7FFF) iy0 = 0x7FFF; + else if (iy0 < -0x8000) iy0 = -0x8000; + if (ix1 > 0x7FFF) ix1 = 0x7FFF; + else if (ix1 < -0x8000) ix1 = -0x8000; + if (iy1 > 0x7FFF) iy1 = 0x7FFF; + else if (iy1 < -0x8000) iy1 = -0x8000; + + ENTER_XLIB(); + if ((ix0 == ix1) && (iy0 == iy1)) { + /* little bit shorter X-lib message (better with slow connections...) */ + XDrawPoint(dpy, win, gc, ix0, iy0); + } else { + XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1); + } + LEAVE_XLIB(); + RETURN ( self ); } %}. "badGC, badDrawable or coordinates not integer" @@ -3170,7 +3170,7 @@ |noY| (noY := yValues size) < 2 ifTrue:[ - ^ self + ^ self ]. %{ @@ -3187,110 +3187,110 @@ if (ISCONNECTED && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) ) { - gc = __GCVal(aGCId); - win = __WindowVal(aDrawableId); - - if( __isSmallInteger(scaleY) ) - sY = (float) __intVal( scaleY ); - else if (__isFloat(scaleY)) - sY = __floatVal( scaleY ); - else if (__isShortFloat(scaleY)) - sY = __shortFloatVal( scaleY ); - else { - t = __SSEND0(scaleY, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - sY = __floatVal( t ); - } - - if( __isSmallInteger(transY) ) - tY = (float) __intVal( transY ); - else if (__isFloat(transY)) - tY = __floatVal( transY ); - else if (__isShortFloat(transY)) - tY = __shortFloatVal( transY ); - else { - t = __SSEND0(transY, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - tY = __floatVal( t ); - } - - if( __isSmallInteger(startX) ) - x = (float) __intVal( startX ); - else if (__isFloat(startX)) - x = __floatVal( startX ); - else if (__isShortFloat(startX)) - x = __shortFloatVal( startX ); - else { - t = __SSEND0(startX, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - x = __floatVal( t ); - } - - if( __isSmallInteger(stepX) ) - step = (float) __intVal( stepX ); - else if (__isFloat(stepX)) - step = __floatVal( stepX ); - else if (__isShortFloat(stepX)) - step = __shortFloatVal( stepX ); - else { - t = __SSEND0(stepX, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - step = __floatVal( t ); - } - - num = __intVal( noY ); - - if( num > 200 ) { - if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) - goto fail; - mustFree = 1; - } else { - points = qPoints; - } - for( i = 0; i < num; ++i ) { - int px, py; - - yA = __AT_(yValues, __MKSMALLINT(i+1) ); - - if( __isFloat(yA) ) - y = __floatVal( yA ); - else if( __isSmallInteger(yA) ) - y = (float) __intVal( yA ); - else if( __isShortFloat( yA) ) - y = __shortFloatVal( yA ); - else { - t = __SSEND0(yA, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - y = __floatVal( t ); - } - - px = (int) (x + 0.5); - py = (int) ((y * sY) + tY + 0.5); - - /* attention: coordinates in X are shorts and wrap; clamp here. */ - if (px > 0x7FFF) px = 0x7FFF; - else if (px < -0x8000) px = -0x8000; - if (py > 0x7FFF) py = 0x7FFF; - else if (py < -0x8000) py = -0x8000; - - points[i].x = px; - points[i].y = py; - x = x + step; - } - - ENTER_XLIB(); - XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); - LEAVE_XLIB(); - - if( mustFree ) { - free( points ); - } - RETURN ( self ); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); + + if( __isSmallInteger(scaleY) ) + sY = (float) __intVal( scaleY ); + else if (__isFloat(scaleY)) + sY = __floatVal( scaleY ); + else if (__isShortFloat(scaleY)) + sY = __shortFloatVal( scaleY ); + else { + t = __SSEND0(scaleY, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + sY = __floatVal( t ); + } + + if( __isSmallInteger(transY) ) + tY = (float) __intVal( transY ); + else if (__isFloat(transY)) + tY = __floatVal( transY ); + else if (__isShortFloat(transY)) + tY = __shortFloatVal( transY ); + else { + t = __SSEND0(transY, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + tY = __floatVal( t ); + } + + if( __isSmallInteger(startX) ) + x = (float) __intVal( startX ); + else if (__isFloat(startX)) + x = __floatVal( startX ); + else if (__isShortFloat(startX)) + x = __shortFloatVal( startX ); + else { + t = __SSEND0(startX, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + x = __floatVal( t ); + } + + if( __isSmallInteger(stepX) ) + step = (float) __intVal( stepX ); + else if (__isFloat(stepX)) + step = __floatVal( stepX ); + else if (__isShortFloat(stepX)) + step = __shortFloatVal( stepX ); + else { + t = __SSEND0(stepX, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + step = __floatVal( t ); + } + + num = __intVal( noY ); + + if( num > 200 ) { + if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) + goto fail; + mustFree = 1; + } else { + points = qPoints; + } + for( i = 0; i < num; ++i ) { + int px, py; + + yA = __AT_(yValues, __MKSMALLINT(i+1) ); + + if( __isFloat(yA) ) + y = __floatVal( yA ); + else if( __isSmallInteger(yA) ) + y = (float) __intVal( yA ); + else if( __isShortFloat( yA) ) + y = __shortFloatVal( yA ); + else { + t = __SSEND0(yA, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + y = __floatVal( t ); + } + + px = (int) (x + 0.5); + py = (int) ((y * sY) + tY + 0.5); + + /* attention: coordinates in X are shorts and wrap; clamp here. */ + if (px > 0x7FFF) px = 0x7FFF; + else if (px < -0x8000) px = -0x8000; + if (py > 0x7FFF) py = 0x7FFF; + else if (py < -0x8000) py = -0x8000; + + points[i].x = px; + points[i].y = py; + x = x + step; + } + + ENTER_XLIB(); + XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); + LEAVE_XLIB(); + + if( mustFree ) { + free( points ); + } + RETURN ( self ); } fail: if( mustFree ) - free( points ); + free( points ); %}. ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId @@ -3310,23 +3310,23 @@ && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { - int px, py; - - gc = __GCVal(aGCId); - win = __WindowVal(aDrawableId); - - px = __intVal(x); - py = __intVal(y); - if (px > 0x7FFF) px = 0x7FFF; - else if (px < -0x8000) px = -0x8000; - if (py > 0x7FFF) py = 0x7FFF; - else if (py < -0x8000) py = -0x8000; - - ENTER_XLIB(); - XDrawPoint(myDpy, win, gc, px, py); - LEAVE_XLIB(); - - RETURN ( self ); + int px, py; + + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); + + px = __intVal(x); + py = __intVal(y); + if (px > 0x7FFF) px = 0x7FFF; + else if (px < -0x8000) px = -0x8000; + if (py > 0x7FFF) py = 0x7FFF; + else if (py < -0x8000) py = -0x8000; + + ENTER_XLIB(); + XDrawPoint(myDpy, win, gc, px, py); + LEAVE_XLIB(); + + RETURN ( self ); } %}. "badGC, badDrawable or x/y not integer" @@ -3356,53 +3356,53 @@ && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) && __isSmallInteger(numberOfPoints)) { - gc = __GCVal(aGCId); - win = __WindowVal(aDrawableId); - num = __intVal(numberOfPoints); - /* - * avoid a (slow) malloc, if the number of points is small - */ - if (num > 100) { - points = (XPoint *)malloc(sizeof(XPoint) * num); - if (! points) goto fail; - mustFree = 1; - } else - points = qPoints; - - for (i=0; i 0x7FFF) px = 0x7FFF; - else if (px < -0x8000) px = -0x8000; - if (py > 0x7FFF) py = 0x7FFF; - else if (py < -0x8000) py = -0x8000; - - points[i].x = px; - points[i].y = py; - } - - ENTER_XLIB(); - XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); - LEAVE_XLIB(); - - if (mustFree) - free(points); - RETURN ( self ); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); + num = __intVal(numberOfPoints); + /* + * avoid a (slow) malloc, if the number of points is small + */ + if (num > 100) { + points = (XPoint *)malloc(sizeof(XPoint) * num); + if (! points) goto fail; + mustFree = 1; + } else + points = qPoints; + + for (i=0; i 0x7FFF) px = 0x7FFF; + else if (px < -0x8000) px = -0x8000; + if (py > 0x7FFF) py = 0x7FFF; + else if (py < -0x8000) py = -0x8000; + + points[i].x = px; + points[i].y = py; + } + + ENTER_XLIB(); + XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); + LEAVE_XLIB(); + + if (mustFree) + free(points); + RETURN ( self ); } fail: ; if (mustFree) - free(points); + free(points); %}. "badGC, badDrawable or coordinates not integer" self primitiveFailedOrClosedConnection @@ -3423,31 +3423,31 @@ && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y) && __bothSmallInteger(width, height)) { - int px, py; - - gc = __GCVal(aGCId); - win = __WindowVal(aDrawableId); - w = __intVal(width); - h = __intVal(height); - - /* - * need this check here: some servers simply dump core with bad args - */ - if ((w >= 0) && (h >= 0)) { - px = __intVal(x); - py = __intVal(y); - - /* attention: coordinates in X are shorts and wrap; clamp here. */ - if (px > 0x7FFF) px = 0x7FFF; - else if (px < -0x8000) px = -0x8000; - if (py > 0x7FFF) py = 0x7FFF; - else if (py < -0x8000) py = -0x8000; - - ENTER_XLIB(); - XDrawRectangle(myDpy, win, gc, px, py, w, h); - LEAVE_XLIB(); - } - RETURN ( self ); + int px, py; + + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); + w = __intVal(width); + h = __intVal(height); + + /* + * need this check here: some servers simply dump core with bad args + */ + if ((w >= 0) && (h >= 0)) { + px = __intVal(x); + py = __intVal(y); + + /* attention: coordinates in X are shorts and wrap; clamp here. */ + if (px > 0x7FFF) px = 0x7FFF; + else if (px < -0x8000) px = -0x8000; + if (py > 0x7FFF) py = 0x7FFF; + else if (py < -0x8000) py = -0x8000; + + ENTER_XLIB(); + XDrawRectangle(myDpy, win, gc, px, py, w, h); + LEAVE_XLIB(); + } + RETURN ( self ); } %}. "badGC, badDrawable or coordinates not integer" @@ -3753,6 +3753,7 @@ primDrawBits:bits bitsPerPixel:bitsPerPixel depth:imageDepth + msb:true padding:padding width:imageWidth height:imageHeight x:srcx y:srcy @@ -3925,7 +3926,7 @@ self primitiveFailedOrClosedConnection ! -primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding +primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding width:imageWidth height:imageHeight x:srcx y:srcy into:aDrawableId @@ -3974,7 +3975,7 @@ image.height = __intVal(imageHeight); image.xoffset = 0; image.format = ZPixmap; - image.byte_order = MSBFirst; + image.byte_order = (msb == true) ? MSBFirst : LSBFirst; image.bitmap_unit = 8; image.bitmap_bit_order = MSBFirst; image.bitmap_pad = pad; @@ -4177,11 +4178,11 @@ self configureX:x y:y width:w height:h view:view. above notNil ifTrue:[ - |aboveView| - aboveView := self viewFromId:above. - aboveView notNil ifTrue:[ - self coveredBy:aboveView view:view. - ]. + |aboveView| + aboveView := self viewFromId:above. + aboveView notNil ifTrue:[ + self coveredBy:aboveView view:view. + ]. ]. ! @@ -6841,37 +6842,37 @@ int len; if (ISCONNECTED) { - if (__isExternalAddress(fontId)) { - f = __FontVal(fontId); - if (f) { - avgAscent = __MKSMALLINT(f->ascent); - avgDescent = __MKSMALLINT(f->descent); - maxAscent = __MKSMALLINT(f->max_bounds.ascent); - maxDescent = __MKSMALLINT(f->max_bounds.descent); - minWidth = __MKSMALLINT(f->min_bounds.width); - maxWidth = __MKSMALLINT(f->max_bounds.width); - - ENTER_XLIB(); - len = XTextWidth(f, " ", 1); - LEAVE_XLIB(); - - avgWidth = __MKSMALLINT( len ); - } - } + if (__isExternalAddress(fontId)) { + f = __FontVal(fontId); + if (f) { + avgAscent = __MKSMALLINT(f->ascent); + avgDescent = __MKSMALLINT(f->descent); + maxAscent = __MKSMALLINT(f->max_bounds.ascent); + maxDescent = __MKSMALLINT(f->max_bounds.descent); + minWidth = __MKSMALLINT(f->min_bounds.width); + maxWidth = __MKSMALLINT(f->max_bounds.width); + + ENTER_XLIB(); + len = XTextWidth(f, " ", 1); + LEAVE_XLIB(); + + avgWidth = __MKSMALLINT( len ); + } + } } %}. avgAscent == nil ifTrue:[ - self primitiveFailedOrClosedConnection. - ^ nil + self primitiveFailedOrClosedConnection. + ^ nil ]. maxAscent == 0 ifTrue:[ - "DingBats font does not define this" - maxAscent := avgAscent. + "DingBats font does not define this" + maxAscent := avgAscent. ]. maxDescent == 0 ifTrue:[ - "DingBats font does not define this" - maxDescent := avgDescent + "DingBats font does not define this" + maxDescent := avgDescent ]. info := DeviceWorkstation::DeviceFontMetrics new. @@ -7021,36 +7022,36 @@ int i; if (ISCONNECTED) { - if (__isString(pattern)) { - for (;;) { - ENTER_XLIB(); - fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); - LEAVE_XLIB(); - if (fonts == 0) RETURN(nil); - if (available < nnames) break; - XFreeFontNames(fonts); - nnames = available * 2; - } - - /* - * now, that we know the number of font names, - * create the array ... - */ - arr = __ARRAY_NEW_INT(available); - if (arr != nil) { - /* - * ... and fill it - */ - for (i=0; ia_element[i] = str; __STORE(arr, str); - } - } - XFreeFontNames(fonts); - RETURN (arr); - } + if (__isString(pattern)) { + for (;;) { + ENTER_XLIB(); + fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); + LEAVE_XLIB(); + if (fonts == 0) RETURN(nil); + if (available < nnames) break; + XFreeFontNames(fonts); + nnames = available * 2; + } + + /* + * now, that we know the number of font names, + * create the array ... + */ + arr = __ARRAY_NEW_INT(available); + if (arr != nil) { + /* + * ... and fill it + */ + for (i=0; ia_element[i] = str; __STORE(arr, str); + } + } + XFreeFontNames(fonts); + RETURN (arr); + } } %}. ^ nil @@ -7377,10 +7378,10 @@ sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. (sizes notNil and:[sizes includes:0]) ifTrue:[ - "special: in X11R5 and above, size 0 means: - there are scaled versions in all sizes available" - - ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) + "special: in X11R5 and above, size 0 means: + there are scaled versions in all sizes available" + + ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) ]. ^ sizes @@ -7407,113 +7408,113 @@ XCharStruct overAllReturn; if (ISCONNECTED) { - if (__bothSmallInteger(index1, index2) - && __isExternalAddress(aFontId) - && __isNonNilObject(aString)) { - int lMax = __intVal(@global(XWorkstation:MaxStringLength)); - f = __FontVal(aFontId); - if (! f) goto fail; - - i1 = __intVal(index1) - 1; - cls = __qClass(aString); - - if (i1 >= 0) { - i2 = __intVal(index2) - 1; - if (i2 < i1) { - RETURN ( __MKSMALLINT(0) ); - } - - cp = (char *) __stringVal(aString); - l = i2 - i1 + 1; - - if ((cls == @global(String)) || (cls == @global(Symbol))) { - n = __stringSize(aString); - if (i2 < n) { - cp += i1; + if (__bothSmallInteger(index1, index2) + && __isExternalAddress(aFontId) + && __isNonNilObject(aString)) { + int lMax = __intVal(@global(XWorkstation:MaxStringLength)); + f = __FontVal(aFontId); + if (! f) goto fail; + + i1 = __intVal(index1) - 1; + cls = __qClass(aString); + + if (i1 >= 0) { + i2 = __intVal(index2) - 1; + if (i2 < i1) { + RETURN ( __MKSMALLINT(0) ); + } + + cp = (char *) __stringVal(aString); + l = i2 - i1 + 1; + + if ((cls == @global(String)) || (cls == @global(Symbol))) { + n = __stringSize(aString); + if (i2 < n) { + cp += i1; #if 0 - ENTER_XLIB(); - len = XQueryTextExtents(myDpy, f->fid, cp, l, - &directionReturn, &fontAscentReturn, &fontDescentReturn, - &overAllReturn); - LEAVE_XLIB(); - printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); + ENTER_XLIB(); + len = XQueryTextExtents(myDpy, f->fid, cp, l, + &directionReturn, &fontAscentReturn, &fontDescentReturn, + &overAllReturn); + LEAVE_XLIB(); + printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); #endif - ENTER_XLIB(); - len = XTextWidth(f, cp, l); - LEAVE_XLIB(); - - RETURN ( __MKSMALLINT(len) ); - } - } - - nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); - cp += nInstBytes; - - if (__isBytes(aString)) { - n = __byteArraySize(aString) - nInstBytes; - if (i2 < n) { - cp += i1; - - ENTER_XLIB(); - len = XTextWidth(f, cp, l); - LEAVE_XLIB(); - - RETURN ( __MKSMALLINT(len) ); - } - } - - /* TWOBYTESTRINGS */ - if (__isWords(aString)) { - n = (__byteArraySize(aString) - nInstBytes) / 2; - - if (i2 < n) { - union { - char b[2]; - unsigned short s; - } u; - int i; - XChar2b *cp2 = (XChar2b *)0; - int mustFree = 0; - - cp += (i1 * 2); - if (l > lMax) l = lMax; - - /* - * ST/X TwoByteStrings store the asciiValue in native byteOrder; - * X expects them MSB first - * convert as required - */ - - u.s = 0x1234; - if (u.b[0] != 0x12) { - if (l <= NLOCALBUFFER) { - cp2 = xlatebuffer; - } else { - cp2 = (XChar2b *)(malloc(l * 2)); - mustFree = 1; - } - for (i=0; ic_ninstvars)); + cp += nInstBytes; + + if (__isBytes(aString)) { + n = __byteArraySize(aString) - nInstBytes; + if (i2 < n) { + cp += i1; + + ENTER_XLIB(); + len = XTextWidth(f, cp, l); + LEAVE_XLIB(); + + RETURN ( __MKSMALLINT(len) ); + } + } + + /* TWOBYTESTRINGS */ + if (__isWords(aString)) { + n = (__byteArraySize(aString) - nInstBytes) / 2; + + if (i2 < n) { + union { + char b[2]; + unsigned short s; + } u; + int i; + XChar2b *cp2 = (XChar2b *)0; + int mustFree = 0; + + cp += (i1 * 2); + if (l > lMax) l = lMax; + + /* + * ST/X TwoByteStrings store the asciiValue in native byteOrder; + * X expects them MSB first + * convert as required + */ + + u.s = 0x1234; + if (u.b[0] != 0x12) { + if (l <= NLOCALBUFFER) { + cp2 = xlatebuffer; + } else { + cp2 = (XChar2b *)(malloc(l * 2)); + mustFree = 1; + } + for (i=0; ifid, cp, n, - &directionReturn, &fontAscentReturn, &fontDescentReturn, - &overAllReturn); - LEAVE_XLIB(); - printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); + ENTER_XLIB(); + len = XQueryTextExtents(myDpy, f->fid, cp, n, + &directionReturn, &fontAscentReturn, &fontDescentReturn, + &overAllReturn); + LEAVE_XLIB(); + printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); #endif - ENTER_XLIB(); - len = XTextWidth(f, cp, n); - LEAVE_XLIB(); - - RETURN ( __MKSMALLINT(len) ); - } - - nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); - cp += nInstBytes; - - if (__isBytes(aString)) { - n = __byteArraySize(aString) - nInstBytes; - - - ENTER_XLIB(); - len = XTextWidth(f, cp, n); - LEAVE_XLIB(); - - RETURN ( __MKSMALLINT(len) ); - } - - /* TWOBYTESTRINGS */ - if (__isWords(aString)) { - union { - char b[2]; - unsigned short s; - } u; - int i; - XChar2b *cp2; - int mustFree = 0; - - n = (__byteArraySize(aString) - nInstBytes) / 2; - if (n > lMax) n = lMax; - - /* - * ST/X TwoByteStrings store the asciiValue in native byteOrder; - * X expects them MSB first - * convert as required - */ - - u.s = 0x1234; - if (u.b[0] != 0x12) { - if (n <= NLOCALBUFFER) { - cp2 = xlatebuffer; - } else { - cp2 = (XChar2b *)(malloc(n * 2)); - mustFree = 1; - } - - for (i=0; ic_ninstvars)); + cp += nInstBytes; + + if (__isBytes(aString)) { + n = __byteArraySize(aString) - nInstBytes; + + + ENTER_XLIB(); + len = XTextWidth(f, cp, n); + LEAVE_XLIB(); + + RETURN ( __MKSMALLINT(len) ); + } + + /* TWOBYTESTRINGS */ + if (__isWords(aString)) { + union { + char b[2]; + unsigned short s; + } u; + int i; + XChar2b *cp2; + int mustFree = 0; + + n = (__byteArraySize(aString) - nInstBytes) / 2; + if (n > lMax) n = lMax; + + /* + * ST/X TwoByteStrings store the asciiValue in native byteOrder; + * X expects them MSB first + * convert as required + */ + + u.s = 0x1234; + if (u.b[0] != 0x12) { + if (n <= NLOCALBUFFER) { + cp2 = xlatebuffer; + } else { + cp2 = (XChar2b *)(malloc(n * 2)); + mustFree = 1; + } + + for (i=0; i