Contents

Script to Shrink the Image of Squeak 3.7 #5989


Here you find some scripts that can be used to create very small images. All these scripts completely remove Morphic and many other things.

Shrinking Squeak 3.7 introduces a new and difficult problem: The removal of TTC fonts. It turned out that TextFontReference can cause a lot of problems: A single reference from a TextFontReference to a TTC font mutates nine classes into obsolete classes.

All necessary files are in the archive file Shrink37.zip. This archive contains two files:

It is important to close all change sorters (Change sorters contain references to classes and may therefore obstacle the complete removal of classes.)

  1. Start a fresh 3.7
  2. In a workspace, evaluate:
      | fnt ts |
     
     ts := (TextStyle named: 'Accujen') copy.
     ts defaultFontIndex: 2.
     fnt := (TextStyle named: 'Accujen') fontOfPointSize: 12.
     TextConstants at: #DefaultTextStyle put: ts.
    
     Preferences setBalloonHelpFontTo: fnt;
        setButtonFontTo: fnt;
        setEToysFontTo: fnt;
        setMenuFontTo: fnt.
     Preferences setParameter: #standardFlapFont to: fnt.
     Preferences setParameter: #standardCodeFont to: fnt.
    
     Preferences setParameter: #standardListFont to: fnt.
     ListParagraph initialize.
     Preferences setParameter: #windowTitleFont to: fnt.
     StandardSystemView setLabelStyle.

    This ensures that no TrueType fonts will be used.
  3. Optionally, open the preferences window and select a set op preferences that conforms to your working habits.
  4. Enter an MVC project
    (you may wish to check the preferences before you enter the MVC project. You can change preferences also in a MVC project, but it is easier to do with the Morphic preferences selection tool)
  5. Open the transcript and the file list, file in neededFixes.4.cs
    (The transcript is not strictly necessary, but it is helpful)
  6. File in Shrink37.40.cs
  7. In a workspace, evaluate:
    Smalltalk preMajorShrink.
    Smalltalk majorShrink.
  8. Evaluate with 'printIt':
    Smalltalk obsoleteClasses size.

    This should answer 0. If it does not, try it a few times. (It may also be helpful to do a full GC)
  9. Evaluate:
    Smalltalk condenseSources.

    This will ask you for a name for the new sources file and write all sources from both the changes file and the sources file into the new sources file.
  10. Save the image.

This should give a MVC-only system with a 1.6 MBytes image and a 3.6 MBytes sources file.


Contents