lxsang / PTerm

MIT License
34 stars 8 forks source link

Font update broken when currently used fonts are deleted #48

Open lxsang opened 2 years ago

lxsang commented 2 years ago

There is a problem on Pharo 10 I think: I temporarily removed all DejaVu*.ttf files from my ~/Library/Fonts folder, then loaded the ‘master’ branch in a new Pharo 10 image; I got an error #members was sent to nil in StFontChooserPresenter>>#updateWithFont:.

Originally posted by @Rinzwind in https://github.com/lxsang/PTerm/issues/46#issuecomment-1217680658

lxsang commented 1 year ago

@Rinzwind maybe this problem is related to the commit fee29a6717019a95f32b491165677b8ed43e43da ?

Rinzwind commented 1 year ago

It’s related yes, but the commit does not fully fix the error. Scenario in which it still occurs:

⇒ A MessageNotUnderstood (#members was sent to nil) is signaled in StFontChooserPresenter>>#updateWithFont:

lxsang commented 11 months ago

@Rinzwind can i close this issue? Normally, we should not have this problem after the PR #57

Rinzwind commented 11 months ago

The error should no longer occur in the scenario that I gave above. But it might still be a good idea to take into account that the error would still occur in #selectFontUsingFontChooser whenever the initial font for the chooser does not exist, like in:

FontChooser openWithTitle: 'Font?'
    initialFont: (LogicalFont familyName: 'Foo Bar Baz Qux' pointSize: 10)
    onAcceptDo: #inspect

In #selectFontUsingFontChooser, that can be taken into account by using this for the initial font I think:

(self hasFont: font) ifTrue: [ font ] ifFalse: [ StandardFonts codeFont ]