[英]How can I easily change to native fonts in Smalltalk Squeak/Pharo
隨着每個新的Squeak / Pharo圖像,我立即將字體更改為某些原生版本。 這是很多鼠標點擊,我想編寫過程腳本。
上面的答案可能已經過時了,至少它不適用於我的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.
找到答案,正在尋找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.
這是在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.
在使用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類的文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.