'From Squeak3.7beta of ''1 April 2004'' [latest update: #5948] on 12 June 2004 at 10:06:38 pm'! "Change Set: FontOfPointSizeFix-nk Date: 12 June 2004 Author: Ned Konz This changes fontOfPointSize: to work like fontOfSize: and find the best match, rather than returning nil. "! !TextStyle methodsFor: 'fonts and font indexes' stamp: 'nk 6/12/2004 16:31'! fontIndexOfPointSize: desiredPointSize "Returns an index in fontArray of the font with pointSize <= desiredPointSize" "Leading is not inluded in the comparison" | bestMatch bestIndex d | bestMatch _ 9999. bestIndex _ 1. 1 to: fontArray size do: [:i | d _ desiredPointSize - (fontArray at: i) pointSize. d = 0 ifTrue: [^ i]. (d > 0 and: [d < bestMatch]) ifTrue: [bestIndex _ i. bestMatch _ d]]. ^ bestIndex! ! !TextStyle methodsFor: 'fonts and font indexes' stamp: 'nk 6/12/2004 16:33'! fontOfPointSize: aPointSize ^ fontArray at: (self fontIndexOfPointSize: aPointSize)! !