Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TTFileDescription
Last updated at 9:36 am UTC on 10 April 2017
Contrary to TTFontDescription, this class leaves true type files on disk and only reads the required portions when constructing glyphs. This avoids the need of reading the entire font into memory at the cost of having to hit disk whenever a glyph is requested.


fontPathsDo: aBlock
	"Evaluate aBlock with all of the font paths that should be searched on the current platform"

	"Start with the current directory"
	aBlock value: FileDirectory default pathName.

	"Then subdirectory 'fonts'"
	aBlock value: (FileDirectory default directoryNamed: 'fonts') pathName.

	"Platform specific directories"
	Smalltalk platformName caseOf:{
		['Win32']	->	[
			"Standard Windows fonts directory"
			aBlock value: 'C:\Windows\Fonts'.
		].
		['Mac OS']	->	[
			"Standard system fonts directories"
			#('/System/Library/Fonts' '/Library/Fonts') do: [:fontDir |
				aBlock value: fontDir].
		].
		['unix']		->	[ | base |
			"Standard fonts are in /usr/share/fonts/*"
			base := '/usr/share/fonts'.
			(FileDirectory on: base) directoryNames 
				do:[:dn| aBlock value: base, '/', dn].
		].
	} otherwise:[].