links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to display a character map of a bitmap font
Last updated at 7:32 am UTC on 9 August 2017
The code snippet was posted to the mailing list on 5 Jan 2000 by Andrew C. Greenberg and and enhanced by Hannes Hirzel.

To display a character chart of a font copy the code snippet below
to a workspace, if needed adapt choose another font in the dictionary TextConstants. Evaluate the code. A Form with the character chart will be shown and a gif file is written to the default directory.

 Display restoreAfter:
 [strFnt := (TextConstants at: #Atlanta) fontArray at: 2.
 f := Form extent: 440@400.

 0 to: 15 do: [:i | i hex displayOn: f at: 10@(20*i).
  0 to: 15 do: [:j | ((ccode _ 16*i+j) between: 1 and: (strFnt xTable size - 2))
    ifTrue: [ (strFnt characterFormAt: ccode asCharacter) 
      displayOn: f at: (20*j+50)@(20*i)]
f displayAt: 20@100.

 GIFReadWriter putForm:  f onFileNamed: 'chartable_Atlanta_2.gif'  

updated for Squeak 5.1