Skip to content

Commit 721f5b2

Browse files
committed
Fix property sheet error from not finding labelMorph font
When getting the property sheet of a labelMorph that is using a font that doesn't exist in the 'x11Globals scalableFont' list an error occurs and the property sheet can't display. The scalableFont list has an undefinedSelector method which handles direct requests for fonts that don't exist and returns 'times'. Unfortunately the enumeration of the fonts that the property sheet uses just lists the selectors of 'fontFamily' so treats the undefinedSelect method as a font name and hence the default handlin never occurs. This fix taken here adds a 'defaultFont' to the scalableFont list. This returns 'times', the same as the undefined selector. The property sheet looks this up if the actual font name can't be found. I also remove the undefined selector slot name and a couple of other non-font slots that were missed in the x11Globals fontFamily method.
1 parent d126c6b commit 721f5b2

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

objects/ui2/propertySheets.self

100755100644
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'$Revision: 30.11 $'
22
'
3-
Copyright 1992-2012 AUTHORS.
4-
See the LICENSE file for license information.
3+
Copyright 1992-2011 AUTHORS.
4+
See the legal/LICENSE file for license information and legal/AUTHORS for authors.
55
'
66

77

@@ -116,7 +116,7 @@ SlotsToOmit: parent prototype.
116116
|
117117
defaultButtonHolder: ui2Menu initializeDefaultButtonHolder: defaultButtonHolder.
118118
f: enumeratedTypeLabelMorph copyItemNames: labels Values: values DefaultButtonHolder: defaultButtonHolder.
119-
f setSelectedIndex: (values asVector keyAt: v).
119+
f setSelectedIndex: (values asVector keyAt: v IfAbsent: [ values asVector keyAt: 'defaultFont']).
120120
f fontSpec: globals fontSpec copyName: 'verdana' Size: outlinerPreferences mediumFontSize Style: 'bold'.
121121
buildFieldLabel: n ContentMorph: f).
122122
} | )
@@ -690,7 +690,7 @@ SlotsToOmit: parent prototype.
690690
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'borderPropsMorph' -> () From: ( | {
691691
'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private'
692692

693-
defaultButtonHolder.
693+
defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> ().
694694
} | )
695695

696696
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'borderPropsMorph' -> () From: ( | {
@@ -886,7 +886,7 @@ SlotsToOmit: parent prototype.
886886
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'labelPropsMorph' -> () From: ( | {
887887
'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private'
888888

889-
defaultButtonHolder.
889+
defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> ().
890890
} | )
891891

892892
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'labelPropsMorph' -> () From: ( | {
@@ -1119,7 +1119,7 @@ SlotsToOmit: parent prototype.
11191119
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'resizingPropsMorph' -> () From: ( | {
11201120
'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private'
11211121

1122-
defaultButtonHolder.
1122+
defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> ().
11231123
} | )
11241124

11251125
bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'resizingPropsMorph' -> () From: ( | {

objects/ui2/scalableFont.self

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'Sun-$Revision: 30.10 $'
22
'
3-
Copyright 1992-2012 AUTHORS.
4-
See the LICENSE file for license information.
3+
Copyright 1992-2011 AUTHORS.
4+
See the legal/LICENSE file for license information and legal/AUTHORS for authors.
55
'
66

77

@@ -236,6 +236,13 @@ SlotsToOmit: comment directory fileInTimeString myComment postFileIn revision su
236236
courierItalic = '-*-courier-medium-o-normal--'.
237237
} | )
238238

239+
bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | {
240+
'Category: font substituion\x7fComment: Return font to be used for fonts that can\'t be found.\x7fModuleInfo: Module: scalableFont InitialContents: FollowSlot\x7fVisibility: public'
241+
242+
defaultFont = ( |
243+
| times).
244+
} | )
245+
239246
bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | {
240247
'ModuleInfo: Module: scalableFont InitialContents: FollowSlot'
241248

@@ -560,7 +567,7 @@ I print out as asterisks.\x7fModuleInfo: Module: scalableFont InitialContents: F
560567
lastKvetchTime: now.
561568
('unknown font: ', sel) printLine.
562569
].
563-
times).
570+
defaultFont).
564571
} | )
565572

566573
bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | {
@@ -661,6 +668,9 @@ I print out as asterisks.\x7fModuleInfo: Module: scalableFont InitialContents: F
661668
(reflect: x11Globals fontFamily) do: [| :slot. :name | names add: name ].
662669
names remove: 'parent'.
663670
names remove: 'aNoteAboutMacXFonts'.
671+
names remove: 'undefinedSelector:Type:Delegatee:MethodHolder:Arguments:'.
672+
names remove: 'lastKvetchTime'.
673+
names remove: 'lastKvetchTime:'.
664674
names asVector sort).
665675
} | )
666676

0 commit comments

Comments
 (0)