From 984e89e6eb723b94483e9f8f67ef882bb77561cf Mon Sep 17 00:00:00 2001 From: Chris Double Date: Fri, 20 Sep 2013 22:42:39 +1200 Subject: [PATCH 1/2] 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. --- objects/ui2/propertySheets.self | 12 ++++++------ objects/ui2/scalableFont.self | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/objects/ui2/propertySheets.self b/objects/ui2/propertySheets.self index cf56629a..d6b6ef61 100644 --- a/objects/ui2/propertySheets.self +++ b/objects/ui2/propertySheets.self @@ -1,7 +1,7 @@ '$Revision: 30.11 $' ' -Copyright 1992-2012 AUTHORS. -See the LICENSE file for license information. +Copyright 1992-2011 AUTHORS. +See the legal/LICENSE file for license information and legal/AUTHORS for authors. ' @@ -116,7 +116,7 @@ SlotsToOmit: parent prototype. | defaultButtonHolder: ui2Menu initializeDefaultButtonHolder: defaultButtonHolder. f: enumeratedTypeLabelMorph copyItemNames: labels Values: values DefaultButtonHolder: defaultButtonHolder. - f setSelectedIndex: (values asVector keyAt: v). + f setSelectedIndex: (values asVector keyAt: v IfAbsent: [ values asVector keyAt: 'defaultFont']). f fontSpec: globals fontSpec copyName: 'verdana' Size: outlinerPreferences mediumFontSize Style: 'bold'. buildFieldLabel: n ContentMorph: f). } | ) @@ -690,7 +690,7 @@ SlotsToOmit: parent prototype. bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'borderPropsMorph' -> () From: ( | { 'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private' - defaultButtonHolder. + defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> (). } | ) bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'borderPropsMorph' -> () From: ( | { @@ -886,7 +886,7 @@ SlotsToOmit: parent prototype. bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'labelPropsMorph' -> () From: ( | { 'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private' - defaultButtonHolder. + defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> (). } | ) bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'labelPropsMorph' -> () From: ( | { @@ -1119,7 +1119,7 @@ SlotsToOmit: parent prototype. bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'resizingPropsMorph' -> () From: ( | { 'Category: property specifics\x7fModuleInfo: Module: propertySheets InitialContents: InitializeToExpression: (nil)\x7fVisibility: private' - defaultButtonHolder. + defaultButtonHolder <- bootstrap stub -> 'globals' -> 'nil' -> (). } | ) bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'resizingPropsMorph' -> () From: ( | { diff --git a/objects/ui2/scalableFont.self b/objects/ui2/scalableFont.self index 22a294b7..514b4cff 100644 --- a/objects/ui2/scalableFont.self +++ b/objects/ui2/scalableFont.self @@ -1,7 +1,7 @@ 'Sun-$Revision: 30.10 $' ' -Copyright 1992-2012 AUTHORS. -See the LICENSE file for license information. +Copyright 1992-2011 AUTHORS. +See the legal/LICENSE file for license information and legal/AUTHORS for authors. ' @@ -236,6 +236,13 @@ SlotsToOmit: comment directory fileInTimeString myComment postFileIn revision su courierItalic = '-*-courier-medium-o-normal--'. } | ) + bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | { + 'Category: font substituion\x7fComment: Return font to be used for fonts that can\'t be found.\x7fModuleInfo: Module: scalableFont InitialContents: FollowSlot\x7fVisibility: public' + + defaultFont = ( | + | times). + } | ) + bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | { 'ModuleInfo: Module: scalableFont InitialContents: FollowSlot' @@ -560,7 +567,7 @@ I print out as asterisks.\x7fModuleInfo: Module: scalableFont InitialContents: F lastKvetchTime: now. ('unknown font: ', sel) printLine. ]. - times). + defaultFont). } | ) bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | { @@ -661,6 +668,9 @@ I print out as asterisks.\x7fModuleInfo: Module: scalableFont InitialContents: F (reflect: x11Globals fontFamily) do: [| :slot. :name | names add: name ]. names remove: 'parent'. names remove: 'aNoteAboutMacXFonts'. + names remove: 'undefinedSelector:Type:Delegatee:MethodHolder:Arguments:'. + names remove: 'lastKvetchTime'. + names remove: 'lastKvetchTime:'. names asVector sort). } | ) From 375e4b2e647afe692f12ca9b2d31ae57ab669bde Mon Sep 17 00:00:00 2001 From: Chris Double Date: Sun, 22 Sep 2013 01:16:05 +1200 Subject: [PATCH 2/2] Fix property sheet error in labelMorph on Mac OS X This fixes #4. On Mac OS X the 'scalableFont' property does not exist in the windowCanvas for quartz. This adds it by falling back on the X11 implementation. This commit also adds a 'verdana' font entry to the list of X11 fonts allow Verdana to display and be selected in the property sheet. On Mac OS X this correctly results in Verdana displaying. On Linux without Verdana it falls back to the default, Times. --- objects/ui2/canvas.self | 7 +++++++ objects/ui2/scalableFont.self | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/objects/ui2/canvas.self b/objects/ui2/canvas.self index e1ca2124..0b3eb570 100644 --- a/objects/ui2/canvas.self +++ b/objects/ui2/canvas.self @@ -2186,6 +2186,13 @@ the pixmapCache some day. pixmap <- bootstrap stub -> 'globals' -> 'quartzGlobals' -> 'bufferCanvas' -> (). } | ) + bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'quartzWindowCanvas' -> () From: ( | { + 'Category: portable accessing\x7fModuleInfo: Module: canvas InitialContents: FollowSlot\x7fVisibility: public' + + scalableFont = ( | + | x11Globals scalableFont). + } | ) + bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'xPixmapCanvas' -> () From: ( | { 'Category: converting ui2Image\'s\x7fModuleInfo: Module: canvas InitialContents: FollowSlot\x7fVisibility: public' diff --git a/objects/ui2/scalableFont.self b/objects/ui2/scalableFont.self index 514b4cff..0ebcd908 100644 --- a/objects/ui2/scalableFont.self +++ b/objects/ui2/scalableFont.self @@ -1,7 +1,7 @@ 'Sun-$Revision: 30.10 $' ' -Copyright 1992-2011 AUTHORS. -See the legal/LICENSE file for license information and legal/AUTHORS for authors. +Copyright 1992-2012 AUTHORS. +See the LICENSE file for license information. ' @@ -594,6 +594,12 @@ I print out as asterisks.\x7fModuleInfo: Module: scalableFont InitialContents: F urwAvantGardeItalic = '-*-itc avant garde-medium-o-normal-sans-'. } | ) + bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | { + 'ModuleInfo: Module: scalableFont InitialContents: FollowSlot' + + verdana = '-*-verdana-medium-r-normal-sans-'. + } | ) + bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'x11Globals' -> 'fontFamily' -> () From: ( | { 'ModuleInfo: Module: scalableFont InitialContents: FollowSlot'