WinWorkstation.st
changeset 5583 4cbf0d98dba1
parent 5581 31a170b78a33
child 5587 909a0413b6a2
--- a/WinWorkstation.st	Tue Jul 27 16:38:20 2010 +0200
+++ b/WinWorkstation.st	Tue Jul 27 16:39:31 2010 +0200
@@ -12685,108 +12685,85 @@
 !
 
 getFontWithFamily:familyString face:faceString
-	    style:styleArgString size:sizeArg sizeUnit:sizeUnitArg
-	    encoding:encodingSym
+            style:styleArgString size:sizeArg sizeUnit:sizeUnitArg
+            encoding:encoding
 
     "try to get the specified font, if not available, try the next smaller
      font."
 
-    |styleString theName theId xlatedStyle id spacing pxSize ptSize|
+    |styleString theName theId xlatedStyle id spacing pxSize ptSize encodingSym|
 
     styleString := styleArgString.
+    encoding isEmptyOrNil ifTrue:[
+        encodingSym := encoding.
+    ] ifFalse:[
+        encodingSym := encoding asLowercase asSymbol.
+    ].
 
     "special: if face is nil, allow access to X-fonts"
     faceString isNil ifTrue:[
-	sizeArg notNil ifTrue:[
-	    theName := familyString , '-' , sizeArg printString
-	] ifFalse:[
-	    theName := familyString
-	].
-	theName isNil ifTrue:[
-	    "
-	     mhmh - fall back to the default font
-	    "
-	    theName := 'fixed'
-	].
-	theId := self createFontFor:theName.
-	theId isNil ifTrue:[
-	    theId := self getDefaultFont
-	].
-	^ theId
+        sizeArg notNil ifTrue:[
+            theName := familyString , '-' , sizeArg printString
+        ] ifFalse:[
+            theName := familyString
+        ].
+        theName isNil ifTrue:[
+            "
+             mhmh - fall back to the default font
+            "
+            theName := 'fixed'
+        ].
+        theId := self createFontFor:theName.
+        theId isNil ifTrue:[
+            theId := self getDefaultFont
+        ].
+        ^ theId
     ].
 
     "/ spacing other than 'normal' is contained as last component
     "/ in style
     styleString notNil ifTrue:[
-	((styleString endsWith:'-narrow')
-	 or:[styleString endsWith:'-semicondensed']) ifTrue:[
-	    |i|
-	    i := styleString lastIndexOf:$-.
-	    spacing := styleString copyFrom:(i+1).
-	    styleString := styleString copyTo:(i-1).
-	] ifFalse:[
-	    spacing := 'normal'.
-	].
+        ((styleString endsWith:'-narrow')
+         or:[styleString endsWith:'-semicondensed']) ifTrue:[
+            |i|
+            i := styleString lastIndexOf:$-.
+            spacing := styleString copyFrom:(i+1).
+            styleString := styleString copyTo:(i-1).
+        ] ifFalse:[
+            spacing := #normal.
+        ].
     ].
 
     xlatedStyle := styleString.
     xlatedStyle notNil ifTrue:[
-	xlatedStyle := xlatedStyle first asString
+        xlatedStyle := xlatedStyle first asString
     ].
 
     pxSize := sizeUnitArg == #px ifTrue:[sizeArg] ifFalse:[nil].
     ptSize := sizeUnitArg == #pt ifTrue:[sizeArg] ifFalse:[nil].
 
     id := self
-	    getFontWithFoundry:'*'
-	    family:familyString asLowercase
-	    weight:faceString
-	    slant:styleString "/ xlatedStyle
-	    spacing:spacing
-	    pixelSize:pxSize
-	    size:ptSize
-	    registry:'*'
-	    encoding:encodingSym.
+            getFontWithFoundry:#*
+            family:familyString asLowercase
+            weight:faceString
+            slant:styleString "/ xlatedStyle
+            spacing:spacing
+            pixelSize:pxSize
+            size:ptSize
+            registry:#*
+            encoding:encodingSym.
 
     id isNil ifTrue:[
-	(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[
-	    "/ too stupid: encodings come in both cases
-	    id := self
-		    getFontWithFoundry:'*'
-		    family:familyString asLowercase
-		    weight:faceString
-		    slant:styleString
-		    spacing:spacing
-		    pixelSize:pxSize
-		    size:ptSize
-		    registry:'*'
-		    encoding:encodingSym asUppercase.
-	    id isNil ifTrue:[
-		id := self
-			getFontWithFoundry:'*'
-			family:familyString asLowercase
-			weight:faceString
-			slant:styleString
-			spacing:spacing
-			pixelSize:pxSize
-			size:ptSize
-			registry:'*'
-			encoding:encodingSym asLowercase.
-
-		id isNil ifTrue:[
-		    id := self
-			    getFontWithFoundry:'*'
-			    family:familyString asLowercase
-			    weight:faceString asLowercase
-			    slant:styleString asLowercase
-			    spacing:spacing
-			    pixelSize:pxSize
-			    size:ptSize
-			    registry:'*'
-			    encoding:encodingSym asLowercase.
-		]
-	    ]
-	]
+        id := self
+                getFontWithFoundry:#*
+                family:familyString asLowercase
+                weight:faceString asLowercase
+                slant:styleString asLowercase
+                spacing:spacing
+                pixelSize:pxSize
+                size:ptSize
+                registry:#*
+                encoding:encodingSym.
     ].
     ^ id
 
@@ -12892,7 +12869,8 @@
     fdwCharSet   = ANSI_CHARSET;
     if ((encoding == @symbol('ms-ansi'))) {
         fdwCharSet   = ANSI_CHARSET;
-    } else if (encoding == @symbol('ms-default')) {
+    } else if (encoding == @symbol('ms-default')
+               || encoding == @symbol(*)) {
         fdwCharSet   = DEFAULT_CHARSET;
     } else if ((encoding == @symbol('ms-symbol'))
             || (encoding == @symbol('misc-fontspecific'))) {
@@ -13054,7 +13032,7 @@
                       pixelSize:nil
                            size:13
                        registry:'iso8859'
-                       encoding:'*'
+                       encoding:#*
     "
 
     "new NT Version: 20.2.1997 / 22:33:29 / dq"
@@ -18840,11 +18818,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.428 2010-07-26 16:39:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.429 2010-07-27 14:39:31 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.428 2010-07-26 16:39:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.429 2010-07-27 14:39:31 stefan Exp $'
 ! !
 
 WinWorkstation initialize!