--- a/XftFontDescription.st Sun Dec 21 23:35:51 2014 +0100
+++ b/XftFontDescription.st Sun Dec 21 23:49:22 2014 +0100
@@ -310,38 +310,38 @@
|proto|
- RecentlyUsedFonts notNil ifTrue:[
- proto := RecentlyUsedFonts
- detect:[:fn |
- fn family = familyString
- and:[ fn size = size and:[fn sizeUnit = sizeUnit
- and:[ fn face = faceString
- and:[ (fn style = styleString
- or:[ (fn style = 'oblique' and:[styleString = 'italic'])
- or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]]]
- ifNone:nil.
- proto notNil ifTrue:[
- ^ proto
- ].
+ RecentlyUsedFonts notNil ifTrue:[
+ proto := RecentlyUsedFonts
+ detect:[:fn |
+ fn family = familyString
+ and:[ fn size = size and:[fn sizeUnit = sizeUnit
+ and:[ fn face = faceString
+ and:[ (fn style = styleString
+ or:[ (fn style = 'oblique' and:[styleString = 'italic'])
+ or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]]]
+ ifNone:nil.
+ proto notNil ifTrue:[
+ ^ proto
+ ].
].
CachedFontList notNil ifTrue:[
- proto := CachedFontList
- detect:[:fn |
- fn family = familyString
- and:[ fn face = faceString
- and:[ (fn style = styleString
- or:[ (fn style = 'oblique' and:[styleString = 'italic'])
- or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]
- ifNone:nil.
- proto notNil ifTrue:[
- ^ (proto shallowCopy)
- setDevice: nil patternId: nil fontId: nil;
- family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
- ].
+ proto := CachedFontList
+ detect:[:fn |
+ fn family = familyString
+ and:[ fn face = faceString
+ and:[ (fn style = styleString
+ or:[ (fn style = 'oblique' and:[styleString = 'italic'])
+ or:[ (fn style = 'italic' and:[styleString = 'oblique']) ]]) ]]]
+ ifNone:nil.
+ proto notNil ifTrue:[
+ ^ (proto shallowCopy)
+ setDevice: nil patternId: nil fontId: nil;
+ family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
+ ].
].
^ super
- family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
+ family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
!
new
@@ -566,46 +566,46 @@
displayString:aString from:index1 to:index2Arg x:xArg y:yArg in:aGC opaque:opaque
"display a partial string at some position in aGC."
- |index2 bytesPerCharacter transformation
+ |index2 bytesPerCharacter transformation
clipR clipX clipY clipW clipH clipPnt
- fg fgR fgG fgB fgA fgPixel bg bgR bgG bgB bgA bgPixel
+ fg fgR fgG fgB fgA fgPixel bg bgR bgG bgB bgA bgPixel
drawX drawY drawPnt displayId screen drawableId error stringLen|
"limit the string len, otherwise bad output is generated"
stringLen := index2Arg - index1 + 1.
stringLen > 8000 ifTrue:[
- index2 := index1 + 8000 - 1.
+ index2 := index1 + 8000 - 1.
] ifFalse:[
- stringLen <= 0 ifTrue:[^ self].
- index2 := index2Arg.
+ stringLen <= 0 ifTrue:[^ self].
+ index2 := index2Arg.
].
bytesPerCharacter := aString bitsPerCharacter // 8.
transformation := aGC transformation.
clipR := aGC clippingBoundsOrNil.
clipR notNil ifTrue:[
- clipX := clipR left.
- clipY := clipR top.
- clipW := clipR width.
- clipH := clipR height.
- "/ YES YES YES: this MUST be transformed!!
- "/ (see htmlView) fix the notebook, please.
- transformation notNil ifTrue:[
- clipPnt := transformation applyTo:(clipX @ clipY).
- clipX := clipPnt x ceiling.
- clipY := clipPnt y ceiling.
+ clipX := clipR left.
+ clipY := clipR top.
+ clipW := clipR width.
+ clipH := clipR height.
+ "/ YES YES YES: this MUST be transformed!!
+ "/ (see htmlView) fix the notebook, please.
+ transformation notNil ifTrue:[
+ clipPnt := transformation applyTo:(clipX @ clipY).
+ clipX := clipPnt x ceiling.
+ clipY := clipPnt y ceiling.
"/ clipX := (transformation applyToX:clipX) ceiling.
"/ clipY := (transformation applyToY:clipY) ceiling.
- ].
+ ].
].
transformation isNil ifTrue:[
- drawX := xArg.
- drawY := yArg.
+ drawX := xArg.
+ drawY := yArg.
] ifFalse:[
- drawPnt := transformation applyTo:(clipX @ clipY).
- drawX := drawPnt x ceiling.
- drawY := drawPnt y ceiling.
+ drawPnt := transformation applyTo:(clipX @ clipY).
+ drawX := drawPnt x ceiling.
+ drawY := drawPnt y ceiling.
"/ drawX := (transformation applyToX:xArg) ceiling.
"/ drawY := (transformation applyToY:yArg) ceiling.
].
@@ -613,41 +613,41 @@
fg := aGC paint.
fgPixel := fg colorId.
"/ fgPixel notNil ifTrue:[
- fgR := fg scaledRed.
- fgG := fg scaledGreen.
- fgB := fg scaledBlue.
- fgA := (fg alpha * 65535) rounded.
+ fgR := fg scaledRed.
+ fgG := fg scaledGreen.
+ fgB := fg scaledBlue.
+ fgA := (fg alpha * 65535) rounded.
"/].
fgR isNil ifTrue:[
- "/ when drawing into a pixmap...
- fg colorId == 0 ifTrue:[
- fgR := fgG := fgB := 0.
- ] ifFalse:[
- fgR := fgG := fgB := 16rFFFF.
- ]
+ "/ when drawing into a pixmap...
+ fg colorId == 0 ifTrue:[
+ fgR := fgG := fgB := 0.
+ ] ifFalse:[
+ fgR := fgG := fgB := 16rFFFF.
+ ]
].
opaque ifTrue:[
- bg := aGC backgroundPaint.
- bgPixel := bg colorId.
- "/bgPixel notNil ifTrue:[
- bgR := bg scaledRed.
- bgG := bg scaledGreen.
- bgB := bg scaledBlue.
- bgA := (bg alpha * 65535) rounded.
- "/].
- bgR isNil ifTrue:[
- "/ when drawing into a pixmap...
- bg colorId == 0 ifTrue:[
- bgR := bgG := bgB := 0.
- ] ifFalse:[
- bgR := bgG := bgB := 16rFFFF.
- ]
- ].
+ bg := aGC backgroundPaint.
+ bgPixel := bg colorId.
+ "/bgPixel notNil ifTrue:[
+ bgR := bg scaledRed.
+ bgG := bg scaledGreen.
+ bgB := bg scaledBlue.
+ bgA := (bg alpha * 65535) rounded.
+ "/].
+ bgR isNil ifTrue:[
+ "/ when drawing into a pixmap...
+ bg colorId == 0 ifTrue:[
+ bgR := bgG := bgB := 0.
+ ] ifFalse:[
+ bgR := bgG := bgB := 16rFFFF.
+ ]
+ ].
].
displayId := device displayIdOrErrorIfBroken.
displayId isNil ifTrue:[
- ^ self.
+ ^ self.
].
screen := device screen.
drawableId := aGC drawableId.
@@ -664,99 +664,99 @@
int __bytesPerCharacter;
if (!(__bothSmallInteger(drawX, drawY)
- && __bothSmallInteger(index1, index2)
- && __isSmallInteger(bytesPerCharacter)
- && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
- && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
- && __isNonNilObject(aString)
+ && __bothSmallInteger(index1, index2)
+ && __isSmallInteger(bytesPerCharacter)
+ && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
+ && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
+ && __isNonNilObject(aString)
)) {
- goto err;
+ goto err;
}
__bytesPerCharacter = __intVal(bytesPerCharacter);
if ( __INST(sharedDrawId) == nil ) {
- __INST(sharedDrawId) = XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) ,
- DRAWABLE( drawableId ) ,
- DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) ,
- DefaultColormap( DISPLAY( displayId), SCREEN (screen) ) ) );
- __STORE(self, __INST(sharedDrawId));
+ __INST(sharedDrawId) = XFT_DRAW_HANDLE_NEW ( XftDrawCreate ( DISPLAY( displayId ) ,
+ DRAWABLE( drawableId ) ,
+ DefaultVisual( DISPLAY( displayId), SCREEN (screen) ) ,
+ DefaultColormap( DISPLAY( displayId), SCREEN (screen) ) ) );
+ __STORE(self, __INST(sharedDrawId));
}
if ( XftDrawDrawable ( XFT_DRAW ( __INST(sharedDrawId) ) ) != DRAWABLE( drawableId ) ) {
- XftDrawChange( XFT_DRAW( __INST(sharedDrawId) ) , DRAWABLE( drawableId ) );
+ XftDrawChange( XFT_DRAW( __INST(sharedDrawId) ) , DRAWABLE( drawableId ) );
}
string = __stringVal( aString ) + (( __intVal(index1) - 1 ) * __bytesPerCharacter);
len = __intVal(index2) - __intVal(index1) + 1;
if (clipR != nil) {
- clipRX.x = __intVal(clipX);
- clipRX.y = __intVal(clipY);
- clipRX.width = __intVal(clipW);
- clipRX.height = __intVal(clipH);
- XftDrawSetClipRectangles( XFT_DRAW( __INST( sharedDrawId ) ) , 0, 0, &clipRX, 1);
+ clipRX.x = __intVal(clipX);
+ clipRX.y = __intVal(clipY);
+ clipRX.width = __intVal(clipW);
+ clipRX.height = __intVal(clipH);
+ XftDrawSetClipRectangles( XFT_DRAW( __INST( sharedDrawId ) ) , 0, 0, &clipRX, 1);
} else {
- XftDrawSetClip( XFT_DRAW( __INST( sharedDrawId ) ) , 0);
+ XftDrawSetClip( XFT_DRAW( __INST( sharedDrawId ) ) , 0);
}
if (opaque == true) {
- if (bgPixel != nil) {
- color.pixel = (unsigned long)__intVal(bgPixel);
- }
- // else {
- color.color.red = __intVal(bgR);
- color.color.green = __intVal(bgG);
- color.color.blue = __intVal(bgB);
- color.color.alpha = __intVal(bgA);
- // }
- switch (__bytesPerCharacter) {
- case 1:
- XftTextExtents8( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar8*)string, len, &extents);
- break;
- case 2:
- XftTextExtents16( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar16*)string, len, &extents);
- break;
- case 4:
- XftTextExtents32( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar32*)string, len, &extents);
- break;
- }
- XftDrawRect( XFT_DRAW ( __INST( sharedDrawId ) ), &color, __intVal(drawX) - extents.x, __intVal(drawY) - XFT_FONT( __INST( fontId ) )->ascent, extents.width, XFT_FONT(__INST (fontId ) )->height);
+ if (bgPixel != nil) {
+ color.pixel = (unsigned long)__intVal(bgPixel);
+ }
+ // else {
+ color.color.red = __intVal(bgR);
+ color.color.green = __intVal(bgG);
+ color.color.blue = __intVal(bgB);
+ color.color.alpha = __intVal(bgA);
+ // }
+ switch (__bytesPerCharacter) {
+ case 1:
+ XftTextExtents8( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar8*)string, len, &extents);
+ break;
+ case 2:
+ XftTextExtents16( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar16*)string, len, &extents);
+ break;
+ case 4:
+ XftTextExtents32( DISPLAY( displayId ), XFT_FONT( __INST( fontId ) ), (FcChar32*)string, len, &extents);
+ break;
+ }
+ XftDrawRect( XFT_DRAW ( __INST( sharedDrawId ) ), &color, __intVal(drawX) - extents.x, __intVal(drawY) - XFT_FONT( __INST( fontId ) )->ascent, extents.width, XFT_FONT(__INST (fontId ) )->height);
}
if (fgPixel != nil) {
- color.pixel = (unsigned long)__intVal(fgPixel);
+ color.pixel = (unsigned long)__intVal(fgPixel);
}
// else {
- color.color.red = __intVal(fgR);
- color.color.green = __intVal(fgG);
- color.color.blue = __intVal(fgB);
- color.color.alpha = __intVal(fgA);
+ color.color.red = __intVal(fgR);
+ color.color.green = __intVal(fgG);
+ color.color.blue = __intVal(fgB);
+ color.color.alpha = __intVal(fgA);
// }
switch (__bytesPerCharacter) {
case 1:
- XftDrawString8( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
- __intVal(drawX),
- __intVal(drawY),
- (FcChar8*)string,
- len);
- RETURN ( self );
- break;
+ XftDrawString8( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar8*)string,
+ len);
+ RETURN ( self );
+ break;
case 2:
- XftDrawString16( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
- __intVal(drawX),
- __intVal(drawY),
- (FcChar16*)string,
- len);
- RETURN ( self );
- break;
+ XftDrawString16( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar16*)string,
+ len);
+ RETURN ( self );
+ break;
case 4:
- XftDrawString32( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
- __intVal(drawX),
- __intVal(drawY),
- (FcChar32*)string,
- len);
- RETURN ( self );
- break;
+ XftDrawString32( XFT_DRAW ( __INST( sharedDrawId ) ), &color, XFT_FONT( __INST( fontId ) ),
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar32*)string,
+ len);
+ RETURN ( self );
+ break;
}
err:;
#endif
@@ -1129,7 +1129,7 @@
%{
#ifdef XFT
int _start, _stop;
- int _x, _y;
+ int __x, __y;
XftColor clr;
if ( ! __isExternalAddressLike(drawIdArg) ) {
error = @symbol(BadArg1);
@@ -1143,12 +1143,12 @@
error = @symbol(BadArg4);
goto err;
}
- _x = __intVal(x);
+ __x = __intVal(x);
if ( ! __isSmallInteger(y) ) {
error = @symbol(BadArg5);
goto err;
}
- _y = __intVal(y);
+ __y = __intVal(y);
if ( ! __isSmallInteger(start) ) {
@@ -1170,7 +1170,7 @@
if ( __isStringLike(text) ) {
XftDrawString8(XFT_DRAW(drawIdArg), &clr, XFT_FONT(fontIdArg),
- _x, _y,
+ __x, __y,
__stringVal(text) + (_start - 1), _stop - _start + 1);
RETURN ( self );
} else {
@@ -1637,7 +1637,7 @@
ascent
"return the ascent - the number of pixels above the baseLine."
ascent isNil ifTrue:[
- ascent := self xftFontGetAscent: fontId
+ ascent := self xftFontGetAscent: fontId
].
^ ascent
@@ -1648,7 +1648,7 @@
"return the descent - the number of pixels below the baseLine."
descent isNil ifTrue:[
- descent := self xftFontGetDescent: fontId
+ descent := self xftFontGetDescent: fontId
].
^ descent
@@ -1682,7 +1682,7 @@
"return the height - the number of pixels above plus below the baseLine."
height isNil ifTrue:[
- height := self xftFontGetHeight: fontId
+ height := self xftFontGetHeight: fontId
].
^ height
@@ -2098,11 +2098,11 @@
!XftFontDescription class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.65 2014-12-21 21:37:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.66 2014-12-21 22:49:22 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.65 2014-12-21 21:37:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XftFontDescription.st,v 1.66 2014-12-21 22:49:22 cg Exp $'
! !