--- a/XftFontDescription.st Thu Mar 17 10:01:49 2016 +0100
+++ b/XftFontDescription.st Thu Mar 17 10:17:55 2016 +0100
@@ -77,16 +77,16 @@
extern OBJ __GLOBAL_GET_BY_NAME(char *);
# define __HANDLE_VAL(type, externalAddress) \
- ((type)__externalAddressVal(externalAddress))
+ ((type)__externalAddressVal(externalAddress))
# define __HANDLE_NEW(ptr, __cls) \
- ({ \
- OBJ handle = __MKEXTERNALADDRESS(ptr); \
- OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
- __InstPtr(handle)->o_class = clsObj; \
- __STORE(handle, clsObj); \
- handle; \
- })
+ ({ \
+ OBJ handle = __MKEXTERNALADDRESS(ptr); \
+ OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
+ __InstPtr(handle)->o_class = clsObj; \
+ __STORE(handle, clsObj); \
+ handle; \
+ })
@@ -163,7 +163,7 @@
"Invoked at system start or when the class is dynamically loaded."
Lobby isNil ifTrue:[
- Lobby := Registry new.
+ Lobby := Registry new.
].
" Taken from fontconfig,h "
@@ -273,28 +273,28 @@
FC_LCD_LEGACY := 3.
StXFace2FCWeightMap := Dictionary withKeysAndValues:{
- #thin. FC_WEIGHT_THIN.
- #extralight. FC_WEIGHT_EXTRALIGHT.
- #ultralight. FC_WEIGHT_ULTRALIGHT.
- #light. FC_WEIGHT_LIGHT.
- #book. FC_WEIGHT_BOOK.
- #regular. FC_WEIGHT_REGULAR.
- #normal. FC_WEIGHT_NORMAL.
- #medium. FC_WEIGHT_MEDIUM.
- #demibold. FC_WEIGHT_DEMIBOLD.
- #semibold. FC_WEIGHT_SEMIBOLD.
- #bold. FC_WEIGHT_BOLD.
- #extrabold. FC_WEIGHT_EXTRABOLD.
- #ultrabold. FC_WEIGHT_ULTRABOLD.
- #black. FC_WEIGHT_BLACK.
- #heavy. FC_WEIGHT_HEAVY.
- #extrablack. FC_WEIGHT_EXTRABLACK.
- #ultrablack. FC_WEIGHT_ULTRABLACK.
+ #thin. FC_WEIGHT_THIN.
+ #extralight. FC_WEIGHT_EXTRALIGHT.
+ #ultralight. FC_WEIGHT_ULTRALIGHT.
+ #light. FC_WEIGHT_LIGHT.
+ #book. FC_WEIGHT_BOOK.
+ #regular. FC_WEIGHT_REGULAR.
+ #normal. FC_WEIGHT_NORMAL.
+ #medium. FC_WEIGHT_MEDIUM.
+ #demibold. FC_WEIGHT_DEMIBOLD.
+ #semibold. FC_WEIGHT_SEMIBOLD.
+ #bold. FC_WEIGHT_BOLD.
+ #extrabold. FC_WEIGHT_EXTRABOLD.
+ #ultrabold. FC_WEIGHT_ULTRABOLD.
+ #black. FC_WEIGHT_BLACK.
+ #heavy. FC_WEIGHT_HEAVY.
+ #extrablack. FC_WEIGHT_EXTRABLACK.
+ #ultrablack. FC_WEIGHT_ULTRABLACK.
}.
StXStyle2FCSlantMap := Dictionary withKeysAndValues:{
- #roman. FC_SLANT_ROMAN.
- #italic. FC_SLANT_ITALIC.
- #oblique. FC_SLANT_OBLIQUE.
+ #roman. FC_SLANT_ROMAN.
+ #italic. FC_SLANT_ITALIC.
+ #oblique. FC_SLANT_OBLIQUE.
}.
"Modified: / 30-12-2013 / 19:48:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -523,24 +523,24 @@
aNumber == FC_WEIGHT_EXTRABLACK ifTrue:[ face := #extrablack. ^ self].
aNumber <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT // 2) ifTrue:[
- face := #extralight.
- ^ self.
+ face := #extralight.
+ ^ self.
].
aNumber <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK // 2) ifTrue:[
- face := #light.
- ^ self.
+ face := #light.
+ ^ self.
].
aNumber <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD // 2) ifTrue:[
- face := #medium.
- ^ self.
+ face := #medium.
+ ^ self.
].
aNumber <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD // 2) ifTrue:[
- face := #demibold.
- ^ self.
+ face := #demibold.
+ ^ self.
].
aNumber <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK // 2) ifTrue:[
- face := #bold.
- ^ self.
+ face := #bold.
+ ^ self.
].
face := #extrabold.
^ self
@@ -585,11 +585,11 @@
|drawableId|
anAspect == #aboutToDestroy ifTrue:[
- drawableId := changedObject drawableId.
- (sharedDrawId notNil and:[drawableId notNil]) ifTrue:[
- sharedDrawId disassociateFrom:drawableId.
- ].
- changedObject removeDependent:self.
+ drawableId := changedObject drawableId.
+ (sharedDrawId notNil and:[drawableId notNil]) ifTrue:[
+ sharedDrawId disassociateFrom:drawableId.
+ ].
+ changedObject removeDependent:self.
].
! !
@@ -623,29 +623,29 @@
"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.
clipRect := aGC deviceClippingRectangle.
clipRect notNil ifTrue:[
- clipX := clipRect left.
- clipY := clipRect top.
- clipW := clipRect width.
- clipH := clipRect height.
+ clipX := clipRect left.
+ clipY := clipRect top.
+ clipW := clipRect width.
+ clipH := clipRect height.
].
transformation := aGC transformation.
transformation isNil ifTrue:[
- drawX := xArg.
- drawY := yArg.
+ drawX := xArg.
+ drawY := yArg.
] ifFalse:[
- drawPnt := transformation transformPoint:(xArg @ yArg).
- drawX := drawPnt x ceiling.
- drawY := drawPnt y ceiling.
+ drawPnt := transformation transformPoint:(xArg @ yArg).
+ drawX := drawPnt x ceiling.
+ drawY := drawPnt y ceiling.
].
fg := aGC paint.
@@ -655,45 +655,45 @@
fgA := fg scaledAlpha.
fgR isNil ifTrue:[
- "/ when drawing into a pixmap...
- fgPixel := fg colorId.
- fgPixel == 0 ifTrue:[
- fgR := fgG := fgB := 0.
- ] ifFalse:[
- fgR := fgG := fgB := 16rFFFF.
- ]
+ "/ when drawing into a pixmap...
+ fgPixel := fg colorId.
+ fgPixel == 0 ifTrue:[
+ fgR := fgG := fgB := 0.
+ ] ifFalse:[
+ fgR := fgG := fgB := 16rFFFF.
+ ]
].
opaque ifTrue:[
- bg := aGC backgroundPaint.
- bg isColor ifTrue:[
- bgR := bg scaledRed.
- bgG := bg scaledGreen.
- bgB := bg scaledBlue.
- bgA := bg scaledAlpha.
- ] ifFalse:[
- "images are not yet implemented"
- "/ #todo: fill background rectangle
- bgR := bgG := bgB := bgA := 16rFFFF.
- ].
- bgR isNil ifTrue:[
- "/ when drawing into a pixmap...
- bgPixel := bg colorId.
- bgPixel == 0 ifTrue:[
- bgR := bgG := bgB := 0.
- ] ifFalse:[
- bgR := bgG := bgB := 16rFFFF.
- ]
- ].
+ bg := aGC backgroundPaint.
+ bg isColor ifTrue:[
+ bgR := bg scaledRed.
+ bgG := bg scaledGreen.
+ bgB := bg scaledBlue.
+ bgA := bg scaledAlpha.
+ ] ifFalse:[
+ "images are not yet implemented"
+ "/ #todo: fill background rectangle
+ bgR := bgG := bgB := bgA := 16rFFFF.
+ ].
+ bgR isNil ifTrue:[
+ "/ when drawing into a pixmap...
+ bgPixel := bg colorId.
+ bgPixel == 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.
aGC isForm ifTrue:[
- pixmapDepth := aGC depth.
+ pixmapDepth := aGC depth.
].
%{ /* STACK: 64000 */
@@ -708,76 +708,76 @@
XftFont *__xftFont = XFT_FONT(__INST(fontId));
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)
)) {
- error = @symbol(badArgument);
- goto out;
+ error = @symbol(badArgument);
+ goto out;
}
__bytesPerCharacter = __intVal(bytesPerCharacter);
if (pixmapDepth != nil) {
- int __pixmapDepth = __intVal(pixmapDepth);
+ int __pixmapDepth = __intVal(pixmapDepth);
- if (__pixmapDepth == 1) {
- __sharedDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(drawableId));
- } else {
- __sharedDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(drawableId), __pixmapDepth);
- }
+ if (__pixmapDepth == 1) {
+ __sharedDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(drawableId));
+ } else {
+ __sharedDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(drawableId), __pixmapDepth);
+ }
} else {
- if (__INST(sharedDrawId) == nil) {
- __sharedDrawId = XftDrawCreate(DISPLAY(displayId),
- DRAWABLE(drawableId),
- DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
- DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
- __INST(sharedDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__sharedDrawId);
- __STORE(self, __INST(sharedDrawId));
- } else if (XftDrawDrawable(__sharedDrawId = XFT_DRAW(__INST(sharedDrawId))) != DRAWABLE(drawableId)) {
- XftDrawChange(__sharedDrawId, DRAWABLE(drawableId));
- }
+ if (__INST(sharedDrawId) == nil) {
+ __sharedDrawId = XftDrawCreate(DISPLAY(displayId),
+ DRAWABLE(drawableId),
+ DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
+ DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
+ __INST(sharedDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__sharedDrawId);
+ __STORE(self, __INST(sharedDrawId));
+ } else if (XftDrawDrawable(__sharedDrawId = XFT_DRAW(__INST(sharedDrawId))) != DRAWABLE(drawableId)) {
+ XftDrawChange(__sharedDrawId, DRAWABLE(drawableId));
+ }
}
string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter);
len = __intVal(index2) - __intVal(index1) + 1;
if (clipRect != nil) {
- clipRX.x = __intVal(clipX);
- clipRX.y = __intVal(clipY);
- clipRX.width = __intVal(clipW);
- clipRX.height = __intVal(clipH);
- XftDrawSetClipRectangles(__sharedDrawId, 0, 0, &clipRX, 1);
+ clipRX.x = __intVal(clipX);
+ clipRX.y = __intVal(clipY);
+ clipRX.width = __intVal(clipW);
+ clipRX.height = __intVal(clipH);
+ XftDrawSetClipRectangles(__sharedDrawId, 0, 0, &clipRX, 1);
} else {
- XftDrawSetClip(__sharedDrawId, 0);
+ XftDrawSetClip(__sharedDrawId, 0);
}
if (opaque == true) {
- if (bgPixel != nil) {
- color.pixel = (unsigned long)__intVal(bgPixel);
- }
- color.color.red = __intVal(bgR);
- color.color.green = __intVal(bgG);
- color.color.blue = __intVal(bgB);
- color.color.alpha = __intVal(bgA);
+ if (bgPixel != nil) {
+ color.pixel = (unsigned long)__intVal(bgPixel);
+ }
+ 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), __xftFont, (FcChar8*)string, len, &extents);
- break;
- case 2:
- XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
- break;
- case 4:
- XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
- break;
- }
- XftDrawRect(__sharedDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
+ switch (__bytesPerCharacter) {
+ case 1:
+ XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
+ break;
+ case 2:
+ XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
+ break;
+ case 4:
+ XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
+ break;
+ }
+ XftDrawRect(__sharedDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
}
if (fgPixel != nil) {
- color.pixel = (unsigned long)__intVal(fgPixel);
+ color.pixel = (unsigned long)__intVal(fgPixel);
}
color.color.red = __intVal(fgR);
color.color.green = __intVal(fgG);
@@ -786,36 +786,36 @@
switch (__bytesPerCharacter) {
case 1:
- XftDrawString8(__sharedDrawId, &color,__xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar8*)string,
- len);
- break;
+ XftDrawString8(__sharedDrawId, &color,__xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar8*)string,
+ len);
+ break;
case 2:
- XftDrawString16(__sharedDrawId, &color, __xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar16*)string,
- len);
- break;
+ XftDrawString16(__sharedDrawId, &color, __xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar16*)string,
+ len);
+ break;
case 4:
- XftDrawString32(__sharedDrawId, &color, __xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar32*)string,
- len);
- break;
+ XftDrawString32(__sharedDrawId, &color, __xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar32*)string,
+ len);
+ break;
default:
- error = @symbol(invalidStringSize);
- goto out;
+ error = @symbol(invalidStringSize);
+ goto out;
}
if (pixmapDepth != nil) {
- XftDrawDestroy(__sharedDrawId);
+ XftDrawDestroy(__sharedDrawId);
}
# if 0 // this has been superseeded by receiving change messages on view destroy
@@ -827,10 +827,10 @@
#endif
%}.
error notNil ifTrue:[
- self primitiveFailed: error.
+ self primitiveFailed: error.
].
newXftDrawId notNil ifTrue:[
- Lobby register:self.
+ Lobby register:self.
].
"Created: / 21-12-2013 / 21:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 10-01-2014 / 11:13:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -864,8 +864,8 @@
finalize
sharedDrawId notNil ifTrue:[
- sharedDrawId destroy.
- sharedDrawId := nil.
+ sharedDrawId destroy.
+ sharedDrawId := nil.
].
! !
@@ -885,79 +885,79 @@
|displayId myPatternHandle closestPatternHandle newFontId computedWeight|
(device == aGraphicsDevice) ifTrue:[
- "I am already assigned to that device ..."
- ^ self
+ "I am already assigned to that device ..."
+ ^ self
].
aGraphicsDevice isNil ifTrue:[
- ^ self
+ ^ self
].
aGraphicsDevice supportsXftFonts ifFalse:[
- ^ super onDevice:aGraphicsDevice ifAbsent:aBlock.
+ ^ self asNonXftFont onDevice:aGraphicsDevice.
].
RecentlyUsedFonts isNil ifTrue:[
- RecentlyUsedFonts := OrderedCollection new:20.
+ RecentlyUsedFonts := OrderedCollection new:20.
].
RecentlyUsedFonts keysAndValuesDo:[:index :aFont |
- ((aFont class == self class) and:[(self sameDeviceFontAs:aFont) and:[aFont getFontId notNil]]) ifTrue:[
- "/ Transcript showCR:'hit'.
- RecentlyUsedFonts
- removeIndex:index;
- addFirst:aFont.
- ^ aFont
- ]
+ ((aFont class == self class) and:[(self sameDeviceFontAs:aFont) and:[aFont getFontId notNil]]) ifTrue:[
+ "/ Transcript showCR:'hit'.
+ RecentlyUsedFonts
+ removeIndex:index;
+ addFirst:aFont.
+ ^ aFont
+ ]
].
RecentlyUsedFonts size >= 20 ifTrue:[
- RecentlyUsedFonts removeLast.
+ RecentlyUsedFonts removeLast.
].
aGraphicsDevice deviceFonts do:[:aFont |
- ((aFont class == self class) and:[self sameDeviceFontAs:aFont]) ifTrue:[
- RecentlyUsedFonts addFirst:aFont.
- ^ aFont
- ].
+ ((aFont class == self class) and:[self sameDeviceFontAs:aFont]) ifTrue:[
+ RecentlyUsedFonts addFirst:aFont.
+ ^ aFont
+ ].
].
"/ ^ self asNonXftFont onDevice:aGraphicsDevice.
computedWeight := weight.
computedWeight isNil ifTrue:[
- computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR].
+ computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR].
].
[
- myPatternHandle := FCPatternHandle create.
- myPatternHandle
- add:FC_FOUNDRY value:manufacturer;
- add:FC_FAMILY value:family;
- add:FC_WEIGHT value:computedWeight;
- add:FC_SLANT value:(StXStyle2FCSlantMap at:(style ? '') asLowercase ifAbsent:[FC_SLANT_ROMAN]).
- sizeUnit = #px ifTrue:[
- myPatternHandle add:FC_PIXEL_SIZE value:(pixelSize isNil ifTrue:[nil] ifFalse:[pixelSize rounded]).
- ] ifFalse:[
- myPatternHandle add:FC_SIZE value:(size isNil ifTrue:[nil] ifFalse:[size rounded]).
- ].
+ myPatternHandle := FCPatternHandle create.
+ myPatternHandle
+ add:FC_FOUNDRY value:manufacturer;
+ add:FC_FAMILY value:family;
+ add:FC_WEIGHT value:computedWeight;
+ add:FC_SLANT value:(StXStyle2FCSlantMap at:(style ? '') asLowercase ifAbsent:[FC_SLANT_ROMAN]).
+ sizeUnit = #px ifTrue:[
+ myPatternHandle add:FC_PIXEL_SIZE value:(pixelSize isNil ifTrue:[nil] ifFalse:[pixelSize rounded]).
+ ] ifFalse:[
+ myPatternHandle add:FC_SIZE value:(size isNil ifTrue:[nil] ifFalse:[size rounded]).
+ ].
- displayId := aGraphicsDevice displayId.
+ displayId := aGraphicsDevice displayId.
- closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen.
- closestPatternHandle notNil ifTrue:[
- newFontId := closestPatternHandle getFontOnDisplayId:displayId.
- newFontId notNil ifTrue:[
- "/ Good, this font exists!!
- closestPatternHandle := nil.
- fontId := newFontId.
- device := aGraphicsDevice.
- aGraphicsDevice registerFont:self.
- RecentlyUsedFonts addFirst:self.
- ^ self.
- ].
- ].
+ closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen.
+ closestPatternHandle notNil ifTrue:[
+ newFontId := closestPatternHandle getFontOnDisplayId:displayId.
+ newFontId notNil ifTrue:[
+ "/ Good, this font exists!!
+ closestPatternHandle := nil.
+ fontId := newFontId.
+ device := aGraphicsDevice.
+ aGraphicsDevice registerFont:self.
+ RecentlyUsedFonts addFirst:self.
+ ^ self.
+ ].
+ ].
] ensure:[
- myPatternHandle notNil ifTrue:[myPatternHandle destroy].
- closestPatternHandle notNil ifTrue:[closestPatternHandle destroy].
+ myPatternHandle notNil ifTrue:[myPatternHandle destroy].
+ closestPatternHandle notNil ifTrue:[closestPatternHandle destroy].
].
^ aBlock value
@@ -1017,12 +1017,12 @@
#ifdef XFT
int v;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if ( ! __isExternalAddressLike(displayId) ) {
- error = @symbol(BadArg2);
- goto err;
+ error = @symbol(BadArg2);
+ goto err;
}
XftFontClose (DISPLAY(displayId), XFT_FONT(fontIdArg));
RETURN(self);
@@ -1039,8 +1039,8 @@
#ifdef XFT
int v;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
v = XFT_FONT(fontIdArg)->ascent;
RETURN ( __MKINT( v ) );
@@ -1059,8 +1059,8 @@
#ifdef XFT
int v;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
v = XFT_FONT(fontIdArg)->descent;
RETURN ( __MKINT( v ) );
@@ -1079,8 +1079,8 @@
#ifdef XFT
int v;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
v = XFT_FONT(fontIdArg)->height;
RETURN ( __MKINT( v ) );
@@ -1099,8 +1099,8 @@
#ifdef XFT
int v;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
v = XFT_FONT(fontIdArg)->max_advance_width;
RETURN ( __MKINT( v ) );
@@ -1119,14 +1119,14 @@
#ifdef XFT
XftPattern* p;
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
p = XFT_FONT(fontIdArg)->pattern;
if (p == NULL) {
- RETURN ( nil );
+ RETURN ( nil );
} else {
- RETURN ( FC_PATTERN_HANDLE_NEW ( p ) );
+ RETURN ( FC_PATTERN_HANDLE_NEW ( p ) );
}
err:;
#endif
@@ -1150,20 +1150,20 @@
int bytesPerCharacter = __intVal(bitsPerCharacter) / 8;
if ( ! __isExternalAddressLike(displayIdArg) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if ( ! __isExternalAddressLike(fontIdArg) ) {
- error = @symbol(BadArg2);
- goto err;
+ error = @symbol(BadArg2);
+ goto err;
}
if ( ! __isSmallInteger(start) ) {
- error = @symbol(BadArg4);
- goto err;
+ error = @symbol(BadArg4);
+ goto err;
}
if ( ! __isSmallInteger(stop) ) {
- error = @symbol(BadArg5);
- goto err;
+ error = @symbol(BadArg5);
+ goto err;
}
string = __stringVal( text ) + (( __intVal(start) - 1 ) * bytesPerCharacter);
@@ -1171,14 +1171,14 @@
switch (bytesPerCharacter) {
case 1:
- XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info);
- break;
+ XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info);
+ break;
case 2:
- XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info);
- break;
+ XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info);
+ break;
case 4:
- XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info);
- break;
+ XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info);
+ break;
}
__ArrayInstPtr(extents)->a_element[0] = __MKSMALLINT(info.width);
__ArrayInstPtr(extents)->a_element[1] = __MKSMALLINT(info.height);
@@ -1191,8 +1191,8 @@
#endif
%}.
error notNil ifTrue:[
- self primitiveFailed: error.
- ^ nil.
+ self primitiveFailed: error.
+ ^ nil.
].
^ extents
@@ -1357,7 +1357,7 @@
and X11 errors will be signaled."
sharedDrawId notNil ifTrue:[
- sharedDrawId disassociateFrom:drawableId.
+ sharedDrawId disassociateFrom:drawableId.
].
!
@@ -1367,7 +1367,7 @@
view isNil ifTrue:[ ^ self ].
drawableId := view id.
drawableId isNil ifTrue: [ ^ self ].
-%{
+%{ /* STACK: 64000 */
#ifdef XFT
if ( __INST(sharedDrawId) != nil ) {
XftDraw *xftDrawable = XFT_DRAW(__INST(sharedDrawId));
@@ -1446,48 +1446,48 @@
list := OrderedCollection new.
readEntry := [
- |key line|
+ |key line|
- [
- line := pipeStream nextLine.
- ] doUntil:[(line startsWith:'Pattern has') or:[Transcript showCR:line. false]].
+ [
+ line := pipeStream nextLine.
+ ] doUntil:[(line startsWith:'Pattern has') or:[Transcript showCR:line. false]].
- currentDescription := XftFontDescription new.
- [line := pipeStream nextLine. line notEmptyOrNil] whileTrue:[
- "/ Transcript showCR:l.
- lineStream := line readStream. lineStream skipSeparators.
- key := ('fc_', (lineStream upTo:$:)) asSymbolIfInterned.
- (
- #(fc_family fc_style fc_slant fc_weight fc_width
- fc_pixelsize fc_spacing fc_foundry fc_antialias
- fc_file fc_outline fc_scalable fc_charset fc_lang
- fc_fontversion fc_fontformat fc_decorative fc_index
- fc_outline fc_familylang fc_stylelang fc_fullname
- fc_fullnamelang fc_capability fc_hash fc_postscriptname
- ) includesIdentical:key
- ) ifTrue:[
- self perform:key.
- ] ifFalse:[
- Transcript show:'Xft ignored line: '; showCR:line.
- ].
- ].
- list add:currentDescription
- ].
+ currentDescription := XftFontDescription new.
+ [line := pipeStream nextLine. line notEmptyOrNil] whileTrue:[
+ "/ Transcript showCR:l.
+ lineStream := line readStream. lineStream skipSeparators.
+ key := ('fc_', (lineStream upTo:$:)) asSymbolIfInterned.
+ (
+ #(fc_family fc_style fc_slant fc_weight fc_width
+ fc_pixelsize fc_spacing fc_foundry fc_antialias
+ fc_file fc_outline fc_scalable fc_charset fc_lang
+ fc_fontversion fc_fontformat fc_decorative fc_index
+ fc_outline fc_familylang fc_stylelang fc_fullname
+ fc_fullnamelang fc_capability fc_hash fc_postscriptname
+ ) includesIdentical:key
+ ) ifTrue:[
+ self perform:key.
+ ] ifFalse:[
+ Transcript show:'Xft ignored line: '; showCR:line.
+ ].
+ ].
+ list add:currentDescription
+ ].
fcListProg := #('/usr/bin/fc-list' '/usr/X11/bin/fc-list') detect:[:eachProg|
- eachProg asFilename isExecutableProgram
- ] ifNone:[
- 'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR.
- ^ list.
- ].
+ eachProg asFilename isExecutableProgram
+ ] ifNone:[
+ 'XftFontDescription [warning]: fc-list program not found - no XFT fonts' errorPrintCR.
+ ^ list.
+ ].
pipeStream := PipeStream readingFrom:fcListProg, ' -v'.
[
- [pipeStream atEnd] whileFalse:[
- readEntry value.
- ]
+ [pipeStream atEnd] whileFalse:[
+ readEntry value.
+ ]
] ensure:[
- pipeStream close
+ pipeStream close
].
^ list
@@ -1516,30 +1516,30 @@
|page bits l min max minCode maxCode|
[ l := pipeStream nextLine. l notEmpty ] whileTrue:[
- "/ Transcript show:'->'; showCR:l.
- (l startsWith:Character tab) ifFalse:[
- (l startsWith:'(') ifFalse:[self halt].
- currentDescription minCode:minCode; maxCode:maxCode.
- ^ self.
- ].
+ "/ Transcript show:'->'; showCR:l.
+ (l startsWith:Character tab) ifFalse:[
+ (l startsWith:'(') ifFalse:[self halt].
+ currentDescription minCode:minCode; maxCode:maxCode.
+ ^ self.
+ ].
- lineStream := l readStream.
- lineStream skipSeparators.
- page := Integer readFrom:(lineStream upTo:$:) radix:16.
- lineStream next.
- bits := 0 to:7 collect:[:i|
- lineStream skipSeparators.
- Integer readFrom:(lineStream upToSeparator) radix:16.
- ].
- min := (page * 256 + 0).
- max := (page * 256 + 255).
- minCode isNil ifTrue:[
- minCode := min.
- maxCode := max.
- ] ifFalse:[
- minCode := minCode min:min.
- maxCode := maxCode max:max.
- ].
+ lineStream := l readStream.
+ lineStream skipSeparators.
+ page := Integer readFrom:(lineStream upTo:$:) radix:16.
+ lineStream next.
+ bits := 0 to:7 collect:[:i|
+ lineStream skipSeparators.
+ Integer readFrom:(lineStream upToSeparator) radix:16.
+ ].
+ min := (page * 256 + 0).
+ max := (page * 256 + 255).
+ minCode isNil ifTrue:[
+ minCode := min.
+ maxCode := max.
+ ] ifFalse:[
+ minCode := minCode min:min.
+ maxCode := maxCode max:max.
+ ].
].
"/ currentDescription characterSet:(self getString).
currentDescription minCode:minCode; maxCode:maxCode.
@@ -1587,8 +1587,8 @@
|foundry|
foundry := self getString.
- foundry ~= 'unknown' ifTrue:[
- currentDescription foundry:foundry.
+ foundry ~= 'unknown' ifTrue:[
+ currentDescription foundry:foundry.
].
!
@@ -1668,12 +1668,12 @@
xftStyle := self getString asLowercase.
(xftStyle includesString:'italic') ifTrue:[
- currentDescription style:#italic.
- ^ self.
+ currentDescription style:#italic.
+ ^ self.
].
(xftStyle includesString:'oblique') ifTrue:[
- currentDescription style:#oblique.
- ^ self.
+ currentDescription style:#oblique.
+ ^ self.
].
currentDescription style:#roman.
!
@@ -1751,7 +1751,7 @@
| error |
-%{
+%{ /* STACK: 64000 */
#ifdef XFT
XftValue v;
Bool b;
@@ -1812,15 +1812,15 @@
delete: pattern attribute: attribute
| error |
-%{
+%{ /* STACK: 64000 */
#ifdef XFT
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
if ( ! __isStringLike ( attribute ) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
XftPatternDel( (XftPattern*)__INST(address_), __stringVal ( attribute ) );
RETURN ( self );
@@ -1832,7 +1832,7 @@
!
destroy
-%{
+%{ /* STACK: 64000 */
#ifdef XFT
if (__INST(address_) != 0) {
XftPatternDestroy((XftPattern*)__INST(address_));
@@ -1846,7 +1846,6 @@
duplicate
| error |
-
%{
#ifdef XFT
if (__INST(address_) != 0) {
@@ -1864,7 +1863,7 @@
| error |
-%{
+%{ /* STACK: 64000 */
#ifdef XFT
XftValue v;
XftResult r;
@@ -1914,19 +1913,19 @@
#ifdef XFT
XftFont* f;
if (!__isExternalAddressLike(displayId) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
f = XftFontOpenPattern(DISPLAY(displayId), (XftPattern*)__INST(address_));
if (f == NULL) {
- RETURN (nil);
+ RETURN (nil);
} else {
- RETURN (XFT_FONT_HANDLE_NEW(f));
+ RETURN (XFT_FONT_HANDLE_NEW(f));
}
err:;
#endif
@@ -1945,16 +1944,16 @@
XftResult r;
if (!__isExternalAddressLike(displayId)) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if (!__isSmallInteger( screen) ) {
- error = @symbol(BadArg2);
- goto err;
+ error = @symbol(BadArg2);
+ goto err;
}
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
// Already done in match:
@@ -1962,9 +1961,9 @@
// XftDefaultSubstitute(DISPLAY(displayId), SCREEN( screen ), FC_PATTERN( patternId ));
p = XftFontMatch(DISPLAY(displayId), SCREEN(screen), (XftPattern*)__INST(address_), &r);
if (p) {
- RETURN (FC_PATTERN_HANDLE_NEW(p) );
+ RETURN (FC_PATTERN_HANDLE_NEW(p) );
} else {
- error = @symbol(XftFontMatchReturnedNull);
+ error = @symbol(XftFontMatchReturnedNull);
}
err:;
#endif
@@ -1988,21 +1987,21 @@
%{ /* STACK: 64000 */
#ifdef XFT
if ( ! __isExternalAddressLike(displayId) ) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if ( ! __isSmallInteger(screen) ) {
- error = @symbol(BadArg2);
- goto err;
+ error = @symbol(BadArg2);
+ goto err;
}
if ( ! __isExternalAddressLike(drawableId) ) {
- error = @symbol(BadArg3);
- goto err;
+ error = @symbol(BadArg3);
+ goto err;
}
__INST(address_) = (void *) XftDrawCreate ( DISPLAY(displayId) ,
- DRAWABLE(drawableId) ,
- DefaultVisual(DISPLAY(displayId), SCREEN (screen)) ,
- DefaultColormap(DISPLAY(displayId), SCREEN (screen)));
+ DRAWABLE(drawableId) ,
+ DefaultVisual(DISPLAY(displayId), SCREEN (screen)) ,
+ DefaultColormap(DISPLAY(displayId), SCREEN (screen)));
err:;
#endif
%}.
@@ -2015,9 +2014,9 @@
%{ /* STACK: 64000 */
#ifdef XFT
if (__INST(address_) != 0) {
- XftDrawDestroy((XftDraw*)__INST(address_));
- __INST(address_) = 0;
- RETURN ( self );
+ XftDrawDestroy((XftDraw*)__INST(address_));
+ __INST(address_) = 0;
+ RETURN ( self );
}
#endif
%}.
@@ -2035,15 +2034,15 @@
%{ /* STACK: 64000 */
#ifdef XFT
if (__INST(address_) == 0) {
- // nothing to disasassociate from...
- RETURN(self);
+ // nothing to disasassociate from...
+ RETURN(self);
}
if (!__isExternalAddressLike(drawableId)) {
- error = @symbol(BadArg);
- goto err;
+ error = @symbol(BadArg);
+ goto err;
}
if (XftDrawDrawable((XftDraw*)__INST(address_)) == DRAWABLE(drawableId)) {
- XftDrawChange((XftDraw*)__INST(address_), None);
+ XftDrawChange((XftDraw*)__INST(address_), None);
}
RETURN(self);
err:;
@@ -2060,15 +2059,15 @@
%{ /* STACK: 64000 */
#ifdef XFT
if (drawableId == nil) {
- XftDrawChange((XftDraw*)__INST(address_), None);
- RETURN (self);
+ XftDrawChange((XftDraw*)__INST(address_), None);
+ RETURN (self);
}
if (!__isExternalAddressLike(drawableId)) {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
if (XftDrawDrawable((XftDraw*)__INST(address_)) != DRAWABLE( drawableId)) {
- XftDrawChange((XftDraw*)__INST(address_), DRAWABLE( drawableId));
+ XftDrawChange((XftDraw*)__INST(address_), DRAWABLE( drawableId));
}
RETURN (self);
err:;
@@ -2089,12 +2088,12 @@
b := aColor scaledBlue.
a := aColor alpha * 65535.
r isNil ifTrue:[
- "/ when drawing into a pixmap...
- aColor colorId == 0 ifTrue:[
- r := g := b := 0.
- ] ifFalse:[
- r := g := b := 16rFFFF.
- ]
+ "/ when drawing into a pixmap...
+ aColor colorId == 0 ifTrue:[
+ r := g := b := 0.
+ ] ifFalse:[
+ r := g := b := 16rFFFF.
+ ]
].
pix := aColor colorId.
%{ /* STACK: 64000 */
@@ -2102,28 +2101,28 @@
XftColor clr;
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
if (!__isSmallInteger(pix)) {
- error = @symbol(BadColorId);
- goto err;
+ error = @symbol(BadColorId);
+ goto err;
}
if (!__isSmallInteger(x)) {
- error = @symbol(BadArg2);
- goto err;
+ error = @symbol(BadArg2);
+ goto err;
}
if (! __isSmallInteger(y)) {
- error = @symbol(BadArg3);
- goto err;
+ error = @symbol(BadArg3);
+ goto err;
}
if (!__isSmallInteger(w)) {
- error = @symbol(BadArg4);
- goto err;
+ error = @symbol(BadArg4);
+ goto err;
}
if (!__isSmallInteger(h)) {
- error = @symbol(BadArg5);
- goto err;
+ error = @symbol(BadArg5);
+ goto err;
}
clr.pixel = (unsigned long)__intVal(pix);
clr.color.red = __intVal(r);
@@ -2132,7 +2131,7 @@
clr.color.alpha = __intVal(a);
XftDrawRect((XftDraw*)__INST(address_), &clr,
- __intVal(x), __intVal(y), __intVal(w) ,__intVal(h));
+ __intVal(x), __intVal(y), __intVal(w) ,__intVal(h));
RETURN (self);
err:;
@@ -2152,16 +2151,16 @@
pix := aColor colorId.
r := aColor scaledRed.
r isNil ifTrue:[
- "/ when drawing into a pixmap...
- pix == 0 ifTrue:[
- r := g := b := a := 0.
- ] ifFalse:[
- r := g := b := a := 16rFFFF.
- ]
+ "/ when drawing into a pixmap...
+ pix == 0 ifTrue:[
+ r := g := b := a := 0.
+ ] ifFalse:[
+ r := g := b := a := 16rFFFF.
+ ]
] ifFalse:[
- g := aColor scaledGreen.
- b := aColor scaledBlue.
- a := aColor alpha * 65535.
+ g := aColor scaledGreen.
+ b := aColor scaledBlue.
+ a := aColor alpha * 65535.
].
%{ /* STACK: 64000 */
#ifdef XFT
@@ -2170,33 +2169,33 @@
XftColor clr;
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
if ( ! __isSmallInteger(pix) ) {
- error = @symbol(BadColorId);
- goto err;
+ error = @symbol(BadColorId);
+ goto err;
}
if ( ! __isSmallInteger(x) ) {
- error = @symbol(BadArg4);
- goto err;
+ error = @symbol(BadArg4);
+ goto err;
}
__x = __intVal(x);
if ( ! __isSmallInteger(y) ) {
- error = @symbol(BadArg5);
- goto err;
+ error = @symbol(BadArg5);
+ goto err;
}
__y = __intVal(y);
if ( ! __isSmallInteger(start) ) {
- error = @symbol(BadArg6);
- goto err;
+ error = @symbol(BadArg6);
+ goto err;
}
_start = __intVal(start);
if ( ! __isSmallInteger(stop) ) {
- error = @symbol(BadArg7);
- goto err;
+ error = @symbol(BadArg7);
+ goto err;
}
_stop = __intVal(stop);
@@ -2207,13 +2206,13 @@
clr.color.alpha = __intVal(a);
if ( __isStringLike(aString) ) {
- XftDrawString8((XftDraw*)__INST(address_), &clr, XFT_FONT(fontIdArg),
- __x, __y,
- __stringVal(aString) + (_start - 1), _stop - _start + 1);
- RETURN ( self );
+ XftDrawString8((XftDraw*)__INST(address_), &clr, XFT_FONT(fontIdArg),
+ __x, __y,
+ __stringVal(aString) + (_start - 1), _stop - _start + 1);
+ RETURN ( self );
} else {
- error = @symbol(BadArg1);
- goto err;
+ error = @symbol(BadArg1);
+ goto err;
}
err:;
#endif
@@ -2228,27 +2227,27 @@
| error xObj yObj wObj hObj |
rect notNil ifTrue:[
- xObj := rect left.
- yObj := rect top.
- wObj := rect width.
- hObj := rect height.
+ xObj := rect left.
+ yObj := rect top.
+ wObj := rect width.
+ hObj := rect height.
].
%{ /* STACK: 64000 */
#ifdef XFT
if (__INST(address_) == 0) {
- error = @symbol(BadHandle);
- goto err;
+ error = @symbol(BadHandle);
+ goto err;
}
if (rect != nil) {
- XRectangle r;
+ XRectangle r;
- r.x = __intVal(xObj);
- r.y = __intVal(yObj);
- r.width = __intVal(wObj);
- r.height = __intVal(hObj);
- XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, &r, 1);
+ r.x = __intVal(xObj);
+ r.y = __intVal(yObj);
+ r.width = __intVal(wObj);
+ r.height = __intVal(hObj);
+ XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, &r, 1);
} else {
- XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, (XRectangle*)NULL, 0);
+ XftDrawSetClipRectangles((XftDraw*)__INST(address_), 0, 0, (XRectangle*)NULL, 0);
}
RETURN ( self );
err:;