With every new Squeak/Pharo image, I immediately change the fonts to some native version. It is a lot of mouseclicks and I want to script the process.
Asked
Active
Viewed 2,466 times
4 Answers
8
The above answer might be outdated by now, at least it doesn't work with my 3.10 image. so, I use this:
defaultFont := LogicalFont familyName: 'Geneva' pointSize: 10 emphasis:0 .
codeFont := LogicalFont familyName: 'Monaco' pointSize: 10 emphasis:0.
Preferences setCodeFontTo: codeFont.
Preferences setWindowTitleFontTo: defaultFont.
Preferences setButtonFontTo: defaultFont.
Preferences setListFontTo: defaultFont.
Preferences setMenuFontTo: defaultFont.
Preferences setSystemFontTo: defaultFont.

nes1983
- 15,209
- 4
- 44
- 64
6
Found the answer, was looking for setSystemFontTo. The complete script is now:
"Set fonts on Mac OS X"
defaultFont := LogicalFont familyName: 'Lucida Grande' pointSize: 10
stretchValue: 5 weightValue: 400 slantValue: 0.
codeFont := LogicalFont familyName: 'Monaco' pointSize: 10
stretchValue: 5 weightValue: 400 slantValue: 0.
Preferences setCodeFontTo: codeFont.
Preferences setWindowTitleFontTo: defaultFont.
Preferences setButtonFontTo: defaultFont.
Preferences setListFontTo: defaultFont.
Preferences setMenuFontTo: defaultFont.
Preferences setSystemFontTo: defaultFont.

soemirno
- 29,244
- 3
- 19
- 14
6
This is the new way to do it in Pharo:
|font codeFont|
font := LogicalFont familyName: 'Bitmap DejaVu Sans' pointSize: 10.
codeFont := LogicalFont familyName: 'Bitmap DejaVu Sans' pointSize: 9.
StandardFonts listFont: codeFont.
StandardFonts menuFont: font.
StandardFonts codeFont: codeFont.
StandardFonts buttonFont: codeFont.
StandardFonts defaultFont: font.
StandardFonts windowTitleFont: font.
FreeTypeFontProvider current updateFromSystem.

Sebastian Sastre
- 2,034
- 20
- 21
4
On Linux with Pharo 2.0, I added the following content to a file in a special directory that is read automatically on Image startup:
StartupLoader default executeAtomicItems: {
StartupAction
name: 'Use Free type'
code: '(Smalltalk at: #FreeTypeSystemSettings)
perform: #loadFt2Library: with: (true)'
runOnce: true.
StartupAction name: 'Setting up fonts' code: [
|font codeFont|
FileStream stdout lf; nextPutAll: 'Setting up fonts'; lf.
font := LogicalFont familyName: 'DejaVu Sans' pointSize: 12.
codeFont := LogicalFont familyName: 'DejaVu Sans Mono' pointSize: 12.
StandardFonts listFont: codeFont.
StandardFonts menuFont: font.
StandardFonts codeFont: codeFont.
StandardFonts buttonFont: codeFont.
StandardFonts defaultFont: font.
StandardFonts windowTitleFont: font.
StandardFonts balloonFont: font.
StandardFonts haloFont: font.
FileStream stdout lf; nextPutAll: 'Finished'; lf].
}.
This special directory can be revealed with
FileDirectory preferencesVersionFolder
You should read the documentation of the StartupLoader class.

Damien Cassou
- 2,555
- 1
- 16
- 21