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 ]. |