'From Cuis 1.0 of 31 July 2009 [latest update: #250] on 6 August 2009 at 10:31:47 am'!

!Preferences class methodsFor: 'fonts' stamp: 'jmv 8/6/2009 00:15'!
restoreDefaultFonts
	"Since this is called from menus, we can take the opportunity to prompt for missing font styles."
	"Preferences restoreDefaultFonts"

	Preferences setDefaultFonts: #(
		(setSystemFontTo: 'DejaVu' 9)
		(setListFontTo: 'DejaVu' 9)
		(setMenuFontTo: 'DejaVu' 10)
		(setWindowTitleFontTo: 'DejaVu' 12)
		(setBalloonHelpFontTo: 'DejaVu' 10)
		(setCodeFontTo: 'DejaVu' 9)
		(setButtonFontTo: 'DejaVu' 9))! !


!StrikeFont class methodsFor: 'instance creation' stamp: 'jmv 8/6/2009 10:30'!
createDejaVu: pointSize
	
	| base bold oblique boldOblique point prefix |
	prefix _ 'AAFonts', FileDirectory slash, 'DejaVu Sans '.
	point := pointSize asString.
	base := (StrikeFont new
		buildFromForm: (Form fromFileNamed: prefix, 'Book ', point, '.bmp')
		data: (FileStream oldFileNamed: prefix, 'Book ', point, '.txt') contentsOfEntireFile substrings
		name: 'DejaVu ', point)
			pointSize: pointSize.
	bold := (StrikeFont new
		buildFromForm: (Form fromFileNamed: prefix, 'Bold ', point, '.bmp')
		data: (FileStream oldFileNamed: prefix, 'Bold ', point, '.txt') contentsOfEntireFile substrings
		name: 'DejaVu ', point, 'B')
			emphasis: 1;
			pointSize: pointSize.
	oblique := (StrikeFont new
		buildFromForm: (Form fromFileNamed: prefix, 'Oblique ', point, '.bmp')
		data: (FileStream oldFileNamed: prefix, 'Oblique ', point, '.txt') contentsOfEntireFile substrings
		name: 'DejaVu ', point, 'I')
			emphasis: 2;
			pointSize: pointSize.
	boldOblique := (StrikeFont new
		buildFromForm: (Form fromFileNamed: prefix, 'Bold Oblique ', point, '.bmp')
		data: (FileStream oldFileNamed: prefix, 'Bold Oblique ', point, '.txt') contentsOfEntireFile substrings
		name: 'DejaVu ', point, 'BI')
			emphasis: 3;
			pointSize: pointSize.
		
	base derivativeFont: bold at: 1.
	base derivativeFont: oblique at: 2.
	base derivativeFont: boldOblique at: 3.
	
	^base! !

!StrikeFont class methodsFor: 'instance creation' stamp: 'jmv 8/6/2009 00:14'!
installDejaVu
	"Warning: Uses the methods in 'dejaVu font data' category, that will be removed soon (or are already removed) to save space."
"
StrikeFont installDejaVu
"
	| dejaVuDict |
	dejaVuDict _ Dictionary new.
	5 to: 24 do: [ :s |
		dejaVuDict at: s put: (self createDejaVu: s) ].
	AvailableFonts at: 'DejaVu' put: dejaVuDict.
	Preferences restoreDefaultFonts! !

"Postscript:
Leave the line above, and replace the rest of this comment by a useful one.
Executable statements should follow this comment, and should
be separated by periods, with no exclamation points (!!).
Be sure to put any further comments in double-quotes, like this one."
StrikeFont installDejaVu!

