diff -r c807ae478014 -r adffd6f387e7 Font.st --- a/Font.st Wed Feb 18 18:56:26 2009 +0100 +++ b/Font.st Wed Feb 18 18:56:28 2009 +0100 @@ -239,11 +239,11 @@ face:faceString style:styleString size:sizeNum - pixelSize:nil + sizeUnit:#pt encoding:encodingSym ! -family:familyString face:faceString style:styleString size:sizeArgOrNil pixelSize:pixelSizeArgOrNil encoding:encodingSym +family:familyString face:faceString style:styleString size:sizeArgOrNil sizeUnit:sizeUnitArg encoding:encodingSym "returns a font for given family, face, style, size and encoding. The returned font is not associated to a specific device. Either size, or pixelSize must be non-nil (points vs. pixels)" @@ -261,7 +261,7 @@ face:faceString style:styleString size:sizeArgOrNil - pixelSize:pixelSizeArgOrNil + sizeUnit:sizeUnitArg encoding:encodingSym device:nil. @@ -270,7 +270,7 @@ Display notNil ifTrue:[ Display deviceFonts do:[:aFont | (newFont sameDeviceFontAs:aFont) ifTrue:[ -self assert:(aFont encoding = newFont encoding). + self assert:(aFont encoding = newFont encoding). ^ aFont ] ] @@ -359,7 +359,7 @@ aDevice deviceFonts do:[:aFont | (self sameDeviceFontAs:aFont) ifTrue:[ -self assert:aFont encoding = encoding. + self assert:aFont encoding = encoding. ^ aFont ]. ]. @@ -388,8 +388,8 @@ setFamily:family face:face style:style - size:size - pixelSize:pixelSize + size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) + sizeUnit:sizeUnit encoding:encoding device:aDevice. newFont setReplacementFont:rep. @@ -421,8 +421,8 @@ getFontWithFamily:family face:face style:style - size:size - pixelSize:pixelSize + size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) + sizeUnit:sizeUnit encoding:encoding. id isNil ifTrue:[ "oops did not work - (device has no such font)" @@ -457,8 +457,8 @@ getFontWithFamily:family face:face style:style - size:trySize - pixelSize:pixelSize + size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[trySize]) + sizeUnit:sizeUnit encoding:encoding. ] doWhile:[id isNil and:[trySize := trySize - 1. trySize > 4]]. @@ -473,8 +473,8 @@ getFontWithFamily:alternative face:face style:style - size:trySize - pixelSize:pixelSize + size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[trySize]) + sizeUnit:sizeUnit encoding:encoding. ] doWhile:[id isNil and:[trySize := trySize - 1. trySize > 4]]. ]. @@ -501,7 +501,7 @@ f := self class basicNew. - f setFamily:family face:face style:style size:size pixelSize:pixelSize encoding:encoding device:aDevice. + f setFamily:family face:face style:style size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) sizeUnit:sizeUnit encoding:encoding device:aDevice. f setDevice:aDevice fontId:id. f getFontInfos. aDevice registerFont:f. @@ -680,26 +680,27 @@ ! setFamily:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym device:aDevice + + + self + setFamily:familyString + face:faceString + style:styleString + size:sizeNum + sizeUnit:#pt + encoding:encodingSym + device:aDevice +! + +setFamily:familyString face:faceString style:styleString size:sizeArg sizeUnit:sizeUnitArg encoding:encodingSym device:aDevice "set my instance attributes" family := familyString. face := faceString. style := styleString. - size := sizeNum. - encoding := encodingSym. - device := aDevice - - "Modified: 20.4.1996 / 23:26:56 / cg" -! - -setFamily:familyString face:faceString style:styleString size:sizeArgOrNil pixelSize:pixelSizeArgOrNil encoding:encodingSym device:aDevice - "set my instance attributes" - - family := familyString. - face := faceString. - style := styleString. - size := sizeArgOrNil. - pixelSize := pixelSizeArgOrNil. + sizeUnit := sizeUnitArg. + sizeUnit == #pt ifTrue:[ size := sizeArg ]. + sizeUnit == #px ifTrue:[ pixelSize := sizeArg ]. encoding := encodingSym. device := aDevice @@ -1206,7 +1207,7 @@ !Font class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.110 2009-02-17 23:20:29 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.111 2009-02-18 17:56:28 cg Exp $' ! ! Font initialize!