代码之家  ›  专栏  ›  技术社区  ›  PersistenceOfVision

如何在Smalltalk Squeak/Pharo中轻松更改为本地字体

  •  13
  • PersistenceOfVision  · 技术社区  · 6 年前

    对于每个新的squeak/pharo图像,我立即将字体更改为一些本地版本。这是一个很大的漏洞,我想脚本的过程。

    4 回复  |  直到 13 年前
        1
  •  8
  •   nes1983    16 年前

    上面的答案现在可能已经过时了,至少在我的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.
    
        2
  •  6
  •   soemirno    16 年前

    找到了答案,正在寻找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.
    
        3
  •  6
  •   Sebastian Sastre    13 年前

    这是法罗的新方法:

    |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
  •  4
  •   Damien Cassou    12 年前

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

    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
    

    您应该阅读StudiPuaDER类的文档。