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

时间:2009-02-22 12:50:32

标签: fonts smalltalk squeak pharo

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

4 个答案:

答案 0 :(得分: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.

答案 1 :(得分: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.

答案 2 :(得分: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.  

答案 3 :(得分:4)

在使用Pharo 2.0的Linux上,我将以下内容添加到图像启动时自动读取的特殊目录中的文件中:

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

此特殊目录可以通过

显示
FileDirectory preferencesVersionFolder

您应该阅读StartupLoader类的文档。