XftFontDescription.st
changeset 8615 6cb5118a50a1
parent 8493 c73b458e5475
child 8643 b070565a2047
--- a/XftFontDescription.st	Thu Jan 17 13:09:34 2019 +0100
+++ b/XftFontDescription.st	Tue Jan 22 11:51:17 2019 +0100
@@ -579,19 +579,18 @@
     "to suppress the disturbing warning messages from fontconfig,
      if LC_CTYPE is wrong (osx problem only?)"
 
-    |lc_CTYPE fixedType|
+    |lc_CTYPE|
 
-    fixedType := (Smalltalk language
-                ,'_',Smalltalk languageTerritory asUppercase
-                ,'.UTF-8').
-                
     lc_CTYPE := OperatingSystem getEnvironment:'LC_CTYPE'.
-    lc_CTYPE = 'UTF-8' ifTrue:[
-        ^ fixedType.
+    (lc_CTYPE isNil or:[lc_CTYPE = 'UTF-8']) ifTrue:[
+        ^ Smalltalk language
+          ,'_',Smalltalk languageTerritory asUppercase
+          ,'.UTF-8'.
     ].
-    ^ lc_CTYPE ? fixedType
+    ^ lc_CTYPE
 
     "Modified: / 09-10-2018 / 19:37:08 / Claus Gittinger"
+    "Modified: / 22-01-2019 / 11:39:03 / Stefan Vogel"
 ! !
 
 !XftFontDescription methodsFor:'accessing'!
@@ -816,13 +815,16 @@
         FirstTimeCalled := false.
     ].
 
+    OperatingSystem setEnvironment:'LC_CTYPE' to:(self class fixedLC_CTYPE).
+
     [
         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]).
+            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:[
@@ -830,14 +832,16 @@
         ].
 
         displayId := aGraphicsDevice displayId.
-        
-        OperatingSystem setEnvironment:'LC_CTYPE' to:(self class fixedLC_CTYPE).
+        displayId isNil ifTrue:[
+            self error:'nil 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:[
+                    "not assigned to a device..."
                     deviceFont := self.
                 ] ifFalse:[
                     deviceFont := self copy.
@@ -855,12 +859,13 @@
     ^ aBlock value
 
     "
-     (XftFontDescription family:'monospace' size:16) onDevice:Screen current
+     (XftFontDescription family:'monospace' size:16) onDevice:Screen current ifAbsent:[self halt].
     "
 
     "Modified: / 14-04-1997 / 18:22:31 / cg"
     "Modified: / 02-01-2014 / 23:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 18-06-2018 / 15:54:36 / Claus Gittinger"
+    "Modified (format): / 22-01-2019 / 11:49:50 / Stefan Vogel"
 ! !
 
 !XftFontDescription methodsFor:'initialization'!