Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Font survey
Last updated at 10:58 pm UTC on 25 August 2016
Boris Gaertner, 2006 (extracted from this page)

To produce this Workspace with a font survey evaluate the code below in a Workspace

Font survey.png

    | fontFamilies textStream string
   currentFont fontSizes selectedFont |
   fontFamilies := (StrikeFont familyNames
                     reject: [:symbol |
                              symbol == #DefaultTextStyle
                             | (symbol == #DefaultFixedTextStyle)
                             | (TextStyle named: symbol) fontArray
                               first isStrikeFont not]).
  string := 'The quick brown fox jumps over the lazy sleeping dog'.
  textStream := TextStream on: (Text new: 5000).
   fontFamilies do:
    [:symbol |  | fa |
   currentFont := TextStyle named: symbol.
       fa := currentFont fontArray.
       fontSizes := fa collect: [:fnt | fnt height].
       fontSizes  do:
         [:s |
        selectedFont := StrikeFont familyName: symbol
                                     size: s.
            textStream withAttribute: 
                (TextFontReference toFont: selectedFont)
                    do: [textStream nextPutAll: string; cr].
     ].
      textStream cr.
    ].
   Workspace new
    contents: textStream contents;
    openLabel: 'Font survey:'