Font.st
changeset 1087 1e5a93e03d7f
parent 1067 4a7925d24a07
child 1166 a3bd26b25dc3
equal deleted inserted replaced
1086:269243c32f69 1087:1e5a93e03d7f
    16 	classVariableNames:'Lobby Replacements'
    16 	classVariableNames:'Lobby Replacements'
    17 	poolDictionaries:''
    17 	poolDictionaries:''
    18 	category:'Graphics-Support'
    18 	category:'Graphics-Support'
    19 !
    19 !
    20 
    20 
    21 !Font  class methodsFor:'documentation'!
    21 !Font class methodsFor:'documentation'!
    22 
    22 
    23 copyright
    23 copyright
    24 "
    24 "
    25  COPYRIGHT (c) 1992 by Claus Gittinger
    25  COPYRIGHT (c) 1992 by Claus Gittinger
    26 	      All Rights Reserved
    26 	      All Rights Reserved
   187         aFont ascent
   187         aFont ascent
   188         ...
   188         ...
   189 "
   189 "
   190 ! !
   190 ! !
   191 
   191 
   192 !Font  class methodsFor:'initialization'!
   192 !Font class methodsFor:'initialization'!
   193 
   193 
   194 flushDeviceFontsFor:aDevice
   194 flushDeviceFontsFor:aDevice
   195     "unassign all fonts from their device if they are assigned
   195     "unassign all fonts from their device if they are assigned
   196      to aDevice"
   196      to aDevice"
   197 
   197 
   246 
   246 
   247     "Modified: 20.4.1996 / 23:22:23 / cg"
   247     "Modified: 20.4.1996 / 23:22:23 / cg"
   248     "Created: 15.6.1996 / 15:21:30 / cg"
   248     "Created: 15.6.1996 / 15:21:30 / cg"
   249 ! !
   249 ! !
   250 
   250 
   251 !Font  class methodsFor:'instance creation'!
   251 !Font class methodsFor:'instance creation'!
   252 
   252 
   253 family:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym
   253 family:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym
   254     "returns a font for given family, face, style, size and encoding. 
   254     "returns a font for given family, face, style, size and encoding. 
   255      The returned font is not associated to a specific device"
   255      The returned font is not associated to a specific device"
   256 
   256 
  1041         ^ replacementFont widthOf:textOrString
  1041         ^ replacementFont widthOf:textOrString
  1042     ].
  1042     ].
  1043 
  1043 
  1044     (textOrString isString) ifTrue:[
  1044     (textOrString isString) ifTrue:[
  1045         isFixedWidth ifFalse:[
  1045         isFixedWidth ifFalse:[
  1046             ^ device widthOf:textOrString inFont:fontId
  1046             ^ device widthOf:textOrString string inFont:fontId
  1047         ].
  1047         ].
  1048         ^ width * textOrString size
  1048         ^ width * textOrString size
  1049     ].
  1049     ].
  1050     (textOrString isCharacter) ifTrue:[
  1050     (textOrString isCharacter) ifTrue:[
  1051         isFixedWidth ifFalse:[
  1051         isFixedWidth ifFalse:[
  1069         this := lineString size.
  1069         this := lineString size.
  1070         (this > max) ifTrue:[max := this]
  1070         (this > max) ifTrue:[max := this]
  1071     ].
  1071     ].
  1072     ^ max * width
  1072     ^ max * width
  1073 
  1073 
  1074     "Modified: 22.2.1996 / 21:53:52 / cg"
  1074     "Modified: 22.10.1996 / 17:11:14 / cg"
  1075 !
  1075 !
  1076 
  1076 
  1077 widthOf:aString from:start to:stop
  1077 widthOf:aString from:start to:stop
  1078     "return the width of a substring.
  1078     "return the width of a substring.
  1079      The receiver must be associated to a device,
  1079      The receiver must be associated to a device,
  1107      for st-80 compatibility"
  1107      for st-80 compatibility"
  1108 
  1108 
  1109     ^ self height
  1109     ^ self height
  1110 ! !
  1110 ! !
  1111 
  1111 
  1112 !Font  class methodsFor:'documentation'!
  1112 !Font class methodsFor:'documentation'!
  1113 
  1113 
  1114 version
  1114 version
  1115     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.52 1996-10-04 13:43:44 cg Exp $'
  1115     ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.53 1996-10-22 17:55:59 cg Exp $'
  1116 ! !
  1116 ! !
  1117 Font initialize!
  1117 Font initialize!