13

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

4

4 回答 4

9

上面的答案现在可能已经过时了,至少它不适用于我的 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.
于 2009-05-09T21:05:03.817 回答
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.
于 2009-02-22T18:14:46.257 回答
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.  
于 2011-09-19T19:31:32.070 回答
4

在带有 Pharo 2.0 的 Linux 上,我将以下内容添加到一个特殊目录中的文件中,该目录在 Image 启动时会自动读取:

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 类的文档。

于 2013-02-07T09:51:01.123 回答