*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 26 Apr 2017 18:46:36 +0200
changeset 8018 2bd8a65110aa
parent 8017 59757832e8b0
child 8019 d8ac1f5028bd
*** empty log message ***
XftFontDescription.st
--- a/XftFontDescription.st	Wed Apr 26 18:18:41 2017 +0200
+++ b/XftFontDescription.st	Wed Apr 26 18:46:36 2017 +0200
@@ -1,7 +1,7 @@
 "
  COPYRIGHT (c) 2013 by Jan Vrany
  COPYRIGHT (c) 2013 by Claus Gittinger / eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -131,7 +131,7 @@
 "
  COPYRIGHT (c) 2013 by Jan Vrany
  COPYRIGHT (c) 2013 by Claus Gittinger / eXept Software AG
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -191,52 +191,52 @@
 
     " Taken from fontconfig,h "
 
-    FC_FAMILY               := 'family'.           "/* String */
-    FC_STYLE                := 'style'.            "/* String */
-    FC_SLANT                := 'slant'.            "/* Int */
-    FC_WEIGHT               := 'weight'.           "/* Int */
-    FC_SIZE                 := 'size'.             "/* Double */
-    FC_ASPECT               := 'aspect'.           "/* Double */
-    FC_PIXEL_SIZE           := 'pixelsize'.        "/* Double */
-    FC_SPACING              := 'spacing'.          "/* Int */
-    FC_FOUNDRY              := 'foundry'.          "/* String */
-    FC_ANTIALIAS            := 'antialias'.        "/* Bool (depends) */
-    FC_HINTING              := 'hinting'.          "/* Bool (true) */
-    FC_HINT_STYLE           := 'hintstyle'.        "/* Int */
-    FC_VERTICAL_LAYOUT      := 'verticallayout'.       "/* Bool (false) */
-    FC_AUTOHINT             := 'autohint'.         "/* Bool (false) */
-    FC_WIDTH                := 'width'.            "/* Int */
-    FC_FILE                 := 'file'.             "/* String */
-    FC_INDEX                := 'index'.            "/* Int */
-    FC_FT_FACE              := 'ftface'.           "/* FT_Face */
-    FC_RASTERIZER           := 'rasterizer'.       "/* String */
-    FC_OUTLINE              := 'outline'.          "/* Bool */
-    FC_SCALABLE             := 'scalable'.         "/* Bool */
-    FC_SCALE                := 'scale'.            "/* double */
-    FC_DPI                  := 'dpi'.              "/* double */
-    FC_RGBA                 := 'rgba'.             "/* Int */
-    FC_MINSPACE             := 'minspace'.         "/* Bool use minimum line spacing */
-    FC_SOURCE               := 'source'.           "/* String (deprecated) */
-    FC_CHARSET              := 'charset'.          "/* CharSet */
-    FC_LANG                 := 'lang'.             "/* String RFC 3066 langs */
-    FC_FONTVERSION          := 'fontversion'.      "/* Int from 'head'.table */
-    FC_FULLNAME             := 'fullname'.         "/* String */
-    FC_FAMILYLANG           := 'familylang'.       "/* String RFC 3066 langs */
-    FC_STYLELANG            := 'stylelang'.        "/* String RFC 3066 langs */
-    FC_FULLNAMELANG         := 'fullnamelang'.     "/* String RFC 3066 langs */
-    FC_CAPABILITY           := 'capability'.   "/* String */
-    FC_FONTFORMAT           := 'fontformat'.       "/* String */
-    FC_EMBOLDEN             := 'embolden'.         "/* Bool - true if emboldening needed*/
-    FC_EMBEDDED_BITMAP      := 'embeddedbitmap'."/* Bool - true to enable embedded bitmaps */
-    FC_DECORATIVE           := 'decorative'.       "/* Bool - true if style is a decorative variant */
-    FC_LCD_FILTER           := 'lcdfilter'.        "/* Int */
-    FC_NAMELANG             := 'namelang'.         "/* String RFC 3866 langs */
+    FC_FAMILY               := 'family'.            "/* String */
+    FC_STYLE                := 'style'.             "/* String */
+    FC_SLANT                := 'slant'.             "/* Int */
+    FC_WEIGHT               := 'weight'.            "/* Int */
+    FC_SIZE                 := 'size'.              "/* Double */
+    FC_ASPECT               := 'aspect'.            "/* Double */
+    FC_PIXEL_SIZE           := 'pixelsize'.         "/* Double */
+    FC_SPACING              := 'spacing'.           "/* Int */
+    FC_FOUNDRY              := 'foundry'.           "/* String */
+    FC_ANTIALIAS            := 'antialias'.         "/* Bool (depends) */
+    FC_HINTING              := 'hinting'.           "/* Bool (true) */
+    FC_HINT_STYLE           := 'hintstyle'.         "/* Int */
+    FC_VERTICAL_LAYOUT      := 'verticallayout'.    "/* Bool (false) */
+    FC_AUTOHINT             := 'autohint'.          "/* Bool (false) */
+    FC_WIDTH                := 'width'.             "/* Int */
+    FC_FILE                 := 'file'.              "/* String */
+    FC_INDEX                := 'index'.             "/* Int */
+    FC_FT_FACE              := 'ftface'.            "/* FT_Face */
+    FC_RASTERIZER           := 'rasterizer'.        "/* String */
+    FC_OUTLINE              := 'outline'.           "/* Bool */
+    FC_SCALABLE             := 'scalable'.          "/* Bool */
+    FC_SCALE                := 'scale'.             "/* double */
+    FC_DPI                  := 'dpi'.               "/* double */
+    FC_RGBA                 := 'rgba'.              "/* Int */
+    FC_MINSPACE             := 'minspace'.          "/* Bool use minimum line spacing */
+    FC_SOURCE               := 'source'.            "/* String (deprecated) */
+    FC_CHARSET              := 'charset'.           "/* CharSet */
+    FC_LANG                 := 'lang'.              "/* String RFC 3066 langs */
+    FC_FONTVERSION          := 'fontversion'.       "/* Int from 'head'.table */
+    FC_FULLNAME             := 'fullname'.          "/* String */
+    FC_FAMILYLANG           := 'familylang'.        "/* String RFC 3066 langs */
+    FC_STYLELANG            := 'stylelang'.         "/* String RFC 3066 langs */
+    FC_FULLNAMELANG         := 'fullnamelang'.      "/* String RFC 3066 langs */
+    FC_CAPABILITY           := 'capability'.        "/* String */
+    FC_FONTFORMAT           := 'fontformat'.        "/* String */
+    FC_EMBOLDEN             := 'embolden'.          "/* Bool - true if emboldening needed*/
+    FC_EMBEDDED_BITMAP      := 'embeddedbitmap'.    "/* Bool - true to enable embedded bitmaps */
+    FC_DECORATIVE           := 'decorative'.        "/* Bool - true if style is a decorative variant */
+    FC_LCD_FILTER           := 'lcdfilter'.         "/* Int */
+    FC_NAMELANG             := 'namelang'.          "/* String RFC 3866 langs */
 
 
     "Adjust outline rasterizer"
-    FC_CHAR_WIDTH           := 'charwidth'."/* Int */
-    FC_CHAR_HEIGHT          := 'charheight'."/* Int */
-    FC_MATRIX               := 'matrix'.   "/* FcMatrix */
+    FC_CHAR_WIDTH           := 'charwidth'.     "/* Int */
+    FC_CHAR_HEIGHT          := 'charheight'.    "/* Int */
+    FC_MATRIX               := 'matrix'.        "/* FcMatrix */
 
     FC_WEIGHT_THIN          := 0.
     FC_WEIGHT_EXTRALIGHT    := 40.
@@ -295,30 +295,33 @@
     FC_LCD_LIGHT            := 2.
     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.
-    }.
-    StXStyle2FCSlantMap := Dictionary withKeysAndValues:{
-        #roman.    FC_SLANT_ROMAN.
-        #italic.   FC_SLANT_ITALIC.
-        #oblique.  FC_SLANT_OBLIQUE.
-    }.
+    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.
+	}.
+
+    StXStyle2FCSlantMap :=
+	Dictionary withKeysAndValues:{
+	    #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>"
 ! !
@@ -441,12 +444,12 @@
 %{ /* STACK: 64000 */
 #ifdef XFT
     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);
@@ -462,8 +465,8 @@
 %{ /* STACK: 64000 */
 #ifdef XFT
     if ( ! __isExternalAddressLike(fontIdArg) ) {
-        error = @symbol(BadArg1);
-        goto err;
+	error = @symbol(BadArg1);
+	goto err;
     }
     RETURN ( __MKINT( XFT_FONT(fontIdArg)->ascent ) );
     err:;
@@ -480,8 +483,8 @@
 %{ /* STACK: 64000 */
 #ifdef XFT
     if ( ! __isExternalAddressLike(fontIdArg) ) {
-        error = @symbol(BadArg1);
-        goto err;
+	error = @symbol(BadArg1);
+	goto err;
     }
     RETURN ( __MKINT( XFT_FONT(fontIdArg)->descent ) );
     err:;
@@ -498,8 +501,8 @@
 %{ /* STACK: 64000 */
 #ifdef XFT
     if ( ! __isExternalAddressLike(fontIdArg) ) {
-        error = @symbol(BadArg1);
-        goto err;
+	error = @symbol(BadArg1);
+	goto err;
     }
     RETURN ( __MKINT( XFT_FONT(fontIdArg)->height ) );
     err:;
@@ -516,8 +519,8 @@
 %{ /* STACK: 64000 */
 #ifdef XFT
     if ( ! __isExternalAddressLike(fontIdArg) ) {
-        error = @symbol(BadArg1);
-        goto err;
+	error = @symbol(BadArg1);
+	goto err;
     }
     RETURN ( __MKINT( XFT_FONT(fontIdArg)->max_advance_width ) );
     err:;
@@ -558,7 +561,7 @@
     "uses fc-list to get a list of available fontDescriptions"
 
     CachedFontList isNil ifTrue:[
-        CachedFontList := FCFontListParser new listOfAvailableFonts
+	CachedFontList := FCFontListParser new listOfAvailableFonts
     ].
     ^ CachedFontList
 
@@ -685,16 +688,16 @@
 
 asNonXftFont
     "in some situations, we do not want an Xft font..."
-    
+
     |newFont|
 
     newFont := Font
-                    family:family
-                    face:face
-                    style:style
-                    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])
-                    sizeUnit:sizeUnit
-                    encoding:encoding.
+		    family:family
+		    face:face
+		    style:style
+		    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])
+		    sizeUnit:sizeUnit
+		    encoding:encoding.
     newFont isForceNonXFTFont:true.
     ^ newFont
 
@@ -744,8 +747,8 @@
     "install the font for aGCId"
 
     (device isNil or:[fontId isNil]) ifTrue:[
-        Logger error:'no device font for: %1' with:self.
-        ^ nil.
+	Logger error:'no device font for: %1' with:self.
+	^ nil.
     ].
     "nothing to install"
 !
@@ -764,65 +767,65 @@
     |displayId myPatternHandle closestPatternHandle newFontId computedWeight deviceFont|
 
     (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:[
-        ^ self asNonXftFont onDevice:aGraphicsDevice.
+	^ self asNonXftFont onDevice:aGraphicsDevice.
     ].
 
     deviceFont := aGraphicsDevice deviceFonts detect:[:eachFont | self sameDeviceFontAs:eachFont] ifNone:[].
     deviceFont notNil ifTrue:[
-        ^ deviceFont.
+	^ deviceFont.
     ].
 
     computedWeight := weight.
     computedWeight isNil ifTrue:[
-        computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR].
+	computedWeight := StXFace2FCWeightMap at:(face ? '') asLowercase ifAbsent:[FC_WEIGHT_REGULAR].
     ].
 
     (OperatingSystem isMAClike and:[FirstTimeCalled ~~ false]) ifTrue:[
-        "Slow font matching is a MAC-only feature"
-        Logger info:'XFT: matching font (this may take a long time, if the system''s font cache needs to be filled first. Be patient...'.
-        FirstTimeCalled := false.
+	"Slow font matching is a MAC-only feature"
+	Logger info:'XFT: matching font (this may take a long time, if the system''s font cache needs to be filled first. Be patient...'.
+	FirstTimeCalled := false.
     ].
 
     [
-        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.
-        closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen.
-        closestPatternHandle notNil ifTrue:[
-            newFontId := closestPatternHandle getFontOnDisplayId:displayId.
-            newFontId notNil ifTrue:[
-                "/ Good, this font exists!!
-                device isNil ifTrue:[
-                    deviceFont := self.
-                ] ifFalse:[
-                    deviceFont := self copy.
-                ].
-                closestPatternHandle := nil.
-                deviceFont setDevice:aGraphicsDevice patternId:nil fontId:newFontId.
-                aGraphicsDevice registerFont:deviceFont.
-                ^ deviceFont.
-            ].
-        ].
+	displayId := aGraphicsDevice displayId.
+	closestPatternHandle := myPatternHandle matchFontOnDisplayId:displayId screen:aGraphicsDevice screen.
+	closestPatternHandle notNil ifTrue:[
+	    newFontId := closestPatternHandle getFontOnDisplayId:displayId.
+	    newFontId notNil ifTrue:[
+		"/ Good, this font exists!!
+		device isNil ifTrue:[
+		    deviceFont := self.
+		] ifFalse:[
+		    deviceFont := self copy.
+		].
+		closestPatternHandle := nil.
+		deviceFont setDevice:aGraphicsDevice patternId:nil fontId:newFontId.
+		aGraphicsDevice registerFont:deviceFont.
+		^ deviceFont.
+	    ].
+	].
     ] ensure:[
-        myPatternHandle notNil ifTrue:[myPatternHandle destroy].
-        closestPatternHandle notNil ifTrue:[closestPatternHandle destroy].
+	myPatternHandle notNil ifTrue:[myPatternHandle destroy].
+	closestPatternHandle notNil ifTrue:[closestPatternHandle destroy].
     ].
     ^ aBlock value
 
@@ -854,13 +857,13 @@
     patternIdArg notNil ifTrue:[
 	family  := patternIdArg get: FC_FAMILY index: 0.
 	size    := patternIdArg get: FC_SIZE index: 0.
-	face    := patternIdArg get: FC_WEIGHT index: 0.
-	face    := StXFace2FCWeightMap keyAtValue: face.
-	style   := patternIdArg get: FC_SLANT index: 0.
-	style   := StXStyle2FCSlantMap keyAtValue: style.
+	weight  := patternIdArg get: FC_WEIGHT index: 0.
+	face    := StXFace2FCWeightMap keyAtValue: weight.
+	slant   := patternIdArg get: FC_SLANT index: 0.
+	style   := StXStyle2FCSlantMap keyAtValue: slant.
 
-"/        name:= patternIdArg get: 'fullname' index: 0.
-"/        encoding:= patternIdArg get: 'encoding' index: 0.
+	"/ name := patternIdArg get: 'fullname' index: 0.
+	"/ encoding:= patternIdArg get: 'encoding' index: 0.
     ].
     size isNil ifTrue:[
 	size := 0.
@@ -879,7 +882,7 @@
     "get the extents of aString.
      Answer thr width of aString (in reality the xOff).
      If extentArrayOrNil is an Array, fill is with the extent info:
-        #(width height x y xOff yOff)."
+	#(width height x y xOff yOff ascent descent)."
 
     |error bytesPerCharacter|
 
@@ -891,57 +894,80 @@
     char *string;
     int len;
     int __bytesPerCharacter = __intVal(bytesPerCharacter);
+    OBJ fontIdArg = __INST(fontId);
 
     if ( ! __isExternalAddressLike(displayIdArg) ) {
-        error = @symbol(BadArg1);
-        goto err;
+	error = @symbol(BadArg1);
+	goto err;
     }
     if ( ! __isSmallInteger(start) ) {
-        error = @symbol(BadArg3);
-        goto err;
+	error = @symbol(BadArg3);
+	goto err;
     }
     if ( ! __isSmallInteger(stop) ) {
-        error = @symbol(BadArg4);
-        goto err;
+	error = @symbol(BadArg4);
+	goto err;
     }
-    if ( ! __isExternalAddressLike(__INST(fontId)) ) {
-        error = @symbol(BadFontId);
-        goto err;
+    if ( ! __isExternalAddressLike(fontIdArg) ) {
+	error = @symbol(BadFontId);
+	goto err;
     }
 
     string = __stringVal(aString) + ((__intVal(start) - 1) * __bytesPerCharacter);
     len = __intVal(stop) - __intVal(start) + 1;
 
     switch (__bytesPerCharacter) {
-    case 1:
-        XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(__INST(fontId)), (FcChar8*)string, len, &info);
-        break;
-    case 2:
-        XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(__INST(fontId)), (FcChar16*)string, len, &info);
-        break;
-    case 4:
-        XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(__INST(fontId)), (FcChar32*)string, len, &info);
-        break;
-    default:
-        error = @symbol(BadArg2);
-        goto err;
+	case 1:
+	    XftTextExtents8(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar8*)string, len, &info);
+	    break;
+	case 2:
+	    XftTextExtents16(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar16*)string, len, &info);
+	    break;
+	case 4:
+	    XftTextExtents32(DISPLAY(displayIdArg), XFT_FONT(fontIdArg), (FcChar32*)string, len, &info);
+	    break;
+	default:
+	    error = @symbol(BadArg2);
+	    goto err;
     }
 
     if (extentsArrayOrNil != nil && __isArray(extentsArrayOrNil)) {
-        switch (__arraySize(extentsArrayOrNil)) {
-        case 6:
-            __arrayVal(extentsArrayOrNil)[5] = __MKSMALLINT(info.yOff);
-        case 5:
-            __arrayVal(extentsArrayOrNil)[4] = __MKSMALLINT(info.xOff);
-        case 4:
-            __arrayVal(extentsArrayOrNil)[3] = __MKSMALLINT(info.y);
-        case 3:
-            __arrayVal(extentsArrayOrNil)[2] = __MKSMALLINT(info.x);
-        case 2:
-            __arrayVal(extentsArrayOrNil)[1] = __MKSMALLINT(info.height);
-        case 1:
-            __arrayVal(extentsArrayOrNil)[0] = __MKSMALLINT(info.width);
-        }
+	switch (__arraySize(extentsArrayOrNil)) {
+	    case 8:
+		__arrayVal(extentsArrayOrNil)[7] = __MKSMALLINT(XFT_FONT(fontIdArg)->descent);
+		// fall into
+	    case 7:
+		__arrayVal(extentsArrayOrNil)[6] = __MKSMALLINT(XFT_FONT(fontIdArg)->ascent);
+		// fall into
+	    case 6:
+		__arrayVal(extentsArrayOrNil)[5] = __MKSMALLINT(info.yOff);
+		// fall into
+	    case 5:
+		__arrayVal(extentsArrayOrNil)[4] = __MKSMALLINT(info.xOff);
+		// fall into
+	    case 4:
+		__arrayVal(extentsArrayOrNil)[3] = __MKSMALLINT(info.y);
+		// fall into
+	    case 3:
+		__arrayVal(extentsArrayOrNil)[2] = __MKSMALLINT(info.x);
+		// fall into
+	    case 2:
+		{
+		    int height;
+
+		    height = info.height;
+#if 0
+		    height = XFT_FONT(fontIdArg)->descent + XFT_FONT(fontIdArg)->ascent;
+#endif
+		    __arrayVal(extentsArrayOrNil)[1] = __MKSMALLINT(height);
+		}
+		// fall into
+	    case 1:
+		__arrayVal(extentsArrayOrNil)[0] = __MKSMALLINT(info.width);
+		// fall into
+	    case 0:
+		break;
+	}
     }
 
     RETURN(__MKSMALLINT(info.xOff));
@@ -950,8 +976,8 @@
 #endif
 %}.
     error notNil ifTrue:[
-        self primitiveFailed: error.
-        ^ nil.
+	self primitiveFailed: error.
+	^ nil.
     ].
 
     "Created: / 21-12-2013 / 10:42:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -981,7 +1007,7 @@
 ascent
     "return the ascent - the number of pixels above the baseLine."
     ascent isNil ifTrue:[
-        ascent := self class xftFontGetAscent: fontId
+	ascent := self class xftFontGetAscent: fontId
     ].
     ^ ascent
 
@@ -992,7 +1018,7 @@
     "return the descent - the number of pixels below the baseLine."
 
     descent isNil ifTrue:[
-         descent := self class xftFontGetDescent: fontId
+	 descent := self class xftFontGetDescent: fontId
     ].
     ^ descent
 
@@ -1026,7 +1052,11 @@
     "return the height - the number of pixels above plus below the baseLine."
 
     height isNil ifTrue:[
-        height := self class xftFontGetHeight: fontId
+	false ifTrue:[
+	    height := self ascent + self descent.
+	] ifFalse:[
+	    height := self class xftFontGetHeight: fontId
+	].
     ].
     ^ height
 
@@ -1039,14 +1069,14 @@
      Also called monospaced fonts"
 
     fixedWidth isNil ifTrue:[
-        fontId isNil ifTrue:[
-            ^ false     "we don't know yet"
-        ].
-        "/ take some obviously different chars
-        width := self widthOf:' '.
-        fixedWidth := (self widthOf:'i') == width
-                            and:[(self widthOf:'W') == width
-                            and:[(self widthOf:'.') == width]]
+	fontId isNil ifTrue:[
+	    ^ false     "we don't know yet"
+	].
+	"/ take some obviously different chars
+	width := self widthOf:' '.
+	fixedWidth := (self widthOf:'i') == width
+			    and:[(self widthOf:'W') == width
+			    and:[(self widthOf:'.') == width]]
     ].
     ^ fixedWidth.
 
@@ -1076,7 +1106,7 @@
      That is a number of units (usually pixels)."
 
     self isFixedWidth ifTrue:[
-        ^ width
+	^ width
     ].
     ^ self class xftFontGetMaxAdvanceWidth: fontId
 
@@ -1114,7 +1144,7 @@
      The receiver must be associated to a device, for this query to be legal."
 
     width isNil ifTrue:[
-        width := self widthOf:' '.
+	width := self widthOf:' '.
     ].
     ^ width
 !
@@ -1124,10 +1154,10 @@
 
     (stop < start) ifTrue:[^ 0].
     fixedWidth == true ifTrue:[
-        ^ width * (stop - start + 1)
+	^ width * (stop - start + 1)
     ].
     device isNil ifTrue:[
-        self errorNoDevice.
+	self errorNoDevice.
     ].
     ^ self xftTextExtents:device displayId string:aString from:start to:stop into:nil.
 
@@ -1141,10 +1171,10 @@
     "I am no longer available on the device"
 
     (device notNil and:[fontId notNil]) ifTrue:[
-        self class xftFontClose:fontId displayId:device displayId.
-        device := nil.
-        fontId := nil.
-        width := nil.
+	self class xftFontClose:fontId displayId:device displayId.
+	device := nil.
+	fontId := nil.
+	width := nil.
     ].
 ! !
 
@@ -1162,7 +1192,7 @@
 isXftFont
     "anwer true, if this is an Xft font.
      Sure, I am"
-     
+
     ^ true
 
     "Modified (comment): / 12-02-2017 / 22:04:23 / cg"
@@ -1204,49 +1234,49 @@
     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
-                      fc_symbol fc_color
-                    ) 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
+		      fc_symbol fc_color
+		    ) 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