2009-02-22 14 views

risposta

6

Trovato la risposta, cercava setSystemFontTo. Lo script completo è ora:

"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

La risposta sopra potrebbe essere superata, almeno non funziona con la mia immagine 3.10. così, io uso questo:

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

Questo è il nuovo modo per farlo in 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

su Linux con Pharo 2.0, ho aggiunto il seguente contenuto in un file in una speciale directory che viene letto automaticamente all'avvio 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]. 
}. 

Questa directory speciale può essere rivelato con

FileDirectory preferencesVersionFolder 

Si consiglia di leggere la documentazione della classe StartupLoader.