Sunday, April 3, 2011

How can I easily change to native fonts in Smalltalk Squeak/Pharo

With every new Squeak image, I immediately change the fonts to some native version. It is a lot of mouseclicks and I want to script the proces.

From stackoverflow
  • 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.
    
  • 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.
    

0 comments:

Post a Comment