Font.st
changeset 3483 b5f133131653
parent 3479 e647bc300eba
child 3527 cac44b80270e
equal deleted inserted replaced
3482:5c86f1218cfc 3483:b5f133131653
   908      the argument may be a Character, String or some Text;
   908      the argument may be a Character, String or some Text;
   909      in the last case the width of the longest line in the text is returned.
   909      in the last case the width of the longest line in the text is returned.
   910      The receiver must be associated to a device,
   910      The receiver must be associated to a device,
   911      for this query to be legal."
   911      for this query to be legal."
   912 
   912 
   913     |this max|
   913     |this max string|
   914 
   914 
   915     device isNil ifTrue:[
   915     device isNil ifTrue:[
   916         self errorNoDevice.
   916         self errorNoDevice.
   917         ^ 0
   917         ^ 0
   918     ].
   918     ].
   919     replacementFont notNil ifTrue:[
   919     replacementFont notNil ifTrue:[
   920         ^ replacementFont widthOf:textOrString
   920         ^ replacementFont widthOf:textOrString
   921     ].
   921     ].
   922 
   922 
   923     (textOrString isString) ifTrue:[
   923     (textOrString isString) ifTrue:[
       
   924         string := textOrString string.
   924         isFixedWidth ifFalse:[
   925         isFixedWidth ifFalse:[
   925             ^ device widthOf:textOrString string inFont:fontId
   926             ^ device widthOf:string inFont:fontId
   926         ].
   927         ].
   927         ^ width * textOrString size
   928         ^ width * string size
   928     ].
   929     ].
   929     (textOrString isCharacter) ifTrue:[
   930     (textOrString isCharacter) ifTrue:[
   930         isFixedWidth ifFalse:[
   931         isFixedWidth ifFalse:[
   931             ^ device widthOf:textOrString asString inFont:fontId
   932             ^ device widthOf:textOrString asString inFont:fontId
   932         ].
   933         ].
  1084 ! !
  1085 ! !
  1085 
  1086 
  1086 !Font class methodsFor:'documentation'!
  1087 !Font class methodsFor:'documentation'!
  1087 
  1088 
  1088 version
  1089 version
  1089     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.78 2001-09-05 17:28:17 cg Exp $'
  1090     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.79 2001-09-05 18:19:33 cg Exp $'
  1090 ! !
  1091 ! !
  1091 Font initialize!
  1092 Font initialize!