preps for pixelSize fonts expecco_1_6_0rc5
authorClaus Gittinger <cg@exept.de>
Tue, 17 Feb 2009 17:45:30 +0100
changeset 2602 87adcdcddc17
parent 2601 5c7a21301ffe
child 2603 875d9c41c67d
preps for pixelSize fonts
WinPrinterContext.st
--- a/WinPrinterContext.st	Mon Feb 16 14:22:20 2009 +0100
+++ b/WinPrinterContext.st	Tue Feb 17 17:45:30 2009 +0100
@@ -4177,8 +4177,22 @@
      ^ self createFontFor:'fixed'
 !
 
+getFontWithFamily:familyString face:faceString style:styleString size:sizeArgOrNil encoding:encodingSym
+    "try to get the specified font, return id.
+     If not available, try next smaller font.
+     If no font fits, return nil"
+
+    ^ self 
+        getFontWithFamily:familyString 
+        face:faceString 
+        style:styleString 
+        size:sizeArgOrNil 
+        pixelSize:nil 
+        encoding:encodingSym
+!
+
 getFontWithFamily:familyString face:faceString
-	    style:styleArgString size:sizeArg encoding:encodingSym
+            style:styleArgString size:sizeArgOrNil pixelSize:pixelSizeArgOrNil encoding:encodingSym
 
     "try to get the specified font, if not available, try the next smaller
      font."
@@ -4189,94 +4203,94 @@
 
     "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
+        sizeArgOrNil notNil ifTrue:[
+            theName := familyString , '-' , sizeArgOrNil 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
     ].
 
     id := self
-	    getFontWithFoundry:'*'
-	    family:familyString asLowercase
-	    weight:faceString
-	    slant:styleString "/ xlatedStyle
-	    spacing:spacing
-	    pixelSize:nil
-	    size:sizeArg
-	    registry:'*'
-	    encoding:encodingSym.
+            getFontWithFoundry:'*'
+            family:familyString asLowercase
+            weight:faceString
+            slant:styleString "/ xlatedStyle
+            spacing:spacing
+            pixelSize:nil
+            size:sizeArgOrNil
+            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 "/ xlatedStyle
-		    spacing:spacing
-		    pixelSize:nil
-		    size:sizeArg
-		    registry:'*'
-		    encoding:encodingSym asUppercase.
-	    id isNil ifTrue:[
-		id := self
-			getFontWithFoundry:'*'
-			family:familyString asLowercase
-			weight:faceString
-			slant:styleString "/ xlatedStyle
-			spacing:spacing
-			pixelSize:nil
-			size:sizeArg
-			registry:'*'
-			encoding:encodingSym asLowercase.
-
-		id isNil ifTrue:[
-		    id := self
-			    getFontWithFoundry:'*'
-			    family:familyString asLowercase
-			    weight:faceString asLowercase
-			    slant:styleString asLowercase
-			    spacing:spacing
-			    pixelSize:nil
-			    size:sizeArg
-			    registry:'*'
-			    encoding:encodingSym asLowercase.
-		]
-	    ]
-	]
+        (encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[
+            "/ too stupid: encodings come in both cases
+            "/
+            id := self
+                    getFontWithFoundry:'*'
+                    family:familyString asLowercase
+                    weight:faceString
+                    slant:styleString "/ xlatedStyle
+                    spacing:spacing
+                    pixelSize:nil
+                    size:sizeArgOrNil
+                    registry:'*'
+                    encoding:encodingSym asUppercase.
+            id isNil ifTrue:[
+                id := self
+                        getFontWithFoundry:'*'
+                        family:familyString asLowercase
+                        weight:faceString
+                        slant:styleString "/ xlatedStyle
+                        spacing:spacing
+                        pixelSize:nil
+                        size:sizeArgOrNil
+                        registry:'*'
+                        encoding:encodingSym asLowercase.
+
+                id isNil ifTrue:[
+                    id := self
+                            getFontWithFoundry:'*'
+                            family:familyString asLowercase
+                            weight:faceString asLowercase
+                            slant:styleString asLowercase
+                            spacing:spacing
+                            pixelSize:nil
+                            size:sizeArgOrNil
+                            registry:'*'
+                            encoding:encodingSym asLowercase.
+                ]
+            ]
+        ]
     ].
     ^ id
 
@@ -6020,5 +6034,5 @@
 !WinPrinterContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WinPrinterContext.st,v 1.34 2008-05-28 11:25:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WinPrinterContext.st,v 1.35 2009-02-17 16:45:30 cg Exp $'
 ! !