'From Cuis 5.0 of 7 November 2016 [latest update: #3740] on 9 May 2019 at 2:12:16 pm'!

!ImagePallet class methodsFor: 'examples' stamp: 'KenD 5/9/2019 14:08:10'!
strikeFonts
"
	ImagePallet strikeFonts.
	
	More StrikeFonts can be imported via 
		Feature require:  #'SF2-Import'.
	See Cuis-Smalltalk-SF2-Import file README.md for usage.
"
	| ip sw fontsCollection maxExtent |
	fontsCollection := OrderedCollection new. 
	AbstractFont availableFonts do: [ :aFontFamily |
		aFontFamily baseFontBySizes keysAndValuesDo: [ :aSize :aFont |
			(aSize <= 24) ifTrue: [
				fontsCollection add: 
					(Association 
						key: aFont name
						value: (FontMorph font: aFont))
			]
		]
	].

	maxExtent := 0@0.
	fontsCollection do: [ :assoc | maxExtent := maxExtent max: assoc value minimumExtent ].
	fontsCollection do: [ :assoc | |m | 
		m := assoc value. 
		m  morphExtent: maxExtent "(maxExtent x) @ (m morphExtent y)"
	].

	ip := ImagePallet 
			fromCollection: fontsCollection.
	sw := Panel new.
	sw addMorph: ip.
	ip color: sw windowColor paler.
	sw setLabel: 'Pick a Font';
	showButtonsNamed: #( close collapse ).
	sw openInWorld.
	sw 	morphExtent: sw minimumExtent.   "openInWorld algorithm resets extent"
	^ sw! !
