如何轻松更改为Smalltalk中的原生字体Squeak/Pharo


13

随着每个新的Squeak/Pharo图像,我立即将字体更改为某个本地版本。这是很多鼠标点击,我想编写过程。

  0

即:更改为真正的字体。 08 7月. 092009-07-08 11:34:00

6

找到答案,正在寻找setSystemFontTo。现在完整的脚本是:

"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. 

8

上面的答案可能已经过时了,至少它不适用于我的3.10图像。所以,我用这个:

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. 

6

这是做它的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. 

4

在Linux与菲罗2.0,添加以下内容到一个文件中的一个特殊即读取图像启动时自动目录:

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]. 
}. 

这种特殊的目录可以

0123揭晓
FileDirectory preferencesVersionFolder 

您应该阅读StartupLoader类的文档。