The Trunk: System-ar.372.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-ar.372.mcz

commits-2
Andreas Raab uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ar.372.mcz

==================== Summary ====================

Name: System-ar.372
Author: ar
Time: 6 September 2010, 11:41:07.251 am
UUID: b18bcec3-c793-ef47-b3c1-16c9ee1e2291
Ancestors: System-ar.371

Smalltalk unloadFonts unloads all but one font and shaves about 2MB of memory of an image.

=============== Diff against System-ar.371 ===============

Item was added:
+ ----- Method: SmalltalkImage>>unloadFonts (in category 'shrinking') -----
+ unloadFonts "Smalltalk unloadFonts"
+
+ "Unloads all fonts except the style specified initially."
+
+ | fontName fontSize textStyle |
+ "Three good choices here:
+ * Atlanta 11: Absolutely minimal font.
+ * Accuny 10: A few extra sizes over Atlanta.
+ * Bitmap DejaVu Sans 9: Nicest fonts but relatively large.
+ "
+ fontName := #'Bitmap DejaVu Sans'.
+ fontSize := 9.
+
+ "Nuke everything other than the desired text style"
+ textStyle := TextStyle named: fontName.
+ TextStyle defaultFamilyNames do:[:styleName|
+ TextConstants at: styleName put: textStyle
+ ].
+ TextStyle actualTextStyles keys do:[:styleName|
+ TextConstants removeKey: styleName
+ ].
+ TextConstants at: fontName put: textStyle.
+
+ "Use it everywhere"
+ Preferences setDefaultFonts: {
+ {#setSystemFontTo:. fontName. fontSize}.
+ {#setListFontTo:. fontName. fontSize}.
+ {#setFlapsFontTo:. fontName. fontSize}.
+ {#setEToysFontTo:. fontName. fontSize}.
+ {#setEToysTitleFontTo: . fontName. fontSize}.
+ {#setPaintBoxButtonFontTo:. fontName. fontSize}.
+ {#setMenuFontTo:. fontName. fontSize}.
+ {#setWindowTitleFontTo:. fontName. fontSize}.
+ {#setBalloonHelpFontTo:. fontName. fontSize}.
+ {#setCodeFontTo:. fontName. fontSize}.
+ {#setButtonFontTo:. fontName. fontSize}.
+ }.
+
+ "Clean out afterwards"
+ Smalltalk at: #TextEditor ifPresent:[:aClass| aClass initialize].
+ Smalltalk at: #SmalltalkEditor ifPresent:[:aClass| aClass initialize].
+ Smalltalk at: #SystemProgressMorph ifPresent:[:aClass| aClass reset].
+ Smalltalk at: #TTCFont ifPresent:[:aClass| aClass registry removeAll].
+ Smalltalk at: #Flaps ifPresent:[:aClass | aClass disableGlobalFlaps: false].
+ Smalltalk at: #TTFontDescription ifPresent:[:aClass| aClass clearDefault].
+ Smalltalk at: #TTFontDescription ifPresent:[:aClass| aClass clearDescriptions].
+ !